/* ============================================================
   LONDON HUNT — shell.css
   Victorian detective-study shell, shared by every page.
   Per-puzzle micro-aesthetics live in puzzle-N.css.
   ============================================================ */

/* ------------------------------------------------------------------
   FONTS — Playfair Display (display) + DM Sans (UI)
   Self-hosted woff2, latin + latin-ext subsets (covers ä ö ü ß).
   latin-ext listed first so the browser prefers it for German text.
   ------------------------------------------------------------------ */

/* Playfair Display 400 */
@font-face {
  font-family: 'Display';
  src: url('../fonts/playfair-400-latinext.woff2') format('woff2'),
       url('../fonts/playfair-400-latin.woff2')    format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0100-024F, U+1E00-1EFF;
}
/* Playfair Display 700 */
@font-face {
  font-family: 'Display';
  src: url('../fonts/playfair-700-latinext.woff2') format('woff2'),
       url('../fonts/playfair-700-latin.woff2')    format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0100-024F, U+1E00-1EFF;
}
/* Playfair Display 900 */
@font-face {
  font-family: 'Display';
  src: url('../fonts/playfair-900-latinext.woff2') format('woff2'),
       url('../fonts/playfair-900-latin.woff2')    format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0100-024F, U+1E00-1EFF;
}

/* DM Sans 300 */
@font-face {
  font-family: 'UI';
  src: url('../fonts/dmsans-300-latinext.woff2') format('woff2'),
       url('../fonts/dmsans-300-latin.woff2')    format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0100-024F, U+1E00-1EFF;
}
/* DM Sans 400 */
@font-face {
  font-family: 'UI';
  src: url('../fonts/dmsans-400-latinext.woff2') format('woff2'),
       url('../fonts/dmsans-400-latin.woff2')    format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0100-024F, U+1E00-1EFF;
}
/* DM Sans 600 */
@font-face {
  font-family: 'UI';
  src: url('../fonts/dmsans-600-latinext.woff2') format('woff2'),
       url('../fonts/dmsans-600-latin.woff2')    format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0100-024F, U+1E00-1EFF;
}

/* ------------------------------------------------------------------
   DESIGN TOKENS
   ------------------------------------------------------------------ */
:root {
  /* Palette — sepia / brass / gaslight */
  --col-bg:          #1a1108;   /* near-black walnut */
  --col-bg-mid:      #2b1d0e;   /* dark oak */
  --col-panel:       #f5ead6;   /* aged cream parchment */
  --col-panel-dark:  #e8d4b0;   /* deeper parchment, borders */
  --col-ink:         #2c1a0a;   /* fountain-pen dark brown */
  --col-ink-faded:   #7a5c3a;   /* faded note / secondary text */
  --col-brass:       #b8860b;   /* dark goldenrod / brass */
  --col-brass-light: #d4a82a;   /* polished brass highlight */
  --col-gaslight:    #e8a020;   /* candle orange accent */
  --col-error:       #8b1a1a;   /* dark red for wrong answers */
  --col-success:     #2a5a2a;   /* deep green for correct */

  /* Typography */
  --font-display: 'Display', 'Georgia', 'Times New Roman', serif;
  --font-ui:      'UI', system-ui, -apple-system, sans-serif;

  /* Spacing scale (base 4px) */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Radii */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg: 16px;

  /* Transitions */
  --t-fast:   150ms ease;
  --t-normal: 300ms ease;
  --t-slow:   600ms ease;

  /* Safe area */
  --safe-top:    env(safe-area-inset-top,    0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left,   0px);
  --safe-right:  env(safe-area-inset-right,  0px);
}

/* ------------------------------------------------------------------
   RESET & BASE
   ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  background-color: var(--col-bg);
  background-image:
    radial-gradient(ellipse at 50% 0%, #3a2510 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-attachment: fixed;
  color: var(--col-ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

img { display: block; max-width: 100%; }
button, input, select { font-family: inherit; font-size: inherit; }
a { color: var(--col-brass-light); }

/* ------------------------------------------------------------------
   LAYOUT SHELL
   ------------------------------------------------------------------ */
.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-6) var(--sp-4);
  gap: var(--sp-6);
}

.page--centered {
  justify-content: center;
}

/* ------------------------------------------------------------------
   PANELS — aged parchment cards
   ------------------------------------------------------------------ */
.panel {
  background: var(--col-panel);
  border: 2px solid var(--col-panel-dark);
  border-radius: var(--radius-md);
  padding: var(--sp-6);
  width: 100%;
  max-width: 480px;
  position: relative;
  box-shadow:
    0 0 0 1px var(--col-brass),
    0 4px 24px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.15);
}

.panel--narrow { max-width: 360px; }
.panel--wide   { max-width: 560px; }

/* Brass corner ornaments */
.panel::before,
.panel::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--col-brass);
  border-radius: 2px;
}
.panel::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.panel::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* ------------------------------------------------------------------
   TYPOGRAPHY
   ------------------------------------------------------------------ */
.title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 700;
  color: var(--col-ink);
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.subtitle {
  font-family: var(--font-display);
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 400;
  color: var(--col-ink-faded);
  font-style: italic;
}

.flavor {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--col-ink);
}

.flavor em { font-style: italic; }

.label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--col-ink-faded);
}

/* ------------------------------------------------------------------
   ORNAMENT DIVIDER
   ------------------------------------------------------------------ */
.ornament {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--col-brass);
  font-size: 1.1rem;
  user-select: none;
}
.ornament::before,
.ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--col-brass), transparent);
}

/* ------------------------------------------------------------------
   FORM CONTROLS
   ------------------------------------------------------------------ */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.field__label {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--col-ink-faded);
}

.field__input {
  background: rgba(255,255,255,0.6);
  border: 2px solid var(--col-panel-dark);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.15em;
  color: var(--col-ink);
  text-transform: uppercase;
  min-height: 48px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  -webkit-appearance: none;
  appearance: none;
}

.field__input:focus {
  outline: none;
  border-color: var(--col-brass);
  box-shadow: 0 0 0 3px rgba(184,134,11,0.25);
}

.field__message {
  font-size: 0.85rem;
  color: var(--col-error);
  font-style: italic;
  min-height: 1.2em;
  transition: opacity var(--t-fast);
}

.field__message--hidden { opacity: 0; }

/* ------------------------------------------------------------------
   BUTTONS
   ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 48px;
  padding: var(--sp-3) var(--sp-6);
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

/* Primary — brass */
.btn--primary {
  background: linear-gradient(135deg, var(--col-brass-light), var(--col-brass));
  color: var(--col-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn--primary:hover { background: linear-gradient(135deg, #e0b730, var(--col-brass-light)); }

/* Ghost — parchment outline */
.btn--ghost {
  background: transparent;
  border: 2px solid var(--col-panel-dark);
  color: var(--col-ink-faded);
}
.btn--ghost:hover { border-color: var(--col-brass); color: var(--col-ink); }

/* Full width */
.btn--full { width: 100%; }

/* Reveal pulse (hidden until all puzzles done) */
.btn--reveal {
  background: linear-gradient(135deg, var(--col-gaslight), var(--col-brass));
  color: var(--col-bg);
  font-size: 1.1rem;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(232,160,32,0.4), 0 2px 8px rgba(0,0,0,0.4); }
  50%       { box-shadow: 0 0 24px rgba(232,160,32,0.8), 0 2px 8px rgba(0,0,0,0.4); }
}

/* ------------------------------------------------------------------
   STATUS BADGE (solved / unsolved)
   ------------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.badge--solved   { background: var(--col-success); color: #c8e6c8; }
.badge--unsolved { background: var(--col-panel-dark); color: var(--col-ink-faded); }

/* ------------------------------------------------------------------
   HINT COMPONENT
   ------------------------------------------------------------------ */
.hint-btn-wrap {
  position: fixed;
  bottom: calc(var(--sp-6) + var(--safe-bottom));
  right: calc(var(--sp-4) + var(--safe-right));
  z-index: 100;
}

#hint-btn {
  background: linear-gradient(135deg, var(--col-brass-light), var(--col-brass));
  color: var(--col-bg);
  border: none;
  border-radius: 999px;
  height: 48px;
  padding: 0 var(--sp-4);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  -webkit-tap-highlight-color: transparent;
}

.hint-dots {
  display: flex;
  gap: 3px;
  align-items: center;
}
.hint-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0,0,0,0.3);
  transition: background var(--t-fast);
}
.hint-dot--used { background: var(--col-bg); }

/* Hint modal */
.hint-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10,6,2,0.7);
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-normal);
}
.hint-modal--open {
  opacity: 1;
  pointer-events: auto;
}

.hint-modal__sheet {
  background: var(--col-panel);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 2px solid var(--col-brass);
  padding: var(--sp-6);
  padding-bottom: calc(var(--sp-6) + var(--safe-bottom));
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  transform: translateY(100%);
  transition: transform var(--t-normal);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.hint-modal--open .hint-modal__sheet { transform: translateY(0); }

.hint-modal__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--col-brass);
}

.hint-modal__text {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--col-ink);
  font-style: italic;
}

.hint-modal__actions {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
}

/* ------------------------------------------------------------------
   ANIMATIONS
   ------------------------------------------------------------------ */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

.shake { animation: shake 350ms ease; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fade-in var(--t-normal) both; }

@keyframes stamp-in {
  0%   { opacity: 0; transform: scale(2.5) rotate(-8deg); }
  60%  { transform: scale(0.92) rotate(1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.stamp-in { animation: stamp-in 500ms cubic-bezier(.22,.61,.36,1) both; }

/* ------------------------------------------------------------------
   UTILITY
   ------------------------------------------------------------------ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.hidden { display: none !important; }

.text-center { text-align: center; }
.text-faded  { color: var(--col-ink-faded); }

/* Spacing helpers */
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }

/* ------------------------------------------------------------------
   #reset handler (hidden dev/test utility)
   Any page that loads shell.css gets this for free.
   ------------------------------------------------------------------ */
