/* ==========================================================================
   Word Tack — marketing site stylesheet
   A single, dependency-light stylesheet. "Paper on a desk" aesthetic.
   Sections:
     1. Design tokens (custom properties)
     2. Reset & base
     3. Paper / desk textures (grid, grain)
     4. Typography
     5. Layout helpers
     6. Signature motifs (washi tape, cards, wordmark)
     7. Buttons & badges
     8. Site header & nav
     9. Hero
    10. Feature sections
    11. How-to-play strip
    12. Device mockups / screenshots
    13. Content pages (privacy, support, FAQ)
    14. Footer
    15. Motion & reduced-motion
   ========================================================================== */

/* 1. Design tokens ---------------------------------------------------------- */
:root {
  /* Palette — matches the app */
  --paper-bg:       #F5ECD7;   /* page paper */
  --soft-desk:      #F0E5C5;   /* muted desk, section backgrounds */
  --desk-surface:   #EDD9A3;   /* deeper desk accent */
  --tile-face:      #FDFAF3;   /* card / tile surface */
  --tile-border:    #C4A882;   /* card borders, hairlines */
  --ink-brown:      #3D2B1F;   /* primary text */
  --pencil-red:     #E76F51;   /* accent / links / emphasis */
  --completed-tint: #D4EDDA;   /* success green wash */
  --washi-orange:   #F4A261;   /* tape + primary buttons */
  --washi-mint:     #A8DADC;   /* tape accent */
  --washi-yellow:   #E9C46A;   /* tape accent */

  /* Derived / utility */
  --ink-soft:       #6B5544;   /* muted body text (AA on paper) */
  --line-strong:    #B59B73;   /* stronger hairline */

  /* Type */
  --font-type:  "Special Elite", "Courier New", Courier, monospace;
  --font-hand:  "Caveat", "Segoe Script", "Bradley Hand", cursive;
  --font-display: "Fredoka", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;

  /* Shape & shadow */
  --radius:       8px;
  --radius-sm:    6px;
  --shadow-card:  0 2px 4px rgba(61, 43, 31, 0.10), 0 8px 18px rgba(61, 43, 31, 0.10);
  --shadow-lift:  0 4px 8px rgba(61, 43, 31, 0.14), 0 16px 30px rgba(61, 43, 31, 0.14);

  /* Spacing rhythm */
  --gap:    1rem;
  --pad:    clamp(1rem, 4vw, 2rem);
  --section-y: clamp(3rem, 8vw, 6rem);
  --maxw:   1120px;

  --focus: 0 0 0 3px rgba(231, 111, 81, 0.45);
}

/* 2. Reset & base ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-type);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.7;
  color: var(--ink-brown);
  background-color: var(--paper-bg);
  position: relative;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: var(--pencil-red); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 100;
  background: var(--tile-face);
  color: var(--ink-brown);
  padding: 0.6rem 1rem;
  border: 1px solid var(--tile-border);
  border-radius: var(--radius-sm);
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0.5rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* 3. Paper / desk textures -------------------------------------------------- */
/* Faint graph-paper grid behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    repeating-linear-gradient(to right,  rgba(196, 168, 130, 0.16) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(to bottom, rgba(196, 168, 130, 0.16) 0 1px, transparent 1px 24px);
  background-color: var(--paper-bg);
}

/* Low-opacity paper grain (SVG feTurbulence in a data URI) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%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.04'/%3E%3C/svg%3E");
}

/* 4. Typography ------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink-brown);
  margin: 0 0 0.5em;
  letter-spacing: 0.01em;
}
h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem); }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.3rem); }
h3 { font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem); }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

.lede {
  font-size: clamp(1.1rem, 1rem + 0.6vw, 1.35rem);
  color: var(--ink-soft);
  max-width: 60ch;
}

.tagline {
  font-family: var(--font-hand);
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.6rem);
  color: var(--pencil-red);
  line-height: 1.1;
  margin: 0 0 0.4em;
}

.scribble {
  font-family: var(--font-hand);
  font-size: 1.4rem;
  color: var(--pencil-red);
  line-height: 1;
}

/* Typewriter label — small caps tag used above sections */
.label {
  font-family: var(--font-type);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  color: var(--ink-soft);
  display: inline-block;
  margin: 0 0 0.6rem;
}

/* 5. Layout helpers --------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.section { padding-block: var(--section-y); }

.section--desk   { background: var(--soft-desk); }
.section--deeper { background: var(--desk-surface); }

.section-head { text-align: center; max-width: 46ch; margin-inline: auto; margin-bottom: clamp(2rem, 5vw, 3rem); }
.section-head p { color: var(--ink-soft); }

.stack > * + * { margin-top: var(--gap); }

/* 6. Signature motifs ------------------------------------------------------- */

/* --- Cards: cream paper, hairline, soft shadow, tiny rotation --- */
.card {
  background: var(--tile-face);
  border: 1px solid var(--tile-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: clamp(1.25rem, 3vw, 2rem);
  position: relative;
}

/* Tilt helpers — apply small rotations so nothing feels rigid */
.tilt-l  { transform: rotate(-1.2deg); }
.tilt-r  { transform: rotate(1.2deg); }
.tilt-l2 { transform: rotate(-2.4deg); }
.tilt-r2 { transform: rotate(2.4deg); }

/* --- Washi tape strip --- */
.washi {
  --tape: var(--washi-orange);
  display: inline-block;
  position: relative;
  padding: 0.25em 1.1em;
  background: var(--tape);
  color: var(--ink-brown);
  font-family: var(--font-type);
  /* soft, semi-transparent feathered edges */
  opacity: 0.92;
  box-shadow: inset 0 0 0 100px rgba(255, 255, 255, 0.06);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 5px, #000 calc(100% - 5px), transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 5px, #000 calc(100% - 5px), transparent 100%);
}
.washi::after {
  /* faint paper sheen lines across the tape */
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.10) 0 2px, transparent 2px 7px);
  pointer-events: none;
}
.washi--mint   { --tape: var(--washi-mint); }
.washi--yellow { --tape: var(--washi-yellow); }
.washi--orange { --tape: var(--washi-orange); }

/* A taped-down section header: the heading sits on a tape strip */
.taped-title {
  display: inline-block;
  transform: rotate(-1.5deg);
}
.taped-title .washi {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem);
  padding: 0.15em 0.9em;
  box-shadow: var(--shadow-card);
  border-radius: 2px;
}

/* --- The WORD / TACK letter-tile wordmark --- */
.wordmark {
  display: inline-flex;
  flex-direction: column;
  gap: 0.4rem;
  position: relative;
  --tile: clamp(2.6rem, 1.6rem + 6vw, 4.6rem);
}
.wordmark__row {
  display: flex;
  gap: 0.4rem;
  position: relative;
}
.wordmark__row:nth-child(1) { transform: rotate(-1.5deg); }
.wordmark__row:nth-child(2) { transform: rotate(1deg); margin-left: 0.6rem; }

.wordmark__tile {
  width: var(--tile);
  height: var(--tile);
  display: grid;
  place-items: center;
  background: var(--tile-face);
  border: 1px solid var(--tile-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: calc(var(--tile) * 0.56);
  color: var(--ink-brown);
  line-height: 1;
}

/* washi strip crossing each wordmark row */
.wordmark__row::after {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  top: 52%;
  height: 28%;
  transform: rotate(-3deg);
  background: var(--washi-mint);
  opacity: 0.72;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(61,43,31,0.12);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 6px, #000 calc(100% - 6px), transparent);
          mask-image: linear-gradient(to right, transparent, #000 6px, #000 calc(100% - 6px), transparent);
  pointer-events: none;
}
.wordmark__row:nth-child(2)::after {
  background: var(--washi-orange);
  transform: rotate(2.5deg);
  top: 48%;
}

/* small inline version for header/footer brand lockup */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--ink-brown);
}
.brand__icon {
  width: 38px; height: 38px;
  flex: 0 0 auto;
  transform: rotate(-3deg);
}
.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

/* 7. Buttons & badges ------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-type);
  font-size: 1rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--tile-border);
  background: var(--tile-face);
  color: var(--ink-brown);
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--washi-orange);
  border-color: #d98a4e;
  color: var(--ink-brown);
  font-weight: 400;
}

/* App Store badge — self-contained, no external image needed */
.appstore-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1.2rem 0.6rem 1.05rem;
  background: var(--ink-brown);
  color: var(--tile-face);
  border-radius: 10px;
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.appstore-badge:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.appstore-badge svg { width: 26px; height: 26px; flex: 0 0 auto; fill: var(--tile-face); }
.appstore-badge .small { display: block; font-size: 0.65rem; letter-spacing: 0.05em; opacity: 0.85; line-height: 1.1; }
.appstore-badge .big   { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; line-height: 1.1; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: center; }

/* 8. Site header & nav ------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper-bg) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--tile-border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.6rem;
}

.nav { display: flex; align-items: center; gap: 0.3rem; }
.nav a {
  font-family: var(--font-type);
  color: var(--ink-brown);
  text-decoration: none;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}
.nav a:hover { background: var(--soft-desk); }
.nav a[aria-current="page"] {
  background: var(--washi-yellow);
  box-shadow: inset 0 0 0 1px rgba(61,43,31,0.08);
}

.nav-toggle {
  display: none;
  background: var(--tile-face);
  border: 1px solid var(--tile-border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  color: var(--ink-brown);
}
.nav-toggle svg { width: 22px; height: 22px; display: block; }

@media (max-width: 640px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute;
    top: 100%;
    right: var(--pad);
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    background: var(--tile-face);
    border: 1px solid var(--tile-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lift);
    padding: 0.5rem;
    min-width: 11rem;
    display: none;
  }
  .nav[data-open="true"] { display: flex; }
  .nav a { padding: 0.6rem 0.8rem; }
}

/* 9. Hero ------------------------------------------------------------------- */
.hero { padding-block: clamp(2.5rem, 7vw, 5rem) var(--section-y); }
.hero__inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.hero__wordmark { margin-bottom: 1.6rem; }
.hero__cta { margin-top: 1.8rem; }
.hero__note {
  margin-top: 0.9rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; text-align: center; }
  .hero__wordmark { justify-content: center; display: flex; }
  .lede, .section-head p { margin-inline: auto; }
  .hero__cta .btn-row { justify-content: center; }
}

/* 10. Feature sections ------------------------------------------------------ */
.features { display: grid; gap: clamp(1.5rem, 4vw, 2.5rem); }

.feature {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}
.feature:nth-child(even) .feature__media { order: 2; }
.feature__body .label { margin-bottom: 0.4rem; }
.feature__icon {
  width: 56px; height: 56px;
  margin-bottom: 0.8rem;
}

@media (max-width: 760px) {
  .feature { grid-template-columns: 1fr; }
  .feature:nth-child(even) .feature__media { order: 0; }
  .feature__media { max-width: 22rem; margin-inline: auto; }
}

/* Compact feature grid (used for the smaller features) */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: clamp(1.2rem, 3vw, 1.8rem);
}
.feature-grid .card { height: 100%; }
.feature-grid .card .feature__icon { width: 46px; height: 46px; }

/* 11. How-to-play strip ----------------------------------------------------- */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: clamp(1.2rem, 3vw, 2rem);
  counter-reset: step;
}
.step { position: relative; padding-top: 0.5rem; }
.step__num {
  display: inline-grid;
  place-items: center;
  width: 2.6rem; height: 2.6rem;
  border-radius: 50%;
  background: var(--washi-mint);
  border: 1px solid var(--tile-border);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  margin-bottom: 0.6rem;
  box-shadow: var(--shadow-card);
}
.step:nth-child(2) .step__num { background: var(--washi-yellow); }
.step:nth-child(3) .step__num { background: var(--washi-orange); }
.step:nth-child(4) .step__num { background: var(--completed-tint); }
.step h3 { font-size: 1.15rem; }

/* 12. Device mockups / screenshots ------------------------------------------ */
/* A "phone" frame. Drop a real PNG into <img class="phone__shot"> to swap. */
.devices {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(0.5rem, 2vw, 1.5rem);
  flex-wrap: wrap;
}
.phone {
  position: relative;
  width: clamp(180px, 60vw, 240px);
  aspect-ratio: 9 / 19.5;
  background: var(--ink-brown);
  border-radius: 30px;
  padding: 10px;
  box-shadow: var(--shadow-lift);
}
.phone--back { transform: rotate(-4deg) translateY(10px) scale(0.92); opacity: 0.96; }
.phone--front { transform: rotate(2deg); z-index: 2; }
.phone__screen {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 22px;
  overflow: hidden;
  background: var(--soft-desk);
  display: grid;
  place-items: center;
}
.phone__screen::before {
  /* graph-paper hint inside the placeholder screen */
  content: "";
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(to right,  rgba(196,168,130,0.3) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(to bottom, rgba(196,168,130,0.3) 0 1px, transparent 1px 18px);
}
.phone__notch {
  position: absolute;
  top: 14px; left: 50%; transform: translateX(-50%);
  width: 38%; height: 18px;
  background: var(--ink-brown);
  border-radius: 0 0 12px 12px;
  z-index: 3;
}
.phone__shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.phone__label {
  position: relative;
  font-family: var(--font-hand);
  font-size: 1.5rem;
  color: var(--ink-soft);
  text-align: center;
  padding: 1rem;
}
.phone__label span { display: block; font-family: var(--font-type); font-size: 0.7rem; letter-spacing: 0.15em; text-transform: uppercase; }

/* 13. Content pages (privacy, support) -------------------------------------- */
.page-head {
  padding-block: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
}
.page-head .updated {
  font-family: var(--font-type);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.prose { max-width: 70ch; margin-inline: auto; }
.prose h2 { margin-top: 2.2rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.5rem; }
.prose .callout {
  background: var(--completed-tint);
  border: 1px solid var(--tile-border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow-card);
}

/* Contact card */
.contact-card {
  text-align: center;
  max-width: 34rem;
  margin-inline: auto;
}
.contact-card .btn { margin-top: 0.6rem; }

/* FAQ accordion */
.faq { max-width: 60ch; margin-inline: auto; display: grid; gap: 0.9rem; }
.faq__item {
  background: var(--tile-face);
  border: 1px solid var(--tile-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.faq__item:nth-child(odd)  { transform: rotate(-0.4deg); }
.faq__item:nth-child(even) { transform: rotate(0.4deg); }
.faq__q {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink-brown);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.faq__q:hover { background: var(--soft-desk); }
.faq__icon {
  flex: 0 0 auto;
  width: 1.4rem; height: 1.4rem;
  transition: transform 0.25s ease;
  position: relative;
}
.faq__icon::before, .faq__icon::after {
  content: ""; position: absolute; background: var(--pencil-red);
  border-radius: 2px;
  top: 50%; left: 50%;
}
.faq__icon::before { width: 1rem; height: 2px; transform: translate(-50%, -50%); }
.faq__icon::after  { width: 2px; height: 1rem; transform: translate(-50%, -50%); transition: transform 0.25s ease; }
.faq__q[aria-expanded="true"] .faq__icon::after { transform: translate(-50%, -50%) scaleY(0); }

.faq__a {
  padding: 0 1.2rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.faq__item:has(.faq__q[aria-expanded="true"]) .faq__a { padding: 0 1.2rem 1.1rem; max-height: 30rem; }
.faq__a p { color: var(--ink-soft); }

/* 14. Footer ---------------------------------------------------------------- */
.site-footer {
  background: var(--desk-surface);
  border-top: 1px solid var(--tile-border);
  padding-block: clamp(2rem, 5vw, 3rem);
  margin-top: var(--section-y);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 2rem;
  align-items: center;
  justify-content: space-between;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
.footer-nav a { color: var(--ink-brown); text-decoration: none; padding: 0.2rem 0; }
.footer-nav a:hover { text-decoration: underline; }
.footer-meta { font-size: 0.85rem; color: var(--ink-soft); }
.footer-meta p { margin: 0; }

/* 15. Motion ---------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .btn:hover, .appstore-badge:hover, .card:hover { transform: none; }
}
