/* CityCipher base: design tokens, fonts, reset, buttons and forms.
   Identity: a surveyor's field kit. Cool map-paper ground, ink navy, brass cipher boxes,
   one map-pin red for the moment a letter is found. See docs/DESIGN.md. */

@font-face { font-family: "Crimson Text"; src: url(/fonts/CrimsonText-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Crimson Text"; src: url(/fonts/CrimsonText-Italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Crimson Text"; src: url(/fonts/CrimsonText-SemiBold.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Crimson Text"; src: url(/fonts/CrimsonText-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url(/fonts/FiraSans-Light.woff2) format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url(/fonts/FiraSans-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url(/fonts/FiraSans-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url(/fonts/FiraSans-SemiBold.woff2) format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --ink: #1b2540;
  --ink-2: #33405f;
  --paper: #eef0e7;
  --sheet: #ffffff;
  --brass: #b8902f;
  --brass-soft: #efe4c4;
  --pin: #c2412d;
  --survey: #2f6b4f;
  --muted: #5c6372;
  --line: #d3d6cc;
  --focus: #2f6bd8;

  --serif: "Crimson Text", Georgia, "Times New Roman", serif;
  --sans: "Fira Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.1rem;
  --step-4: clamp(2.4rem, 6vw, 3.6rem);

  --radius: 6px;
  --gap: 1rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; }
a { color: var(--ink); text-decoration-color: var(--brass); text-underline-offset: 0.18em; text-decoration-thickness: 2px; }
a:hover { color: var(--pin); }
img { max-width: 100%; height: auto; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.small { font-size: var(--step--1); color: var(--muted); }
.center { text-align: center; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 0.4rem 0; border-bottom: 1px solid var(--line); }

/* Buttons */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 44px; padding: 0.6rem 1.2rem;
  font: 500 var(--step-0) var(--sans);
  color: #fff; background: var(--ink);
  border: 2px solid var(--ink); border-radius: var(--radius);
  text-decoration: none; cursor: pointer;
}
button:hover, .button:hover { background: var(--ink-2); color: #fff; }
button.secondary, .button.secondary { background: transparent; color: var(--ink); }
button.secondary:hover, .button.secondary:hover { background: var(--sheet); color: var(--ink); }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--ink); text-decoration: underline; text-decoration-color: var(--brass); font-weight: 400; }
button.link.danger { color: var(--pin); }
button[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Forms */
.stack > * + * { margin-top: 0.9rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field-label { font-weight: 500; }
.field-hint { display: block; font-size: var(--step--1); color: var(--muted); }
input, select, textarea {
  font: inherit; color: inherit; width: 100%;
  min-height: 44px; padding: 0.55rem 0.7rem;
  background: var(--sheet); border: 1px solid #b9bdb2; border-radius: var(--radius);
}
textarea { min-height: 5rem; resize: vertical; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; }
.check input { width: 1.25rem; min-height: 1.25rem; margin-top: 0.2rem; }
.alert { padding: 0.7rem 0.9rem; border-left: 4px solid var(--pin); background: #fbecea; }
.flash { padding: 0.7rem 0.9rem; border-left: 4px solid var(--survey); background: #e6f0ea; }

/* Wordmark: two words, one stamped in a brass box */
.wordmark { display: inline-flex; align-items: center; gap: 0.15rem; text-decoration: none; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; color: var(--ink); }
.wordmark-cipher { padding: 0 0.3rem; border: 2px solid var(--brass); border-radius: 3px; line-height: 1.2; }

/* The cipher strip (signature element) */
.cipher-strip { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(2.2rem, 1fr)); gap: 0.35rem; padding: 0; margin: 0 0 1rem; max-width: 34rem; }
.cipher-strip li { position: relative; aspect-ratio: 1; display: grid; place-items: center; background: var(--sheet); border: 2px solid var(--brass); border-radius: 4px; }
.cipher-strip .box-n { position: absolute; top: 2px; left: 4px; font-size: 0.65rem; color: var(--muted); }
.cipher-strip .box-l { font-family: var(--serif); font-weight: 700; font-size: clamp(1.2rem, 4.5vw, 1.8rem); }
.cipher-strip li.filled { background: var(--ink); border-color: var(--ink); color: var(--brass-soft); }
.cipher-strip li.filled .box-n { color: #9aa3b8; }
.cipher-strip li.just { background: var(--pin); border-color: var(--pin); color: #fff; animation: stamp 520ms cubic-bezier(.2,1.4,.4,1) both; }

@keyframes stamp { from { transform: scale(1.6) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
.reveal-strip li.late { animation: fill 380ms ease-out both; animation-delay: calc(700ms + var(--i) * 260ms); }
@keyframes fill { from { background: var(--sheet); color: transparent; border-color: var(--brass); } to { background: var(--ink); color: var(--brass-soft); border-color: var(--ink); } }

@media (prefers-reduced-motion: reduce) {
  .cipher-strip li.just, .reveal-strip li.late { animation: none; }
}

/* Site version in the bottom-left corner (see src/version.ts) */
.app-version {
  position: fixed; left: 0.5rem; bottom: 0.35rem; z-index: 10;
  margin: 0; padding: 0.05rem 0.35rem; border-radius: 3px;
  font-size: 0.7rem; color: var(--muted); background: rgb(238 240 231 / 0.85);
  pointer-events: none;
}
@media print { .app-version { display: none; } }
