/* The teaser: an ink drawing of the Bock under the game's fog, and one field.
   Type is the game's Chiaroscuro pair (Cormorant Garamond + Archivo), self-hosted; one wax-red accent on paper and ink. */

@font-face { font-family: "KG Serif"; src: url("assets/fonts/CormorantGaramond-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "KG Serif"; src: url("assets/fonts/CormorantGaramond-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "KG Caps"; src: url("assets/fonts/Archivo-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --fog: #E8E5DF;        /* the fog's lit paper (site.js S.paper) and the veil */
  --ground: #CDCAC5;     /* the drawing's own paper */
  --ink: #1C1A17;
  --ink-2: rgba(28, 26, 23, 0.74);
  --ink-3: rgba(28, 26, 23, 0.52);
  --rule: rgba(28, 26, 23, 0.34);
  --seal: #A8321F;
  --serif: "KG Serif", "Cormorant Garamond", Garamond, Georgia, serif;
  --caps: "KG Caps", Archivo, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --gutter: clamp(1.5rem, 6.5vw, 7.5rem);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100svh; background: var(--ground); color: var(--ink); font-family: var(--serif);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; }
::selection { background: rgba(168, 50, 31, 0.22); }

.caps { font: 400 0.6875rem/1 var(--caps); letter-spacing: 0.28em; text-transform: uppercase; }

/* ---- The drawing ------------------------------------------------------------------------------------------------ */

.stage { position: fixed; inset: 0; z-index: 0; }
.plate { position: absolute; inset: 0; transform-origin: var(--fx, 50%) var(--fy, 50%);
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0) scale(var(--zoom, 1)); will-change: transform; }
.drawing { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
/* site.js sizes the stage round the castle, a little larger than the screen so leaning never shows an edge. */
.js .stage { inset: auto; }
.js .drawing { object-fit: fill; }

/* ---- The field -------------------------------------------------------------------------------------------------- */

.sheet { position: relative; min-height: 100svh; display: flex; align-items: flex-end; overflow: hidden;
  padding: var(--gutter) var(--gutter) max(clamp(2.5rem, 11vh, 7rem), env(safe-area-inset-bottom)); }

.copy { position: relative; z-index: 1; width: min(27rem, 100%); }
/* A breath of paper behind the field, so the drawing's hatching does not run through it. */
.copy::before { content: ""; position: absolute; z-index: -1; inset: -70% -32% -70% -40%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(205, 202, 197, 0.88), rgba(205, 202, 197, 0.55) 55%, rgba(205, 202, 197, 0)); }

.enlist label { display: flex; align-items: center; gap: 0.85em; margin: 0 0 0.7rem; color: var(--ink-3); }

.field { position: relative; display: flex; align-items: center; border-bottom: 1px solid var(--rule); }
.field::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--ink);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.7s var(--ease); }
.field:focus-within::after { transform: scaleX(1); }
.invalid .field::after { background: var(--seal); transform: scaleX(1); }

.field input { flex: 1; min-width: 0; margin: 0; padding: 0.4rem 0 0.5rem; border: 0; border-radius: 0; outline: none; background: transparent;
  font: 400 1.4rem/1.2 var(--serif); color: var(--ink); caret-color: var(--seal); }
.field input::placeholder { color: var(--ink-3); font-style: italic; opacity: 1; }
.field input:-webkit-autofill { -webkit-text-fill-color: var(--ink); transition: background-color 9999s; }

.field button { flex: none; display: inline-flex; align-items: center; gap: 0.9rem; margin: 0; padding: 0.75rem 0 0.75rem 1rem;
  border: 0; background: none; color: var(--ink); cursor: pointer; transition: color 0.25s; }
.field button .label { display: block; padding-top: 1px; }  /* caps sit a hair high in their box */
.arrow { display: block; flex: none; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1;
  stroke-linecap: square; stroke-linejoin: miter; transition: transform 0.4s var(--ease); }
.field button:hover, .field button:focus-visible { color: var(--seal); outline: none; }
.field button:hover .arrow, .field button:focus-visible .arrow { transform: translateX(5px); }
.busy .field button { cursor: progress; color: var(--ink-3); }
.busy .arrow { animation: ride 0.9s var(--ease) infinite; }
@keyframes ride { 0% { transform: translateX(0); opacity: 1; } 70% { transform: translateX(8px); opacity: 0; } 100% { transform: translateX(0); opacity: 0; } }

/* Only ever an error; empty otherwise, and it takes no room. */
.say { position: absolute; left: 0; right: 0; top: 100%; margin: 0.65rem 0 0; font: italic 400 1.02rem/1.35 var(--serif); color: var(--seal); }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; }

/* ---- Enlisted: on the closed fog, in the middle of the page ------------------------------------------------------ */

.enlisted { position: fixed; inset: 0; z-index: 12; display: grid; place-content: center; justify-items: center;
  padding: 2rem 1.5rem; text-align: center; pointer-events: none; opacity: 0; transition: opacity 1.4s ease;
  /* a breath of paper under the words, should a shaded billow drift behind them */
  background: radial-gradient(ellipse min(38rem, 70vw) min(16rem, 34vh) at 50% 50%, rgba(232, 229, 223, 0.7), rgba(232, 229, 223, 0)); }
.enlisted[hidden] { display: none; }
.enlisted.on { opacity: 1; }
.enlisted .caps { display: flex; align-items: center; gap: 0.85em; margin: 0 0 1.4rem; color: var(--ink-2); }
.enlisted .who { margin: 0; max-width: 16em; font: italic 400 clamp(1.9rem, 4.6vw, 3.6rem)/1.1 var(--serif); color: var(--ink);
  overflow-wrap: anywhere; }
.enlisted .rule { display: block; width: min(22rem, 70vw); height: 1px; margin: 1.4rem 0 1.1rem; background: var(--rule); }
.enlisted .note { margin: 0; font: italic 400 1.15rem/1.4 var(--serif); color: var(--ink-2); }
.js .enlisted .who, .js .enlisted .rule, .js .enlisted .note { transform: translateY(8px); transition: transform 1.8s var(--ease); }
.js .enlisted.on .who, .js .enlisted.on .rule, .js .enlisted.on .note { transform: none; }

.seal-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--seal); animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(168, 50, 31, 0.38); } 50% { box-shadow: 0 0 0 6px rgba(168, 50, 31, 0); } }

/* ---- The fog and its entrance ----------------------------------------------------------------------------------- */

.fog { position: fixed; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }
.veil { display: none; }
.js .veil { display: block; position: fixed; inset: 0; z-index: 10; background: var(--fog); transition: opacity 0.9s ease; }
.js .veil.gone { opacity: 0; pointer-events: none; }

/* The field rises a hair as the fog leaves it. */
.js .copy > * { transform: translateY(10px); transition: transform 2.2s var(--ease); }
.js.revealing .copy > * { transform: none; }
/* Without the fog (no WebGL), the field fades in under the lifting veil. */
.js.no-fog .copy { opacity: 0; transition: opacity 1.4s ease 0.3s; }
.js.no-fog.revealing .copy { opacity: 1; }

/* ---- Portrait: the drawing above, the field below (site.js PORTRAIT is the same query) -------------------------- */

@media (max-aspect-ratio: 23/20) {
  .stage { -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 100%); mask-image: linear-gradient(180deg, #000 72%, transparent 100%); }
  .sheet { padding: 0 1.5rem max(2.25rem, env(safe-area-inset-bottom)); }
  .copy { width: 100%; }
  .copy::before { inset: -45% -12% -40% -12%; }
  .field input { font-size: 1.3rem; }
}

@media (max-height: 560px) and (min-aspect-ratio: 23/20) {
  .sheet { padding-bottom: 1.5rem; }
}

@media (max-width: 360px) {
  .field button .label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .seal-dot, .busy .arrow { animation: none; }
  .js .copy > *, .js.revealing .copy > * { transform: none; transition: none; }
}
