/* Carve — nonogram3d.com landing page
   Palette and type lifted from the game itself: deep workshop green,
   cream carved stone, terracotta, Fredoka. */

@font-face {
  font-family: 'Fredoka';
  src: url('/fredoka-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('/fredoka-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  --bg: #16221f;
  --bg-lift: #1b2b28;
  --bg-card: #20322d;
  --line: #2c423c;
  --cream: #f2e8d5;
  --cream-dim: #c5c9b8;
  --faded: #8ba398;
  --ink: #4a3a2a;
  --orange: #e8804a;
  --orange-deep: #e07a4f;
  --terracotta: #b05330;
  --gold: #f2b04e;
  --mint: #4fa08b;
  --radius: 22px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Fredoka', 'Avenir Next', sans-serif;
  font-weight: 400;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--bg-lift) 0%, var(--bg) 62%, #101a17 100%);
  color: var(--cream);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* film grain over everything, like the game's textured felt */
.grain {
  position: fixed; inset: -50%; z-index: 40; pointer-events: none;
  width: 200%; height: 200%;
  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.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  animation: grain 9s steps(6) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0);} 20% { transform: translate(-2%,1%);}
  40% { transform: translate(1%,-2%);} 60% { transform: translate(-1%,2%);} 80% { transform: translate(2%,1%);}
}
@media (prefers-reduced-motion: reduce) { .grain { animation: none; } }

img { max-width: 100%; height: auto; display: block; }
.squircle {
  border-radius: 22.5%;
  box-shadow: 0 6px 18px rgba(0,0,0,.4), inset 0 0 0 1px rgba(242,232,213,.08);
}

h1, h2, h3 { font-weight: 600; letter-spacing: .01em; }
h2 { font-size: clamp(1.7rem, 4.2vw, 2.6rem); text-align: center; }
.section-lede { text-align: center; color: var(--faded); max-width: 46ch; margin: .7rem auto 0; font-size: 1.05rem; }

main { max-width: 1160px; margin: 0 auto; padding: 0 clamp(18px, 4vw, 40px); }
section { padding: clamp(56px, 9vw, 110px) 0 0; }

/* ------------------------------------------------------------- nav */
.nav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px clamp(18px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(44,66,60,.55);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--cream); }
.brand span { font-weight: 600; font-size: 1.18rem; line-height: 1.12; display: flex; flex-direction: column; }
.brand em { font-style: normal; font-weight: 400; font-size: .74rem; color: var(--faded); letter-spacing: .14em; text-transform: uppercase; }
.nav-cta {
  font-weight: 600; text-decoration: none; color: #24160f;
  background: linear-gradient(180deg, var(--orange), var(--orange-deep));
  padding: 10px 20px; border-radius: 999px; font-size: .95rem;
  box-shadow: 0 3px 12px rgba(224,122,79,.35);
  transition: transform .18s ease, box-shadow .18s ease;
}
.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(224,122,79,.45); }

/* ------------------------------------------------------------- hero */
.hero {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(16px, 3vw, 40px); align-items: center;
  min-height: min(88vh, 780px); padding-top: clamp(30px, 5vw, 60px);
}
.kicker {
  color: var(--gold); text-transform: uppercase; letter-spacing: .22em;
  font-size: .8rem; font-weight: 600; margin-bottom: 14px;
  animation: rise .7s ease both;
}
.hero h1 {
  font-size: clamp(2.35rem, 5.6vw, 3.9rem); line-height: 1.08;
  animation: rise .7s .08s ease both;
}
.hero .accent { color: var(--orange); }
.lede {
  color: var(--cream-dim); max-width: 44ch; margin-top: 18px; font-size: 1.08rem;
  animation: rise .7s .16s ease both;
}
.cta-row { display: flex; align-items: center; gap: 18px; margin-top: 30px; flex-wrap: wrap; animation: rise .7s .24s ease both; }
.badge-link { display: inline-block; transition: transform .18s ease; }
.badge-link:hover { transform: scale(1.04); }
.badge-link img { height: 60px; width: auto; }
.cta-note { color: var(--faded); font-size: .9rem; line-height: 1.45; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.hero-stage { position: relative; min-width: 0; }
#hero-canvas {
  width: 100%; aspect-ratio: 1 / 0.92; display: block;
  cursor: grab; touch-action: pan-y;
}
#hero-canvas.grabbing { cursor: grabbing; }
.stage-hint {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  color: var(--faded); margin-top: 6px;
  animation: rise .7s .5s ease both;
}
.hint-infinity { font-size: 3.6rem; line-height: 1; }
.hint-hand {
  width: 48px; height: 48px; color: var(--faded);
  animation: hint-swipe 2.6s ease-in-out infinite;
}
@keyframes hint-swipe {
  0%, 12%   { transform: translateX(-11px) rotate(-8deg); }
  38%, 50%  { transform: translateX(11px) rotate(8deg); }
  76%, 100% { transform: translateX(-11px) rotate(-8deg); }
}

/* ------------------------------------------------------------- steps */
.step-cards {
  list-style: none; display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(14px, 2.4vw, 26px); margin-top: 44px; counter-reset: step;
}
.step-cards li {
  position: relative; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 26px 28px; overflow: hidden;
  transition: transform .25s ease, border-color .25s ease;
}
.step-cards li:hover { transform: translateY(-4px); border-color: #3b574f; }
.step-cards li:nth-child(2) { transform: translateY(14px); }
.step-cards li:nth-child(2):hover { transform: translateY(10px); }
.step-n {
  position: absolute; top: -14px; right: 6px; font-size: 6.4rem; font-weight: 600;
  color: rgba(242,232,213,.05); line-height: 1; user-select: none;
}
.step-icon { width: 52px; height: 52px; margin-bottom: 16px; }
.step-cards h3 { color: var(--gold); font-size: 1.25rem; margin-bottom: 8px; }
.step-cards p { color: var(--cream-dim); font-size: .98rem; }

/* ------------------------------------------------------------- gallery */
.shots {
  display: flex; gap: clamp(14px, 2vw, 24px); overflow-x: auto; padding: 44px 4px 26px;
  scroll-snap-type: x mandatory; scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}
.shots figure { scroll-snap-align: center; flex: 0 0 auto; width: clamp(200px, 24vw, 262px); }
.shots img {
  border-radius: 30px; border: 1px solid rgba(242,232,213,.14);
  box-shadow: 0 18px 42px rgba(0,0,0,.45);
  transition: transform .3s ease;
}
.shots figure:hover img { transform: translateY(-6px) rotate(-.6deg); }
.shots figcaption { text-align: center; color: var(--faded); font-size: .86rem; margin-top: 12px; }

/* ------------------------------------------------------------- features */
.feature-grid {
  list-style: none; display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 2vw, 22px); margin-top: 44px;
}
.feature-grid li {
  background: linear-gradient(160deg, var(--bg-card), #1b2b27 78%);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 24px;
  transition: transform .25s ease, border-color .25s ease;
}
.feature-grid li:hover { transform: translateY(-3px); border-color: #3b574f; }
.feature-grid h3 { font-size: 1.08rem; margin-bottom: 6px; color: var(--cream); }
.feature-grid h3::before { content: '◆ '; color: var(--orange); font-size: .8em; }
.feature-grid p { color: var(--faded); font-size: .95rem; }

/* ------------------------------------------------------------- chapters shelf */
.shelf {
  display: flex; align-items: flex-end; justify-content: center;
  gap: clamp(8px, 1.6vw, 18px); margin-top: 52px; padding: 0 6px 18px;
  border-bottom: 14px solid #3a2a20; border-radius: 0 0 6px 6px;
  box-shadow: 0 22px 30px -18px rgba(0,0,0,.55);
  flex-wrap: nowrap;
}
.book {
  --spine: #a5502f;
  flex: 0 1 108px; min-width: 64px; height: clamp(230px, 26vw, 300px);
  background:
    linear-gradient(90deg, rgba(255,255,255,.14), rgba(255,255,255,0) 18%, rgba(0,0,0,.22) 92%),
    var(--spine);
  border-radius: 6px 10px 10px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 16px 6px 14px; text-align: center;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), 0 10px 18px rgba(0,0,0,.35);
  transition: transform .22s ease;
  position: relative;
}
.book::before, .book::after {
  content: ''; position: absolute; left: 10%; right: 10%; height: 2px;
  background: rgba(242,232,213,.55); border-radius: 2px;
  box-shadow: 0 5px 0 rgba(242,232,213,.55);
}
.book::before { top: 8px; } .book::after { bottom: 8px; }
.book:hover { transform: translateY(-8px); }
.book-ch { font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; color: rgba(242,232,213,.85); }
.book-title {
  writing-mode: vertical-rl; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  font-size: clamp(.72rem, 1.4vw, .98rem); color: var(--cream); flex: 1; min-height: 0;
  display: flex; align-items: center; padding: 8px 0;
}
.book-count { font-size: .62rem; color: rgba(242,232,213,.85); letter-spacing: .04em; }
.b1 { --spine: #a5502f; } .b2 { --spine: #3f8a6d; } .b3 { --spine: #b98d35; }
.b4 { --spine: #6b4d80; } .b5 { --spine: #2e6879; } .b6 { --spine: #8a3438; }
.iap-note { text-align: center; color: var(--faded); font-size: .9rem; max-width: 52ch; margin: 30px auto 0; }

/* ------------------------------------------------------------- faq */
.faq-list {
  max-width: 760px; margin: 46px auto 0;
  display: flex; flex-direction: column; gap: 12px;
}
.faq-list details {
  background: linear-gradient(160deg, var(--bg-card), #1b2b27 78%);
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .25s ease;
}
.faq-list details[open], .faq-list details:hover { border-color: #3b574f; }
.faq-list summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 16px;
  padding: 22px 24px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary h3 {
  font-size: 1.06rem; font-weight: 600; color: var(--cream);
  flex: 1; margin: 0;
}
/* the +/− toggle */
.faq-list summary::after {
  content: ''; flex: 0 0 auto; width: 14px; height: 14px;
  background:
    linear-gradient(var(--orange), var(--orange)) center/14px 2.4px no-repeat,
    linear-gradient(var(--orange), var(--orange)) center/2.4px 14px no-repeat;
  transition: transform .3s ease, background-size .3s ease;
}
.faq-list details[open] summary::after {
  transform: rotate(180deg);
  background:
    linear-gradient(var(--orange), var(--orange)) center/14px 2.4px no-repeat,
    linear-gradient(var(--orange), var(--orange)) center/2.4px 0 no-repeat;
}
.faq-list summary:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: var(--radius); }
.faq-list details p {
  padding: 0 24px 24px; color: var(--faded);
  font-size: .97rem; line-height: 1.62; max-width: 62ch;
}

/* ------------------------------------------------------------- closer */
.closer { text-align: center; padding-bottom: clamp(40px, 6vw, 70px); }
.closer-icon { margin: 0 auto 24px; }
.closer .badge-link { margin-top: 30px; }
.closer .badge-link img { height: 64px; }

/* ------------------------------------------------------------- footer */
.foot {
  border-top: 1px solid var(--line); margin-top: 40px;
  padding: 26px clamp(18px, 4vw, 40px) 34px;
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  color: var(--faded); font-size: .88rem;
}
.foot nav { display: flex; gap: 22px; }
.foot a { color: var(--cream-dim); text-decoration: none; }
.foot a:hover { color: var(--cream); text-decoration: underline; }

/* ------------------------------------------------------------- reveals */
.js .reveal-on-scroll { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; }
.reveal-on-scroll.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal-on-scroll { opacity: 1; transform: none; transition: none; }
  .kicker, .hero h1, .lede, .cta-row, .stage-hint, .hint-hand { animation: none; }
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 860px) {
  /* keep the whole hero — canvas, copy and App Store badge — above the fold */
  .hero { grid-template-columns: 1fr; min-height: 0; text-align: center; padding-top: 14px; gap: 10px; }
  .hero-copy { order: 1; display: flex; flex-direction: column; align-items: center; }
  .hero-stage { order: 0; }
  #hero-canvas { aspect-ratio: 1 / 0.8; max-height: 32vh; max-height: 32svh; margin: 0 auto; }
  .hint-infinity { font-size: 2.6rem; }
  .hint-hand { width: 36px; height: 36px; }
  .kicker { font-size: .72rem; margin-bottom: 8px; }
  .hero h1 { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .lede { font-size: .98rem; line-height: 1.45; margin-top: 12px; }
  .cta-row { margin-top: 18px; gap: 14px; flex-wrap: nowrap; }
  .cta-row .badge-link img { height: 52px; }
  .cta-note { text-align: left; font-size: .84rem; line-height: 1.35; }
  .step-cards { grid-template-columns: 1fr; max-width: 480px; margin-inline: auto; }
  .step-cards li:nth-child(2), .step-cards li:nth-child(2):hover { transform: none; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
}
/* compact phones (iPhone SE class): squeeze harder so the badge stays above the fold */
@media (max-width: 860px) and (max-height: 620px) {
  #hero-canvas { max-height: 24vh; max-height: 24svh; }
  .stage-hint { display: none; }
  .hero h1 { font-size: clamp(1.65rem, 7vw, 2.2rem); }
  .lede { font-size: .9rem; margin-top: 10px; }
  .cta-row { margin-top: 12px; }
}

@media (max-width: 560px) {
  .feature-grid { grid-template-columns: 1fr; max-width: 440px; margin-inline: auto; }
  .brand em { display: none; }
  .shots figure { width: 72vw; }
  .shelf { flex-wrap: wrap; border-bottom-width: 10px; }
  .book { flex: 0 1 30%; }
}

/* ------------------------------------------------------------- legal pages */
.legal {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 64px) clamp(18px, 5vw, 40px) 20px;
}
.legal-back {
  display: inline-block; margin-bottom: 28px;
  color: var(--faded); text-decoration: none; font-size: .92rem;
}
.legal-back:hover { color: var(--cream); }

.legal h1 {
  font-weight: 600; line-height: 1.15;
  font-size: clamp(2rem, 5vw, 2.9rem);
  letter-spacing: -0.01em;
}
.legal h2 {
  font-weight: 600; font-size: 1.28rem;
  text-align: left;              /* override the landing page's centred h2 */
  margin: 42px 0 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--cream);
}
.legal h3 {
  font-weight: 600; font-size: 1.03rem;
  margin: 26px 0 8px;
  color: var(--gold);
}
.legal p { margin: 0 0 14px; color: var(--cream-dim); }
.legal ul { margin: 0 0 16px; padding-left: 1.15em; color: var(--cream-dim); }
.legal li { margin-bottom: 8px; }
.legal li::marker { color: var(--terracotta); }
.legal strong { color: var(--cream); font-weight: 600; }
.legal a { color: var(--orange); text-decoration: none; }
.legal a:hover { text-decoration: underline; }
.legal code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .88em;
  background: var(--bg-card); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 6px; color: var(--cream);
}

.legal-meta {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 24px 0 30px;
}
.legal-meta p { margin: 0 0 4px; font-size: .93rem; }
.legal-meta p:last-child { margin-bottom: 0; }

.legal-lede {
  font-size: 1.08rem;
  color: var(--cream) !important;
  margin-bottom: 8px !important;
}

/* ------------------------------------------------------------ contact page */
.contact-cta {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 22px;
  margin: 30px 0 !important;
  text-align: center;
}
.contact-cta a {
  font-size: clamp(1.1rem, 4vw, 1.45rem);
  font-weight: 600;
  word-break: break-word;
}
