/* Into The Unwritten, pre-launch page. A small copy of the game's ink design system (app/ink.css and
   app/library.css in the game repo): soot and parchment grounds, Cormorant Garamond with Cormorant SC for caps,
   the top-nav plate, the burnt seam, nib-framed buttons. Ink red is kept for the cult: the Red Crown. */

@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/assets/fonts/cormorant-garamond.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/assets/fonts/cormorant-garamond-italic.woff2') format('woff2');
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant SC';
  src: url('/assets/fonts/cormorant-sc-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --soot: #171310;
  --soot-2: #1f1a16;
  --hair: #3d352e;
  --parchment: #e4dac6;
  --parchment-2: #d6cbb3;
  --ink: #1f1c19;
  --ink-2: #4a443d;
  --ink-3: #7a736a;
  --chalk: #e2d8c4;
  --chalk-fixed: #e2d8c4;
  --soot-fixed: #171310;
  --ash: #a89f8f;
  --tan: #cdb99c;
  --rust: #7a2a24;
  --bronze: #c5a684;
  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-caps: 'Cormorant SC', 'Cormorant Garamond', Georgia, serif;
  --gutter: 40px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.5;
  font-variant-numeric: lining-nums;
  color: var(--chalk);
  background-color: var(--soot);
  background-image:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0) 60%),
    url('/assets/design/soot-grain.webp');
  background-size: auto, 512px 512px;
  background-blend-mode: normal, soft-light;
  -webkit-font-smoothing: antialiased;
}
img, video, svg { display: block; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-underline-offset: 4px; text-decoration-thickness: 1px; }
::selection { background: var(--bronze); color: var(--ink); }
:focus-visible { outline: 2px solid var(--bronze); outline-offset: 3px; }
.paper :focus-visible { outline-color: var(--ink); }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  padding: 10px 16px; background: var(--parchment); color: var(--ink);
  font-family: var(--font-caps); letter-spacing: 0.12em; font-size: 15px;
}
.skip:focus { top: 12px; }

/* ---------- type ---------- */
.eyebrow {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.16em;
  color: var(--ink-2);
}
h1, h2 { font-family: var(--font-display); font-weight: 600; margin: 0; text-wrap: balance; }

/* ---------- materials ---------- */
.paper {
  position: relative;
  color: var(--ink);
  background-color: var(--parchment);
  background-image:
    radial-gradient(130% 110% at 50% 50%, rgba(0, 0, 0, 0) 60%, rgba(78, 60, 40, 0.16) 100%),
    url('/assets/design/parchment-grain.webp');
  background-size: auto, 512px 512px;
  background-blend-mode: multiply, soft-light;
}
.orn { display: block; height: 22px; width: auto; max-width: 100%; pointer-events: none; user-select: none; }

/* ---------- buttons: the game's .btn, a nib-drawn double frame with diamond ends ---------- */
.btn {
  --edge-c: var(--chalk-fixed);
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 24px;
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.14em;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  color: var(--chalk-fixed);
  background: var(--soot-fixed);
  border: 1px solid var(--edge-c);
  box-shadow: inset 0 0 0 3px var(--soot-fixed), inset 0 0 0 4px var(--edge-c);
  position: relative;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  filter: url(#ink-wobble);
}
.btn::before, .btn::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border: 1px solid var(--edge-c);
  transform: rotate(45deg);
  background: var(--soot-fixed);
}
.btn::before { left: -4px; }
.btn::after { right: -4px; }
.btn:hover { background: #2b241e; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.secondary {
  --edge-c: var(--ink);
  color: var(--ink);
  background-color: var(--parchment);
  box-shadow: inset 0 0 0 3px var(--parchment), inset 0 0 0 4px var(--ink);
}
.btn.secondary::before, .btn.secondary::after { background: var(--parchment); }
.btn.secondary:hover { background: var(--parchment-2); }
.btn .arrow { font-family: var(--font-display); font-size: 20px; line-height: 1; }
.btn .dur { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 16px; letter-spacing: 0.02em; opacity: 0.72; }
.btn .play { width: 0; height: 0; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent currentColor; }

/* ---------- header: the game's top-nav plate, a soot bar whose drips hang over the page ---------- */
.site-head {
  position: relative;
  z-index: 6;
  flex: none;
  height: 88px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.site-head::before {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  aspect-ratio: 4852 / 525;
  /* The plate's solid bar is 7.34vw tall: pull it up so its shallowest tear sits on the 88px line at any width. */
  top: min(0px, calc(88px - 7.34vw));
  background: url('/assets/design/topnav.webp') top center / 100% auto no-repeat;
  z-index: -1;
  pointer-events: none;
}
.site-head .brand { display: block; padding: 4px 0; border-radius: 2px; }
.site-head .wordmark {
  display: block;
  width: 134px;
  aspect-ratio: 678 / 364;
  background: #d8ccb3;
  -webkit-mask: url('/assets/brand/wordmark.webp') center / contain no-repeat;
  mask: url('/assets/brand/wordmark.webp') center / contain no-repeat;
}
.site-head .brand:hover .wordmark { background: var(--chalk-fixed); }
/* Below 1200px the plate keeps its native aspect at 1200px wide (its bar is then exactly 88px), cropped at the sides. */
@media (max-width: 1199px) {
  .site-head { overflow-x: clip; }
  .site-head::before { width: 1200px; left: 50%; margin-left: -600px; top: 0; }
}

/* ---------- the hero: the Red Crown on parchment ---------- */
main { position: relative; flex: 1 0 auto; overflow-x: clip; }
.hero { display: grid; align-items: center; }
.hero-inner {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  /* Clear the header plate's drips, which hang 3.48vw below the bar. */
  padding: max(52px, calc(3.48vw + 20px)) var(--gutter) 84px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
}
.copy { display: grid; gap: 14px; max-width: 660px; justify-self: end; width: 100%; }
.copy h1 {
  font-size: clamp(42px, 4.4vw, 68px);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--rust);
  filter: url(#ink-wobble-soft);
  margin-top: -2px;
}
.copy .lead {
  font-style: italic;
  font-size: clamp(20px, 1.6vw, 25px);
  line-height: 1.3;
  max-width: 40ch;
}
.copy .orn { margin: 2px 0; height: 20px; }
.prose p + p { margin-top: 0.6em; }
.copy .prose p { max-width: 54ch; font-size: 18px; line-height: 1.5; }
.copy .prose .how { color: var(--ink-2); font-size: 17px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-top: 8px; }
.ks-note { font-style: italic; font-size: 17px; color: var(--ink-2); }
.art { margin: 0; align-self: center; }
.art img {
  width: 112%;
  max-width: none;
  height: auto;
  margin-left: -2%;
  mix-blend-mode: multiply;
  /* The drawing ends in a straight cut; let its last strokes thin into the paper. */
  -webkit-mask-image: linear-gradient(#000 84%, transparent 100%);
  mask-image: linear-gradient(#000 84%, transparent 100%);
}

/* ---------- the burnt edge between the parchment and the soot ---------- */
.seam-burnt { position: relative; height: 0; z-index: 5; pointer-events: none; flex: none; }
.seam-burnt::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  /* The game's edge-burnt plate, flipped: the char lands on the seam and the scorch rises into the paper. */
  height: 300px;
  top: -210px;
  background: url('/assets/design/edge-burnt.webp') center / 100% 100% no-repeat;
  transform: scaleY(-1);
}

/* ---------- the soot ground: dates, newsletter, footer ---------- */
.soot-end { position: relative; flex: none; }
.ledger-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 58px var(--gutter) 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.55fr);
}
.cell { padding: 0 32px; border-left: 1px solid rgba(199, 184, 147, 0.22); position: relative; }
.cell:first-child { padding-left: 0; border-left: 0; }
.cell:last-child { padding-right: 0; }
.cell .eyebrow { color: var(--tan); font-size: 13px; display: block; }
.cell .when { font-size: 27px; font-weight: 600; line-height: 1.15; color: var(--chalk); margin: 4px 0 8px; }
.cell p { font-size: 17px; line-height: 1.45; color: #d9ccb4; }
.newsletter .row { display: flex; gap: 12px; align-items: stretch; }
.field {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 46px;
  padding: 10px 14px;
  font: inherit;
  font-size: 18px;
  color: var(--chalk);
  background: rgba(233, 223, 202, 0.05);
  border: 1px solid rgba(199, 184, 147, 0.73);
  border-radius: 0;
}
.field::placeholder { color: rgba(205, 185, 156, 0.6); font-style: italic; }
.field:focus-visible { outline: 2px solid var(--tan); outline-offset: 2px; }
.newsletter .consent { margin-top: 10px; font-size: 15px; line-height: 1.45; color: #bdb09b; }
.newsletter .consent a { color: var(--tan); }
.newsletter .status:empty { display: none; }
.newsletter .status { margin-top: 10px; font-size: 18px; line-height: 1.45; color: var(--chalk); }
.newsletter .status.error { color: #e8a58f; font-size: 16px; }
.newsletter.done .row, .newsletter.done .consent { display: none; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.site-foot {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px var(--gutter) 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--ash);
  position: relative;
}
.site-foot::before {
  content: '';
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  top: 0;
  border-top: 1px solid var(--hair);
}
/* On pages without the dates band the footer sits right under the burnt edge: clear the char that hangs into the soot. */
.soot-end > .site-foot:first-child { padding-top: 84px; }
.soot-end > .site-foot:first-child::before { display: none; }
.colophon { font-size: inherit; }
.socials { display: flex; gap: 18px; align-items: center; }
.socials a { color: var(--tan); padding: 4px; margin: -4px; }
.socials a:hover { color: var(--chalk); }
.socials svg { fill: currentColor; }
.foot-links { display: flex; align-items: center; gap: 12px; }
.foot-links a { color: var(--tan); }
.foot-links a:hover { color: var(--chalk); }
.foot-links .sep { font-size: 9px; color: var(--hair); }

/* ---------- sheet pages: privacy, not found and the newsletter pages ---------- */
.sheet-inner { max-width: 780px; margin: 0 auto; padding: 72px 24px 150px; }
.sheet-head { text-align: center; display: grid; justify-items: center; gap: 10px; margin-bottom: 30px; }
.sheet-head .orn { margin-bottom: 6px; }
.sheet-head h1 { font-size: clamp(34px, 4.2vw, 50px); line-height: 1.08; color: var(--ink); filter: url(#ink-wobble-soft); }
.sheet-head .updated { font-style: italic; font-size: 16px; color: var(--ink-2); }
.sheet .prose { font-size: 19px; line-height: 1.55; }
.sheet .prose h2 { font-size: 27px; line-height: 1.15; margin: 1.5em 0 0.4em; }
.sheet .prose section:first-child h2 { margin-top: 0.4em; }
.sheet .prose p { max-width: 64ch; }
.sheet .prose a:not(.btn) { color: var(--ink); }
.sheet .prose strong { font-weight: 600; }
.message .prose { text-align: center; }
.message .prose p { margin-left: auto; margin-right: auto; max-width: 52ch; }
.message .actions, .sheet .prose .actions { justify-content: center; margin-top: 28px; }
.inline-form { display: inline; margin: 0; }

/* ---------- the film ---------- */
dialog.film {
  width: min(1180px, 94vw);
  max-width: none;
  max-height: 94vh;
  padding: 0;
  border: 1px solid var(--hair);
  background: #0a0807;
  color: var(--chalk);
  overflow: visible;
}
dialog.film::backdrop { background: rgba(10, 8, 7, 0.9); }
dialog.film video { width: 100%; height: auto; aspect-ratio: 16 / 9; max-height: calc(94vh - 2px); background: #0a0807; }
.film-close {
  position: absolute;
  top: -46px;
  right: -2px;
  width: 40px;
  height: 40px;
  font: 32px/1 var(--font-display);
  color: var(--chalk);
  background: transparent;
  border: 1px solid var(--hair);
  cursor: pointer;
}
.film-close:hover { background: var(--soot-2); }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) {
  :root { --gutter: 28px; }
  .cell { padding: 0 22px; }
}
@media (max-width: 899px) {
  :root { --gutter: 20px; }
  .hero-inner { grid-template-columns: minmax(0, 1fr); padding: 34px var(--gutter) 96px; gap: 6px; }
  .art { order: -1; }
  /* Phones arrive from social posts: the Kickstarter button comes straight after the title, the story below it. */
  .copy .actions { order: 1; margin: 6px 0 4px; }
  .copy .ks-note { order: 2; }
  .copy .orn { order: 3; }
  .copy .prose { order: 4; }
  .art img { width: 128%; margin-left: -14%; }
  .copy { justify-self: start; max-width: 640px; }
  .ledger-inner { grid-template-columns: minmax(0, 1fr); padding-top: 64px; }
  .cell, .cell:first-child, .cell:last-child { padding: 22px 0; border-left: 0; border-top: 1px solid rgba(199, 184, 147, 0.22); }
  .cell:first-child { border-top: 0; padding-top: 0; }
  .site-foot { flex-direction: column; justify-content: center; text-align: center; gap: 16px; padding-top: 20px; }
  .seam-burnt::before { height: 260px; top: -182px; background-size: auto 100%; }
  .sheet-inner { padding: 48px var(--gutter) 130px; }
  .film-close { top: -44px; right: 0; }
}
@media (max-width: 560px) {
  .site-head .wordmark { width: 122px; }
  .copy h1 { font-size: 42px; }
  .copy .lead { font-size: 21px; }
  .copy .prose p { font-size: 18px; }
  .actions { flex-direction: column; align-items: stretch; max-width: 360px; }
  .btn { padding-inline: 16px; letter-spacing: 0.11em; font-size: 16px; }
  .newsletter .row { flex-direction: column; }
  .newsletter .row .btn { align-self: flex-start; padding-inline: 26px; }
  .cell .when { font-size: 25px; }
  .foot-links { flex-direction: column; gap: 8px; }
  .foot-links .sep { display: none; }
  .sheet .prose { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
