/* poplid.app: the game's look on the web (poplid-style skill; guide §3 and §6).
   Three things, every time: flat shapes, the dot print, taped paper cards. Navy is the only dark colour.
   Light colours from the kit; dark from guide §6 (design/reference/dark-mode.png). */

@font-face { font-family: 'Courier Prime'; src: url('/fonts/CourierPrime-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Charter; src: url('/fonts/Charter-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Charter; src: url('/fonts/Charter-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: Charter; src: url('/fonts/Charter-Italic.ttf') format('truetype'); font-style: italic; font-display: swap; }

:root {
  --navy: #2f3a5f;         /* the ink: text on cards, borders, shadows */
  --page: #f3ebdd;         /* the background */
  --card: #fbf6ec;         /* paper cards */
  --edge: #2f3a5f;         /* card borders and hard shadows */
  --must: #e2b345;         /* tape, the big button */
  --wood: #c99a34;         /* the shelf board */
  --frame: #84512f;        /* the cupboard's frame */
  --wall: #f1e5cd;         /* the cupboard's back wall */
  --diamond: #b9c9a8;      /* the wallpaper's diamond */
  --dot: #e3b9a6;          /* the wallpaper's dot */
  --grain: url('/art/grain-light.svg');
  --wallpaper: url('/art/wall-light.svg');
  --ink-page: #2f3a5f;     /* words straight on the page */
  --ink-soft: #55607f;     /* small print on the page */
  --red: #e8432c;
  --red-dark: #bf3320;
  --mono: 'Courier Prime', 'Courier New', monospace;
  --serif: Charter, 'Bitstream Charter', Georgia, serif;
  color-scheme: light;
}

/* Dark (guide §6): only the page, the wall, the cards and the wood change; jars, characters and lids never do. */
:root[data-theme='dark'] {
  --page: #1b2138; --card: #e6dcc6; --edge: #0c1022; --wall: #242c4a; --diamond: #3f5068; --dot: #5a4257;
  --frame: #5a3a24; --wood: #9c782c; --grain: url('/art/grain-dark.svg'); --wallpaper: url('/art/wall-dark.svg'); --ink-page: #cfc7b2; --ink-soft: #a9a38f;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --page: #1b2138; --card: #e6dcc6; --edge: #0c1022; --wall: #242c4a; --diamond: #3f5068; --dot: #5a4257;
    --frame: #5a3a24; --wood: #9c782c; --grain: url('/art/grain-dark.svg'); --wallpaper: url('/art/wall-dark.svg'); --ink-page: #cfc7b2; --ink-soft: #a9a38f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--page);
  /* The dot print: two dots in every 5-point cell, radius 0.55 (the kit's grain). */
  background-image: var(--grain);
  color: var(--ink-page);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
}
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
:focus-visible { outline: 3px solid var(--must); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ---- Taped paper cards ---- */
.card {
  position: relative;
  background: var(--card);
  color: var(--navy);
  border: 1.5px solid var(--edge);
  box-shadow: 4px 4px 0 var(--edge);
}
.card.tilt-l { transform: rotate(-2deg); }
.card.tilt-r { transform: rotate(1.5deg); }
.tape::before {
  content: '';
  position: absolute;
  left: 50%; top: -6px;
  width: 30px; height: 11px;
  margin-left: -15px;
  background: var(--must);
  opacity: .85;
  transform: rotate(-5deg);
}
.mono { font-family: var(--mono); }

/* ---- Header ---- */
.top { display: flex; align-items: center; justify-content: space-between; min-height: 70px; padding-top: 18px; padding-bottom: 8px; }
.top .logo { width: 132px; }
.theme {
  margin-left: auto;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  padding: 0; cursor: pointer;
  transform: rotate(3deg);
}
.theme:active { transform: rotate(3deg) translate(2px, 2px); box-shadow: 2px 2px 0 var(--edge); }
.theme svg { width: 24px; height: 24px; }
.theme .moon { display: none; }
:root[data-theme='dark'] .theme .sun { display: none; }
:root[data-theme='dark'] .theme .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme .sun { display: none; }
  :root:not([data-theme='light']) .theme .moon { display: block; }
}

/* ---- The logo: the name card with the red lid popping off (as on the app's Home) ---- */
.logo { display: block; color: var(--navy); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.logo svg { display: block; width: 100%; height: auto; overflow: visible; }
.logo .face { fill: var(--card); stroke: var(--edge); }
.logo .shadow { fill: var(--edge); }
.logo .word { fill: var(--navy); font-family: var(--mono); font-weight: 700; }
.logo .lines { stroke: var(--ink-page); }
.logo .lid { transform-box: fill-box; transform-origin: center; }
.logo.pop .lid { animation: lid-pop .9s cubic-bezier(.3, .7, .4, 1) both; }
.logo.pop .lines path { animation: lines-flash .9s ease-out both; }
.logo.pop .lines path:nth-child(2) { animation-delay: .04s; }
.logo.pop .lines path:nth-child(3) { animation-delay: .08s; }
/* From the Home's resting pose: up off the card with a little turn, back down, one small bounce. */
@keyframes lid-pop {
  0%   { transform: none; }
  38%  { transform: translate(4px, -24px) rotate(14deg); }
  66%  { transform: translate(0, 3px) rotate(-3deg); }
  82%  { transform: translate(0, -4px) rotate(2deg); }
  100% { transform: none; }
}
@keyframes lines-flash {
  0%, 30% { opacity: 0; }
  42% { opacity: 1; }
  62% { opacity: 0; }
  78%, 100% { opacity: 1; }
}

/* ---- Landing ---- */
.hero { text-align: center; padding-top: 28px; }
.hero .logo { width: min(300px, 82vw); margin: 18px auto 0; }
.hero .line { font-family: var(--mono); font-size: 19px; margin: 26px 0 0; color: var(--ink-page); }
.soon {
  display: inline-block;
  margin-top: 26px;
  padding: 12px 22px;
  font-family: var(--mono);
  font-size: 17px;
  letter-spacing: .5px;
}

/* The sign-up: a taped card with the email box and the one big mustard button. */
.join { max-width: 420px; margin: 34px auto 0; padding: 22px 18px 20px; text-align: left; }
.join h2 { font-family: var(--mono); font-weight: 400; font-size: 17px; margin: 0 0 12px; text-align: center; }
.join label { display: block; font-family: var(--mono); font-size: 14px; margin-bottom: 6px; }
.join input[type='email'] {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font: 17px var(--mono);
  color: var(--navy);
  background: #fffdf7;
  border: 1.5px solid var(--navy);
  border-radius: 0;
  appearance: none;
}
.join .trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.btn {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 14px;
  font: 700 20px var(--mono);
  letter-spacing: 1px;
  color: var(--navy);
  background: var(--must);
  border: 2.5px solid var(--navy);
  border-radius: 8px;
  box-shadow: 5px 5px 0 var(--edge);
  cursor: pointer;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--edge); }
.btn[disabled] { opacity: .7; cursor: default; }
.join .note { font-size: 14px; margin: 12px 0 0; text-align: center; min-height: 1.5em; }
.join .note.bad { color: #b3321f; }

/* A round: the game's own picture, in a navy phone frame, taped and tilted. */
.round { margin: 64px auto 0; width: min(270px, 74vw); transform: rotate(-2deg); position: relative; }
.round .phone {
  border: 3px solid var(--edge);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: 6px 6px 0 var(--edge);
  background: var(--page);
  line-height: 0;
}
.round img { width: 100%; height: auto; }
.round::before { top: -4px; width: 40px; margin-left: -20px; z-index: 1; }

/* The five starters on a pantry shelf (the cupboard's wallpaper behind). */
.cast { margin-top: 64px; text-align: center; }
.label { display: inline-block; padding: 7px 16px; font-family: var(--mono); font-size: 15px; }
.cupboard {
  margin: 26px auto 0;
  max-width: 640px;
  padding: 18px 8px 0;
  border: 8px solid var(--frame);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background-color: var(--wall);
  /* The wallpaper (kit WALLPAPER): a small diamond and a dot on a 28-point square, with the grain over it. */
  background-image: var(--grain), var(--wallpaper);
}
.jars { display: flex; flex-direction: column; align-items: stretch; }
.jar-row { display: flex; justify-content: center; gap: 4px; padding: 0 4px; }
.jars figure { margin: 0; flex: 0 0 calc((100% - 16px) / 3); min-width: 0; }
.jars img { width: 100%; height: auto; display: block; }
.jars figcaption { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; color: var(--navy); margin: 4px 0 12px; line-height: 1.2; }
/* The board between the two rows on a phone, across the cupboard from side to side. */
.shelf.mid { max-width: none; margin: 0 -8px 18px; }
:root[data-theme='dark'] .jars figcaption { color: var(--ink-page); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .jars figcaption { color: var(--ink-page); } }
.shelf { max-width: 664px; margin: 0 auto; height: 15px; background: var(--wood); border-radius: 3px; position: relative; }
.shelf::after {
  content: ''; position: absolute; left: 0; right: 0; top: 15px; height: 7px;
  background-image: url('/art/dk.svg');
}

/* ---- Pages with words (privacy, terms, support) ---- */
.doc { max-width: 680px; margin: 30px auto 0; padding: 30px 22px 26px; }
.doc h1 { font-family: var(--mono); font-weight: 400; font-size: 28px; line-height: 1.2; margin: 0 0 4px; }
.doc .date { font-family: var(--mono); font-size: 14px; margin: 0 0 22px; }
.doc h2 { font-family: var(--mono); font-weight: 400; font-size: 19px; margin: 28px 0 6px; }
.doc p, .doc li { margin: 0 0 12px; }
.doc ul { padding-left: 20px; margin: 0 0 12px; }
.doc li::marker { color: var(--red); }
.doc .draft { font-family: var(--mono); font-size: 13px; background: var(--must); display: inline-block; padding: 2px 8px; margin-bottom: 14px; }

/* ---- Footer ---- */
.foot { margin-top: 80px; padding-bottom: 40px; text-align: center; font-family: var(--mono); font-size: 14px; color: var(--ink-soft); }
.foot nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 10px; }
.foot nav a { color: var(--ink-page); display: inline-block; padding: 10px 2px; }
.foot p { margin: 0; }

@media (min-width: 760px) {
  body { font-size: 18px; }
  .top { padding-top: 26px; }
  .top .logo { width: 150px; }
  .hero { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 36px; text-align: left; padding-top: 40px; }
  .hero .logo { margin: 18px 0 0 -6px; width: 340px; }
  .hero .join { margin-left: 0; }
  .round { margin: 0 auto; width: 290px; }
  .cast { margin-top: 90px; }
  .jars { flex-direction: row; justify-content: center; gap: 14px; }
  .jar-row { display: contents; }
  .jars figure { flex: 1 1 0; max-width: 112px; }
  .shelf.mid { display: none; }
  .jars figcaption { font-size: 14px; margin-bottom: 8px; }
}
.doc.center { text-align: center; }

/* Pictures with a light and a dark version (the jars: pale glass with cream under it in dark). */
.for-dark { display: none !important; }
:root[data-theme='dark'] .for-light { display: none !important; }
:root[data-theme='dark'] .for-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .for-light { display: none !important; }
  :root:not([data-theme='light']) .for-dark { display: block !important; }
}

.join .fine { font-size: 13px; color: var(--ink-soft); margin-left: 4px; white-space: nowrap; }
.join .note .fine { color: #55607f; }
