/* Beyeux - hand-built stylesheet */
:root {
  --linen: #e9dfc9;
  --linen-deep: #ddd0b2;
  --cloth: #f4edda;
  --ink: #3a2d26;
  --ink-soft: rgba(58, 45, 38, 0.72);
  --red: #9e3b2c;
  --blue: #4e6e7e;
  --ochre: #b98f2e;
  --sage: #7a8464;
  --serif: "IM Fell English", Georgia, serif;
  --serif-sc: "IM Fell English SC", Georgia, serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  background-color: var(--linen);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E"),
    repeating-linear-gradient(0deg, rgba(58,45,38,0.028) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(90deg, rgba(58,45,38,0.022) 0 1px, transparent 1px 5px);
  line-height: 1.55;
}

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(18px, 5vw, 56px);
  border-bottom: 2px solid rgba(58,45,38,0.25);
  position: sticky;
  top: 0;
  background-color: rgba(233, 223, 201, 0.94);
  backdrop-filter: blur(3px);
  z-index: 10;
}

.brand { display: inline-block; text-decoration: none; }

.wordmark { width: 178px; height: auto; display: block; }
.wordmark .wm-letter path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 6.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wordmark .wm-red path { stroke: var(--red); }

.wordmark-small { width: 132px; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  justify-content: flex-end;
}
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif-sc);
  font-size: 17px;
  letter-spacing: 0.03em;
  border-bottom: 2px dashed transparent;
  padding-bottom: 2px;
}
.site-nav a:hover { border-bottom-color: var(--red); color: var(--red); }

/* ---------- hero ---------- */
.hero {
  text-align: center;
  padding: clamp(48px, 9vw, 96px) clamp(20px, 6vw, 64px) 26px;
  max-width: 860px;
  margin: 0 auto;
}

.kicker {
  font-family: var(--serif-sc);
  letter-spacing: 0.22em;
  font-size: 14px;
  color: var(--red);
  margin: 0 0 18px;
}

.hero h1 {
  font-family: var(--serif-sc);
  font-size: clamp(34px, 7vw, 60px);
  line-height: 1.08;
  margin: 0 0 20px;
  font-weight: 400;
}

.lede {
  font-size: clamp(17px, 2.6vw, 21px);
  color: var(--ink-soft);
  max-width: 640px;
  margin: 0 auto 30px;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  background: var(--ink);
  color: var(--cloth);
  font-family: var(--serif-sc);
  font-size: 19px;
  letter-spacing: 0.04em;
  text-decoration: none;
  padding: 13px 30px;
  border-radius: 3px;
  transform: rotate(-0.6deg);
  box-shadow: 3px 4px 0 rgba(58,45,38,0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover {
  transform: rotate(0deg) translateY(-2px);
  box-shadow: 4px 6px 0 rgba(58,45,38,0.3);
  background: var(--red);
}

.soon-pill {
  font-family: var(--serif-sc);
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--blue);
  border: 2px dashed var(--blue);
  border-radius: 999px;
  padding: 8px 18px;
  transform: rotate(0.8deg);
}

.hero-rule { margin-top: clamp(34px, 6vw, 60px); }
.hero-rule svg { width: 100%; height: 22px; display: block; }
.rule-stitches path {
  stroke: var(--red);
  stroke-width: 4.5;
  stroke-linecap: round;
  fill: none;
}
.rule-stitches path:nth-child(3n+2) { stroke: var(--blue); }
.rule-stitches path:nth-child(3n) { stroke: var(--ochre); }

/* ---------- sections ---------- */
section { padding: clamp(40px, 7vw, 72px) clamp(20px, 6vw, 64px); max-width: 1040px; margin: 0 auto; }

h2 {
  font-family: var(--serif-sc);
  font-weight: 400;
  font-size: clamp(26px, 4.6vw, 38px);
  text-align: center;
  margin: 0 0 34px;
}
h2::after {
  content: "";
  display: block;
  width: 74px;
  margin: 14px auto 0;
  border-bottom: 3px dashed var(--red);
  transform: rotate(-0.6deg);
}

/* how */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}
.step {
  position: relative;
  background: var(--cloth);
  border: 2px dashed rgba(58,45,38,0.45);
  border-radius: 6px;
  padding: 26px 22px 24px;
  text-align: center;
}
.step:nth-child(1) { transform: rotate(-0.5deg); }
.step:nth-child(2) { transform: rotate(0.4deg); }
.step:nth-child(3) { transform: rotate(-0.3deg); }

.step-num {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  background: var(--red);
  color: var(--cloth);
  font-family: var(--serif-sc);
  font-size: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 3px 0 rgba(58,45,38,0.25);
}

.step-icon {
  width: 56px;
  height: 56px;
  margin: 8px auto 12px;
  display: block;
}
.step-icon * {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.step h3 {
  font-family: var(--serif-sc);
  font-weight: 400;
  font-size: 22px;
  margin: 0 0 8px;
}
.step p { margin: 0; color: var(--ink-soft); font-size: 16.5px; }

/* craft */
.panel {
  background: var(--cloth);
  border-radius: 6px;
  padding: clamp(26px, 5vw, 48px);
}
.stitched-panel {
  border: 2px solid rgba(58,45,38,0.6);
  outline: 2px dashed rgba(158,59,44,0.55);
  outline-offset: -10px;
  box-shadow: 4px 5px 0 rgba(58,45,38,0.16);
}
.craft .panel h2 { text-align: left; }
.craft .panel h2::after { margin-left: 0; }
.craft p { font-size: 18px; color: var(--ink-soft); margin: 0 0 16px; }
.craft-list {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 26px;
}
.craft-list li {
  font-family: var(--serif-sc);
  font-size: 17px;
  padding-left: 26px;
  position: relative;
}
.craft-list li::before {
  content: "\00D7";
  position: absolute;
  left: 0;
  top: -2px;
  color: var(--red);
  font-size: 22px;
  font-weight: bold;
}

/* inspiration */
.inspiration .tapestry-figure {
  margin: 0 auto 22px;
  max-width: 900px;
}
.tapestry-figure img {
  width: 100%;
  display: block;
  border: 2px solid rgba(58,45,38,0.6);
  outline: 2px dashed rgba(78,110,126,0.5);
  outline-offset: -9px;
  border-radius: 4px;
}
.tapestry-figure figcaption {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 15.5px;
  text-align: center;
  margin-top: 12px;
}
.inspiration-copy {
  max-width: 660px;
  margin: 0 auto;
  text-align: center;
  font-size: 18px;
  color: var(--ink-soft);
}

/* faq */
.faq-list { max-width: 720px; margin: 0 auto; }
.faq-list details {
  background: var(--cloth);
  border: 2px dashed rgba(58,45,38,0.45);
  border-radius: 6px;
  margin-bottom: 14px;
  padding: 4px 0;
}
.faq-list summary {
  cursor: pointer;
  font-family: var(--serif-sc);
  font-size: 19px;
  padding: 14px 20px;
  list-style: none;
  position: relative;
}
.faq-list summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 12px;
  font-size: 22px;
  color: var(--red);
}
.faq-list details[open] summary::after { content: "\2013"; }
.faq-list details p {
  margin: 0;
  padding: 0 20px 16px;
  color: var(--ink-soft);
  font-size: 16.5px;
}

/* soon */
.soon-panel { text-align: center; max-width: 720px; margin: 0 auto; }
.soon-panel h2 { margin-bottom: 16px; }
.soon-panel p { font-size: 18px; color: var(--ink-soft); margin: 0; }

/* footer */
.site-footer {
  text-align: center;
  padding: 44px 20px 52px;
  border-top: 2px solid rgba(58,45,38,0.25);
}
.site-footer .wordmark-small { margin: 0 auto 14px; }
.footer-note { font-family: var(--serif-sc); font-size: 17px; margin: 0 0 6px; }
.footer-fine { font-size: 14.5px; color: var(--ink-soft); margin: 0; font-style: italic; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* mobile */
@media (max-width: 640px) {
  .site-header { flex-direction: column; gap: 10px; padding: 14px 16px; }
  .wordmark { width: 150px; }
  .site-nav { justify-content: center; gap: 6px 16px; }
  .site-nav a { font-size: 15.5px; }
  section { padding: 36px 16px; }
  .stitched-panel { outline-offset: -8px; }
}

/* anchor offset for sticky header */
section { scroll-margin-top: 96px; }

/* try it */
.try-panel > p { text-align: center; color: var(--ink-soft); font-size: 18px; margin: 0 0 26px; }
.try-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  align-items: start;
}
.try-side { text-align: center; }
.file-drop {
  display: inline-block;
  cursor: pointer;
  border: 2px dashed rgba(58,45,38,0.55);
  border-radius: 6px;
  padding: 14px 26px;
  font-family: var(--serif-sc);
  font-size: 18px;
  background: var(--linen);
  transform: rotate(-0.4deg);
}
.file-drop:hover { border-color: var(--red); color: var(--red); }
.file-drop input { display: none; }
.try-preview {
  width: 100%;
  margin-top: 16px;
  border: 2px solid rgba(58,45,38,0.6);
  border-radius: 4px;
  display: block;
}
.try .btn { margin-top: 16px; border: none; cursor: pointer; font-family: var(--serif-sc); }
.try .btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.try-status { font-style: italic; color: var(--ink-soft); font-size: 15.5px; min-height: 22px; margin: 10px 0 0; }
.try-status.error { color: var(--red); }
.try-placeholder {
  border: 2px dashed rgba(58,45,38,0.35);
  border-radius: 6px;
  padding: 60px 20px;
  color: var(--ink-soft);
  font-style: italic;
  margin-top: 16px;
}
@media (max-width: 640px) {
  .try-grid { grid-template-columns: 1fr; }
}

/* keep hidden previews hidden */
.try-preview[hidden] { display: none; }

/* wordmark as text */
.wordmark text { letter-spacing: 0; }

/* Legal pages */
.legal { max-width: 720px; margin: 0 auto; padding: 3rem 1.25rem 4rem; }
.legal h1 { font-family: 'IM Fell English SC', serif; font-size: 2.2rem; margin-bottom: .25rem; }
.legal h2 { font-family: 'IM Fell English SC', serif; font-size: 1.25rem; margin: 1.75rem 0 .4rem; }
.legal p { line-height: 1.6; margin: .5rem 0; color: #4a3d33; }
.legal a { color: #9e3b2c; }
.legal-updated { font-style: italic; color: #7a6a5c; font-size: .9rem; }
.wordmark-text { font-family: 'IM Fell English SC', serif; font-size: 1.6rem; letter-spacing: .18em; color: #3a2d26; text-decoration: none; }
.wordmark-text em { color: #9e3b2c; font-style: normal; }

/* Order section */
.order-panel { text-align: center; }
.order-price { margin: .5rem 0; }
.price-amount { font-family: 'IM Fell English SC', serif; font-size: 2.6rem; color: #3a2d26; }
.price-note { color: #7a6a5c; font-style: italic; margin-left: .4rem; }
.order-panel .btn { margin-top: 1rem; }

/* Result composed on cloth */
.result-frame { background: #e8ddc4 repeating-linear-gradient(0deg, rgba(120,100,70,.06) 0 2px, transparent 2px 4px), repeating-linear-gradient(90deg, rgba(120,100,70,.06) 0 2px, transparent 2px 4px); border: 1px dashed #a89478; border-radius: 4px; padding: 10px; }
.result-art { width: 100%; height: auto; display: block; }
.download-link { display: inline-block; margin-top: .5rem; color: #9e3b2c; font-size: .95rem; }

.legal a.btn { color: var(--cloth); }

footer a, .footer-fine a { color: var(--red); text-decoration: underline; }
footer a:hover { color: var(--ink); }

/* Full-page stitch overlay */
.stitch-overlay[hidden] { display: none; }
.stitch-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: #efe6d0;
  background-image: radial-gradient(#e2d5b8 1px, transparent 1px);
  background-size: 6px 6px;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: auto;
}
.stitch-stage {
  position: relative; width: min(960px, 94vw); text-align: center;
}
.stitch-close {
  position: absolute; top: -8px; right: 0; z-index: 2;
  background: none; border: 2px solid #4a2c14; border-radius: 50%;
  width: 40px; height: 40px; font-size: 22px; line-height: 1;
  color: #4a2c14; cursor: pointer;
}
.stitch-close:hover { background: #4a2c14; color: #efe6d0; }
.bayeux-band {
  border-top: 3px solid #4a2c14; border-bottom: 3px solid #4a2c14;
  background: #e7dcc2;
  overflow: hidden; height: 120px; margin: 32px 0 18px;
}
.bayeux-strip {
  display: flex; align-items: flex-end; gap: 54px;
  height: 100%; width: max-content;
  animation: bx-march 22s linear infinite;
}
.bayeux-strip svg { height: 96px; width: auto; flex: 0 0 auto; }
.bayeux-strip svg:nth-child(odd) { animation: bx-bob 0.9s ease-in-out infinite alternate; }
.bayeux-strip svg:nth-child(even) { animation: bx-bob 0.7s ease-in-out infinite alternate-reverse; }
@keyframes bx-march { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes bx-bob { from { transform: translateY(0); } to { transform: translateY(-5px); } }
.stitch-phase { font-size: 20px; color: #4a2c14; margin: 8px 0 2px; }
.stitch-elapsed { font-size: 14px; color: #7a6547; margin: 0 0 16px; }
.stitch-result img {
  max-width: 100%; max-height: 72vh; margin-top: 24px;
  border: 3px solid #4a2c14; background: transparent;
}
.stitch-caption { color: #7a6547; font-size: 14px; margin-top: 12px; }
.stitch-error p { color: #6e2f22; font-size: 17px; margin: 40px 0 16px; }
