/* ----------------------------------------------------------------------------
   Er Mythos 5 tilbage? — natural-history specimen plate
   One committed light world. EB Garamond. Earthy specimen palette.
---------------------------------------------------------------------------- */

:root {
  --paper: #efe6d0;
  --paper-deep: #e6d9bb;
  --ink: #2a2417;
  --muted: #655840;
  --hair: rgba(42, 36, 23, 0.20);
  --hair-soft: rgba(42, 36, 23, 0.12);

  --terra: #ad452f;   /* nej */
  --green: #466b3f;   /* ja */
  --teal: #2f6d63;
  --mustard: #a9781d;
  --blue: #4f7799;

  --status: var(--muted);
  --halo: rgba(101, 88, 64, 0.0);

  --serif: "EB Garamond", "Iowan Old Style", Georgia, "Times New Roman", serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --z-bg: 0;
  --z-base: 1;
  --z-celebrate: 60;
}

body.is-down  { --status: var(--terra); --halo: rgba(173, 69, 47, 0.16); }
body.is-up    { --status: var(--green); --halo: rgba(70, 107, 63, 0.18); }
body.is-unknown { --status: var(--muted); --halo: rgba(101, 88, 64, 0.10); }

* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(80% 50% at 50% 16%, var(--halo), transparent 70%),
    linear-gradient(170deg, var(--paper), var(--paper-deep));
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.65;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background 0.8s var(--ease);
}

/* ---- paper grain ---------------------------------------------------------- */
.grain {
  position: fixed; inset: 0; z-index: var(--z-bg); pointer-events: none;
  opacity: 0.55; mix-blend-mode: multiply;
  background-image: 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.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
}

/* ---- butterfly specimens (real lithograph art, white plate drops out via
        multiply blend over the parchment) ------------------------------------ */
.flutter { position: fixed; inset: 0; z-index: var(--z-bg); pointer-events: none; overflow: hidden; }
.bf {
  position: absolute; width: clamp(72px, 9vw, 132px); height: auto;
  filter: saturate(0.95) drop-shadow(0 12px 16px rgba(42, 36, 23, 0.22));
  opacity: 0.95;
  will-change: transform;
}
.bf1 { top: 7%;  left: 6%;  rotate: -16deg; }
.bf2 { top: 16%; right: 5%; rotate: 18deg; width: clamp(58px, 7vw, 104px); }
.bf3 { top: 54%; left: 4%;  rotate: 7deg;  width: clamp(54px, 6.5vw, 96px); }
.bf4 { top: 70%; right: 6%; rotate: -13deg; }
.bf5 { top: 88%; left: 12%; rotate: 14deg; width: clamp(50px, 6vw, 88px); opacity: 0.8; }

@media (max-width: 760px) {
  .bf2, .bf3 { display: none; }
  .bf { opacity: 0.7; width: clamp(56px, 16vw, 90px); }
}

#confetti { position: fixed; inset: 0; z-index: var(--z-celebrate); pointer-events: none; }

/* ---- shell ---------------------------------------------------------------- */
main {
  position: relative; z-index: var(--z-base);
  max-width: 41rem; margin: 0 auto;
  padding: clamp(56px, 9vw, 104px) clamp(20px, 5vw, 40px) 120px;
}

section { margin-bottom: clamp(48px, 8vw, 80px); }

/* ---- header --------------------------------------------------------------- */
.site-header { text-align: center; }
.kicker {
  margin: 0 0 18px;
  font-size: 0.72rem; letter-spacing: 0.34em; text-transform: uppercase;
  font-variant: small-caps; color: var(--muted); font-weight: 500;
}
.site-header h1 {
  margin: 0; font-weight: 500; font-style: italic;
  font-size: clamp(1.5rem, 4.5vw, 2.1rem); letter-spacing: 0.005em;
  text-wrap: balance;
}
.updated {
  margin: 14px 0 0; font-size: 0.92rem; color: var(--muted);
  font-variant-numeric: tabular-nums; font-style: italic;
}

/* ---- hero answer ---------------------------------------------------------- */
.answer { text-align: center; margin-top: clamp(28px, 6vw, 56px); }
.plate { position: relative; display: grid; place-items: center; }
.ghost {
  grid-area: 1 / 1; align-self: center;
  font-size: clamp(15rem, 46vw, 27rem); line-height: 0.78; font-weight: 500;
  color: var(--ink); opacity: 0.05; user-select: none; pointer-events: none;
  transform: translateY(0.04em);
}
.status {
  grid-area: 1 / 1;
  font-size: clamp(5.5rem, 26vw, 11.5rem); line-height: 0.86; font-weight: 800;
  letter-spacing: -0.025em; color: var(--status);
  text-shadow: 0 1px 0 rgba(255, 251, 240, 0.45);
  transition: color 0.8s var(--ease);
}
.status-sub {
  margin: clamp(16px, 3vw, 26px) auto 0; max-width: 30ch;
  font-style: italic; font-size: 1.15rem; color: var(--muted); text-wrap: pretty;
}

/* ---- specimen label (replaces stat cards) -------------------------------- */
.specimen {
  border: 1px solid var(--hair);
  background: rgba(255, 252, 243, 0.4);
  border-radius: 2px;
  padding: clamp(18px, 3.5vw, 26px) clamp(20px, 4vw, 32px);
  box-shadow: 0 1px 0 rgba(255, 251, 240, 0.5) inset;
}
.specimen-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin-bottom: 16px;
  border-bottom: 1px solid var(--hair-soft); padding-bottom: 12px;
}
.specimen-title { font-style: italic; font-size: 1.05rem; }
.specimen-no {
  font-size: 0.74rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.specimen-rows { display: grid; gap: 10px; }
.srow {
  display: grid; grid-template-columns: 1fr auto;
  align-items: baseline; gap: 16px;
}
.srow dt {
  font-variant: small-caps; letter-spacing: 0.04em; font-size: 0.95rem;
  color: var(--muted);
}
.srow dt::after {
  content: ""; display: inline-block; width: 100%;
}
.srow .lead {
  display: flex; align-items: baseline; gap: 10px; min-width: 0;
}
.srow .lead::after {
  content: ""; flex: 1;
  border-bottom: 1px dotted var(--hair); transform: translateY(-0.18em);
}
.srow dd {
  margin: 0; font-weight: 600; font-variant-numeric: tabular-nums;
  font-size: 1.05rem; white-space: nowrap;
}

/* ---- availability strip --------------------------------------------------- */
.history-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px;
}
.history-head .label { font-style: italic; font-size: 1.05rem; }
.history-head .range {
  font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted);
}
.strip { display: flex; gap: 3px; height: 44px; }
.strip i {
  flex: 1; border-radius: 1px; background: var(--hair-soft);
  box-shadow: 0 0 0 1px rgba(42, 36, 23, 0.05) inset;
  transition: background 0.4s var(--ease);
}
.cell-up { background: var(--green) !important; }
.cell-mixed { background: var(--mustard) !important; }
.cell-down { background: var(--terra) !important; }
.cell-none { background: var(--hair-soft) !important; }
.strip-legend {
  display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px;
  font-size: 0.82rem; color: var(--muted);
}
.strip-legend span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 10px; height: 10px; border-radius: 1px; }
.dot-up { background: var(--green); } .dot-mixed { background: var(--mustard); }
.dot-down { background: var(--terra); } .dot-none { background: var(--hair); }

/* ---- signup --------------------------------------------------------------- */
.signup h2, .faq h2 {
  margin: 0 0 22px; font-weight: 500; font-style: italic;
  font-size: clamp(1.4rem, 3.5vw, 1.7rem);
}
.signup { border-top: 1px solid var(--hair); padding-top: clamp(40px, 6vw, 60px); }

.tabs {
  display: inline-flex; gap: 2px; margin-bottom: 22px;
  border: 1px solid var(--hair); border-radius: 2px; padding: 3px;
  background: rgba(255, 252, 243, 0.4);
}
.tab {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font-family: var(--serif); font-size: 0.98rem; color: var(--muted);
  padding: 8px 18px; border-radius: 1px;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--ink); color: var(--paper); }

.panel { display: none; }
.panel.is-active { display: block; animation: rise 0.4s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { .panel.is-active { animation: none; } }

.field { display: flex; gap: 10px; align-items: stretch; }
.field input {
  flex: 1; min-width: 0; font-family: var(--serif); font-size: 1.05rem;
  color: var(--ink); background: rgba(255, 252, 243, 0.7);
  border: 1px solid var(--hair); border-radius: 2px; padding: 13px 16px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field input::placeholder { color: #9a8c70; }
.field input:focus {
  outline: none; border-color: var(--status);
  box-shadow: 0 0 0 3px var(--halo);
}
.btn {
  appearance: none; cursor: pointer; white-space: nowrap;
  font-family: var(--serif); font-size: 1rem; font-weight: 600;
  color: var(--paper); background: var(--ink);
  border: 1px solid var(--ink); border-radius: 2px; padding: 13px 22px;
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }
#push-btn { width: 100%; }
.reassure { margin: 16px 0 0; font-style: italic; font-size: 0.95rem; color: var(--muted); }
.form-msg { margin: 16px 0 0; font-size: 1rem; min-height: 1.4em; }
.form-msg.ok { color: var(--green); }
.form-msg.err { color: var(--terra); }

/* ---- faq ------------------------------------------------------------------ */
.faq dl { margin: 0; }
.faq dt {
  font-size: 1.18rem; font-weight: 600; margin-bottom: 6px;
}
.faq dd {
  margin: 0 0 4px; color: var(--muted); max-width: 62ch; text-wrap: pretty;
}
.faq .qa { padding: 22px 0; border-top: 1px solid var(--hair-soft); }
.faq .qa:first-of-type { border-top: 0; }
code {
  font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 0.82em;
  background: rgba(42, 36, 23, 0.06); border: 1px solid var(--hair-soft);
  padding: 1px 6px; border-radius: 3px; color: var(--ink);
}

/* ---- footer --------------------------------------------------------------- */
.site-footer {
  margin: 0; padding-top: clamp(36px, 6vw, 56px);
  border-top: 1px solid var(--hair);
  text-align: center; font-size: 0.92rem; color: var(--muted);
}
.site-footer a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--hair); transition: color 0.2s var(--ease); }
.site-footer a:hover { color: var(--ink); }
.site-footer .sep { margin: 0 12px; opacity: 0.5; }

/* ---- motion --------------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.022); } }
@keyframes drift1 { 0%, 100% { translate: 0 0; rotate: var(--r, 0deg); } 50% { translate: 8px -16px; rotate: calc(var(--r, 0deg) + 4deg); } }

@media (prefers-reduced-motion: no-preference) {
  body.is-down .status, body.is-up .status { animation: breathe 4s var(--ease) infinite; }
  .bf1 { --r: -16deg; animation: drift1 13s var(--ease) infinite; }
  .bf2 { --r: 18deg;  animation: drift1 16s var(--ease) infinite 1s; }
  .bf3 { --r: 7deg;   animation: drift1 19s var(--ease) infinite 0.5s; }
  .bf4 { --r: -13deg; animation: drift1 15s var(--ease) infinite 2s; }
  .bf5 { --r: 14deg;  animation: drift1 17s var(--ease) infinite 1.5s; }
  main > * { animation: rise 0.7s var(--ease) both; }
  main > section:nth-of-type(1) { animation-delay: 0.05s; }
  main > section:nth-of-type(2) { animation-delay: 0.12s; }
  main > section:nth-of-type(3) { animation-delay: 0.19s; }
  main > section:nth-of-type(4) { animation-delay: 0.26s; }
  main > footer { animation-delay: 0.33s; }
}

@media (max-width: 540px) {
  .field { flex-direction: column; }
  .tabs { display: flex; }
  .tab { flex: 1; text-align: center; padding: 9px 6px; }

  .specimen-head { flex-wrap: wrap; }
  .srow { grid-template-columns: 1fr; gap: 2px; }
  .srow .lead::after { display: none; }
  .srow dd { justify-self: start; font-size: 1.2rem; white-space: normal; }
}
