/* Neal Family Archive
   Palette taken from the hardware this footage came off: CRT blue-black, the
   blue screen a VCR shows with no tape, aged label stock, and the amber of a
   REC indicator. Amber is load-bearing — it marks only years that hold
   footage, so it never appears decoratively. */

:root {
  --ink: #0F131B;
  --panel: #171E29;
  --edge: #242E3D;
  --slate: #2C4A7C;
  --label: #E8E2D4;
  --muted: #8A93A3;
  --amber: #E39244;
  --amber-dim: #6B4A24;

  --serif: "Iowan Old Style", "Hoefler Text", Palatino, "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --gutter: clamp(1rem, 4vw, 3rem);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--label);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

/* ---------- Sign in ---------- */

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--gutter);
}

.gate-inner { width: min(30rem, 100%); }

.eyebrow {
  margin: 0 0 1.25rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
}

.gate-title {
  margin: 0 0 1.25rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.75rem, 9vw, 4.25rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
}

.gate-blurb {
  margin: 0 0 2.5rem;
  color: var(--muted);
  max-width: 26rem;
}

.form { display: grid; gap: 1rem; }

.field { display: grid; gap: 0.5rem; }

.field-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 2px;
  color: var(--label);
  font: inherit;
}

input::placeholder { color: #4E5766; }
input:focus { border-color: var(--slate); outline: none; box-shadow: 0 0 0 3px rgba(44, 74, 124, 0.35); }

/* Cognito's passwordless codes are eight characters, not six. */
.code-input {
  font-family: var(--mono);
  font-size: clamp(1.15rem, 5vw, 1.45rem);
  letter-spacing: 0.28em;
  text-indent: 0.28em;   /* re-centre: trailing letter-space skews it left */
  text-align: center;
}

.btn {
  padding: 0.85rem 1.25rem;
  background: var(--amber);
  border: none;
  border-radius: 2px;
  color: #1A1206;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
}

.btn:hover { background: #F0A458; }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-quiet {
  padding: 0.5rem 0;
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.btn-quiet:hover { color: var(--label); }

.msg {
  margin: 1rem 0 0;
  min-height: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.msg[data-tone="error"] { color: #E8785A; }

/* ---------- Masthead ---------- */

.masthead {
  padding: var(--gutter) var(--gutter) 0;
  border-bottom: 1px solid var(--edge);
}

.masthead-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
}

.wordmark {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.01em;
}

.masthead-side { display: flex; gap: 1.5rem; align-items: baseline; }

.totals {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* ---------- Year rail (signature) ---------- */

.rail { margin: 2rem 0 0; overflow-x: auto; }

.rail-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: max-content;
  height: 68px;
}

.rail-year {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: clamp(26px, 3.4vw, 46px);
  height: 100%;
}

.rail-bar {
  display: block;
  width: 100%;
  min-height: 2px;
  padding: 0;
  border: none;
  background: var(--amber-dim);
  cursor: pointer;
  transition: background 120ms ease;
}

.rail-year[data-empty="true"] .rail-bar {
  height: 1px !important;
  background: var(--edge);
  cursor: default;
}

.rail-bar:hover,
.rail-year[data-active="true"] .rail-bar { background: var(--amber); }

.rail-tick {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.02em;
}

.rail-year[data-empty="true"] .rail-tick { color: #3B4453; }

/* ---------- Tabs ---------- */

.tabs { display: flex; gap: 1.75rem; margin-top: 1.5rem; }

.tab {
  padding: 0 0 0.85rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.tab[aria-selected="true"] { color: var(--label); border-bottom-color: var(--amber); }

/* ---------- Tapes ---------- */

.view { padding: var(--gutter); }

.era { margin-bottom: 3.5rem; }

.era-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--edge);
}

.era-year {
  font-family: var(--serif);
  font-size: 1.65rem;
  letter-spacing: 0.01em;
}

.era-count {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.tapes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr));
  gap: 1.5rem;
}

.tape {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 2px;
  color: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 140ms ease, transform 140ms ease;
}

.tape:hover { border-color: var(--slate); transform: translateY(-2px); }

.tape-frame {
  position: relative;
  aspect-ratio: 4 / 3;   /* every tape here is standard definition */
  background: #0A0D13;
}

.tape-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tape-dur {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 6px;
  background: rgba(10, 13, 19, 0.82);
  color: var(--label);
  font-family: var(--mono);
  font-size: 0.68rem;
}

/* The label strip: what was written on the physical cassette. */
.tape-label {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem 0.9rem;
  border-top: 1px solid var(--edge);
}

.tape-no {
  flex: none;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--amber);
  padding-top: 0.15rem;
  letter-spacing: 0.04em;
}

.tape-title {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.3;
}

.tape-note {
  margin-top: 0.2rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* ---------- Photographs ---------- */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(9rem, 45%), 1fr));
  gap: 0.6rem;
}

.photo {
  padding: 0;
  border: 1px solid var(--edge);
  border-radius: 2px;
  background: var(--panel);
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 1;
  transition: border-color 140ms ease;
}

.photo:hover { border-color: var(--amber); }

.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Dialogs ---------- */

.player, .lightbox {
  width: min(64rem, 94vw);
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--label);
}

.player::backdrop, .lightbox::backdrop { background: rgba(6, 8, 12, 0.86); }

.player video { width: 100%; max-height: 72vh; display: block; background: #000; }

.player-meta { padding: 1rem 1.25rem 1.25rem; display: grid; gap: 0.3rem; }
.player-title { margin: 0; font-family: var(--serif); font-size: 1.25rem; }
.player-sub { margin: 0; font-size: 0.75rem; color: var(--muted); letter-spacing: 0.05em; }
.player-meta a { justify-self: start; margin-top: 0.5rem; }

.lightbox img { width: 100%; max-height: 86vh; object-fit: contain; display: block; }

.close {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  background: rgba(10, 13, 19, 0.75);
  border: none;
  border-radius: 50%;
  color: var(--label);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.empty { color: var(--muted); font-size: 0.95rem; }

/* ---------- Motion ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.tape, .photo { animation: rise 320ms ease backwards; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .tape:hover { transform: none; }
}
