/* 2026 timeline: a dark gallery wall. The photos carry the colour, the chrome stays quiet. */
:root {
  --bg: #0f0e0d;
  --bg-2: #1a1816;
  --bg-3: #26231f;
  --ink: #f4efe6;
  --mute: #a69f93;
  --line: rgba(244, 239, 230, .14);
  --accent: #ffcf3f;

  --c-win: #ffcf3f;
  --c-campaign: #ff6f91;
  --c-action: #ff8552;
  --c-tech: #5fd4c4;
  --c-team: #b79cff;
  --c-world: #9fb6cc;

  --radius: 14px;
  --display: "Fraunces", Georgia, serif;
  --font: "DM Sans", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
em { font-family: var(--display); font-style: italic; font-weight: 400; }
.numerals { font-family: var(--display); font-weight: 900; letter-spacing: -.04em; line-height: .8; display: block; }

[data-cat="win"] { --cat: var(--c-win); }
[data-cat="campaign"] { --cat: var(--c-campaign); }
[data-cat="action"] { --cat: var(--c-action); }
[data-cat="tech"] { --cat: var(--c-tech); }
[data-cat="team"] { --cat: var(--c-team); }
[data-cat="world"] { --cat: var(--c-world); }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; width: 100vw; height: 100vh; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; border: 0; border-radius: 999px;
  padding: .6rem 1.1rem; font-weight: 700; text-decoration: none; white-space: nowrap; transition: transform .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-solid { background: var(--ink); color: var(--bg); }
.btn-solid:hover { background: var(--accent); }
.btn-ghost { background: transparent; color: var(--mute); }
.btn-lg { padding: .95rem 1.6rem; font-size: 1.05rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--mute); text-decoration: underline; font-size: .85rem; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 2rem; }
.login-card { max-width: 560px; text-align: center; }
.login .logo { height: 44px; filter: brightness(0) invert(1); opacity: .8; margin-bottom: 3rem; }
.login h1 { margin: 0 0 1.5rem; font-weight: 400; }
.login .numerals { font-size: clamp(6rem, 28vw, 13rem); }
.login h1 em { display: block; font-size: clamp(1.8rem, 6vw, 3rem); margin-top: 1rem; }
.login p { font-size: 1.1rem; color: var(--mute); margin: 0 0 2rem; }
.login-error { background: var(--c-action); color: var(--bg) !important; border-radius: 12px; padding: .8rem 1rem; margin-top: 1.5rem !important; }

/* ---------- app shell: top bar / strip / month rail ---------- */
#app { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: 1rem 1.5rem; padding: .8rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
}
.brand { margin: 0; white-space: nowrap; font-size: 1.15rem; }
.brand b { font-family: var(--display); font-weight: 900; }
.brand em { color: var(--mute); }
.filters { display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; margin: 0 auto; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--mute); border-radius: 999px;
  padding: .4rem .85rem; font-size: .9rem; font-weight: 500; white-space: nowrap; transition: all .15s;
}
.chip:hover { color: var(--ink); border-color: var(--mute); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.me { display: flex; align-items: center; gap: .7rem; font-size: .9rem; color: var(--mute); white-space: nowrap; }
.me img { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-3); }

/* ---------- the strip ---------- */
.strip {
  container-type: size; position: relative; display: flex; align-items: stretch;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none;
  cursor: grab; outline-offset: -4px;
}
.strip::-webkit-scrollbar { display: none; }
.strip.dragging { cursor: grabbing; user-select: none; }
.strip.dragging .tile { pointer-events: none; }

.intro, .outro { flex: none; display: flex; flex-direction: column; justify-content: center; padding: 0 clamp(1.25rem, 5vw, 5rem); }
.intro { width: max-content; max-width: 92vw; }
.kicker { text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; color: var(--mute); margin: 0 0 1.2rem; }
.intro h1 { margin: 0; font-weight: 400; }
.intro .numerals { font-size: min(clamp(5.5rem, 38cqh, 15rem), 34vw); margin-left: -.04em; }
.intro h1 em { display: block; font-size: clamp(1.5rem, 6cqh, 2.6rem); margin-top: .5em; }
.stats { display: flex; gap: 1.6rem; margin-top: clamp(1rem, 5cqh, 2.5rem); }
.stats b { display: block; font-family: var(--display); font-size: 1.9rem; font-weight: 600; }
.stats span { color: var(--mute); font-size: .8rem; }
.hint { color: var(--mute); font-size: .9rem; margin: clamp(1rem, 4cqh, 2rem) 0 0; max-width: 34ch; }
kbd { border: 1px solid var(--line); border-radius: 5px; padding: 0 .35em; font: inherit; }
.outro { align-items: flex-start; gap: 1.2rem; min-width: min(80vw, 420px); padding-right: clamp(2rem, 10vw, 9rem); }
.outro h2 { margin: 0; font-size: clamp(1.8rem, 7cqh, 3rem); font-weight: 400; }
.outro p { margin: 0; color: var(--mute); }

/* ---------- the timeline: one light line, a tick per day, a taller mark per month ---------- */
.track { position: relative; flex: none; --rule: rgba(244, 239, 230, .5); --tick: rgba(244, 239, 230, .3); }
.axis {
  position: absolute; top: 50%; height: 9px; translate: 0 -50%;
  background:
    linear-gradient(var(--rule), var(--rule)) 0 50% / 100% 1px no-repeat,
    repeating-linear-gradient(to right, var(--tick) 0 1px, transparent 1px var(--day));
}
.axis-pre { position: absolute; top: 50%; left: 0; border-top: 1px dashed var(--tick); translate: 0 -50%; }
.pre-label, .month em {
  position: absolute; top: .5rem; z-index: 1; background: var(--bg); padding: 0 .45em; white-space: nowrap;
  font-family: var(--display); font-style: italic; font-size: .95rem; line-height: 1.2; color: var(--ink);
}
.pre-label { top: calc(50% + .5rem); left: 0; color: var(--mute); }
.month { position: absolute; top: 50%; }
.month::before { content: ""; position: absolute; left: 0; top: -14px; width: 1px; height: 29px; background: var(--ink); }
.month em { left: .25rem; }
.today { position: absolute; top: 50%; z-index: 1; font-size: .62rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.today { translate: -50% calc(-100% - 12px); background: var(--bg); padding: 0 .4em; line-height: 1.3; }
.today::after { content: ""; position: absolute; left: 50%; top: 100%; width: 2px; height: 20px; translate: -50% 0; background: var(--accent); }

/* ---------- cards: a small picture and a title, hung on a pole that lands on the date ---------- */
.tile {
  position: absolute; left: var(--x); width: var(--cw); height: var(--ch);
  display: flex; flex-direction: column; padding: 0; border: 0; background: none; text-align: left;
}
.tile.up { bottom: calc(50% + var(--off)); }
.tile.down { top: calc(50% + var(--off)); }
.tile::before { /* the pole: the card's left edge, carried on to the axis */
  content: ""; position: absolute; left: 0; width: 1px; height: calc(100% + var(--off));
  background: color-mix(in srgb, var(--cat) 65%, var(--bg)); transition: background .15s;
}
.tile.up::before { top: 0; }
.tile.down::before { bottom: 0; }
.tile::after { /* the dot on the axis */
  content: ""; position: absolute; left: -4px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--cat); box-shadow: 0 0 0 3px var(--bg); transition: scale .15s;
}
.tile.up::after { top: calc(100% + var(--off) - 4.5px); }
.tile.down::after { bottom: calc(100% + var(--off) - 4.5px); }
.tile.approx::after { background: var(--bg); box-shadow: 0 0 0 2px var(--cat), 0 0 0 4px var(--bg); width: 7px; height: 7px; left: -3px; }
.tile.approx.up::after { top: calc(100% + var(--off) - 3.5px); }
.tile.approx.down::after { bottom: calc(100% + var(--off) - 3.5px); }
.tile:hover, .tile:focus-visible { z-index: 2; }
.tile:hover::before, .tile:focus-visible::before { background: var(--cat); }
.tile:hover::after, .tile:focus-visible::after { scale: 1.35; }
.tile:focus-visible { outline: none; }

.tile-img {
  position: relative; flex: none; height: var(--ih); overflow: hidden; border-radius: 0 9px 9px 0;
  background: var(--bg-2); transition: box-shadow .15s;
}
.tile:hover .tile-img, .tile:focus-visible .tile-img { box-shadow: 0 0 0 2px var(--cat); }
.tile-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s ease; }
.tile:hover .tile-img img { transform: scale(1.06); }
.tile-n {
  position: absolute; right: .3rem; bottom: .3rem; background: rgba(15, 14, 13, .7); backdrop-filter: blur(6px);
  border-radius: 999px; padding: .1rem .45rem; font-size: .68rem; font-weight: 700;
}
.tile-cap { display: grid; gap: 2px; padding: 6px 0 0 .55rem; min-height: 0; }
.tile-when { font-size: .64rem; line-height: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--cat, var(--mute)); font-weight: 700; white-space: nowrap; }
.tile-title {
  font-family: var(--display); font-weight: 600; font-size: .84rem; line-height: 16px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}

/* no picture: the emoji becomes the poster */
.poster { background: radial-gradient(120% 90% at 30% 15%, color-mix(in srgb, var(--cat) 62%, var(--bg)), color-mix(in srgb, var(--cat) 14%, var(--bg)) 75%); }
.poster-emoji {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: calc(var(--ih) * .5); line-height: 1; filter: drop-shadow(0 .08em .18em rgba(0, 0, 0, .35));
  transition: transform .4s ease;
}
.tile:hover .poster-emoji { transform: scale(1.1) rotate(-6deg); }

.strip.first-run .tile { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i) * 55ms); }
@keyframes rise { from { opacity: 0; } }

/* ---------- month rail ---------- */
.rail { position: relative; border-top: 1px solid var(--line); }
.progress { position: absolute; top: -1px; left: 0; height: 2px; width: 0; background: var(--accent); }
.rail-months { display: flex; justify-content: center; gap: .1rem; overflow-x: auto; scrollbar-width: none; padding: .35rem clamp(.5rem, 3vw, 2rem); }
.rail-months button {
  border: 0; background: none; padding: .5rem .7rem; font-size: .74rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--mute); border-radius: 8px; white-space: nowrap;
}
.rail-months button:hover:not(:disabled) { color: var(--ink); background: var(--bg-2); }
.rail-months button.active { color: var(--bg); background: var(--accent); }

/* ---------- dialogs ---------- */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--bg-2); border-radius: 20px; box-shadow: 0 40px 100px -20px #000; }
dialog::backdrop { background: rgba(8, 7, 6, .78); backdrop-filter: blur(6px); }

/* moment detail */
.detail { width: min(1120px, 94vw); height: min(720px, 88dvh); max-width: none; max-height: none; overflow: hidden; }
.detail[open] { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.d-media { position: relative; background: var(--bg); min-height: 0; overflow: hidden; }
.d-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.d-media.poster { background: radial-gradient(120% 90% at 30% 15%, color-mix(in srgb, var(--cat) 62%, var(--bg)), color-mix(in srgb, var(--cat) 14%, var(--bg)) 75%); }
.d-media.poster .poster-emoji { inset: 0; font-size: min(38vw, 15rem); z-index: 0; }
.d-nav {
  position: absolute; top: 50%; translate: 0 -50%; width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: rgba(15, 14, 13, .62); backdrop-filter: blur(8px); font-size: 1.1rem; display: grid; place-items: center;
}
.d-nav:hover { background: var(--ink); color: var(--bg); }
.d-nav.prev { left: .8rem; } .d-nav.next { right: .8rem; }
.d-close { position: absolute; top: .8rem; right: .8rem; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--bg-3); font-size: 1rem; }
.d-close:hover { background: var(--ink); color: var(--bg); }
.d-panel { overflow-y: auto; padding: 2rem clamp(1.2rem, 3vw, 2.2rem) 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.d-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--mute); padding-right: 3rem; }
.d-meta .cat { color: var(--cat); }
.d-panel h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(1.6rem, 3.2vw, 2.3rem); line-height: 1.08; text-wrap: balance; }
.d-desc { margin: 0; line-height: 1.6; white-space: pre-line; color: #d9d3c8; }
.d-more { font-weight: 700; text-decoration: none; align-self: flex-start; }
.d-more:hover { text-decoration: underline; }
.byline { display: flex; align-items: center; gap: .45rem; font-size: .82rem; color: var(--mute); }
.byline img { width: 22px; height: 22px; border-radius: 50%; }
.owner-tools { margin-left: auto; display: flex; gap: .8rem; }
.owner-tools button { background: none; border: 0; padding: 0; color: var(--mute); font-size: .82rem; text-decoration: underline; }
.owner-tools button:hover { color: var(--ink); }

.reactions { display: flex; flex-wrap: wrap; gap: .35rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.react {
  border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: .3rem .6rem; font-size: 1.05rem;
  display: inline-flex; gap: .35rem; align-items: center; transition: transform .12s, background .15s;
}
.react:hover { background: var(--bg-3); }
.react:active { transform: scale(1.25); }
.react b { font-size: .8rem; font-weight: 700; min-width: .6em; }
.react.none b { display: none; }
.react.none { opacity: .55; }
.react.none:hover { opacity: 1; }
.react.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }

.comments { display: grid; gap: .7rem; }
.comments-title { margin: 0; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--mute); }
.comment { display: flex; gap: .6rem; font-size: .93rem; }
.comment img, .comment .avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.comment .bubble { background: var(--bg-3); border-radius: 4px 14px 14px 14px; padding: .5rem .8rem; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.comment .who { font-weight: 700; font-size: .82rem; }
.comment .who time { font-weight: 400; color: var(--mute); margin-left: .4rem; }
.comment .who button { float: right; background: none; border: 0; color: var(--mute); font-size: .75rem; text-decoration: underline; }
.comment-form { display: flex; gap: .4rem; }
.comment-form input { flex: 1; min-width: 0; }
.avatar { display: grid; place-items: center; background: var(--c-team); color: var(--bg); font-weight: 700; font-size: .72rem; }

/* form fields (comment box and add/edit dialog) */
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem;
}
.comment-form input { border-radius: 999px; padding: .5rem 1rem; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
::placeholder { color: #6f695f; }

.form-dialog { width: min(560px, 94vw); overflow-x: hidden; }
.form-dialog form { padding: 1.6rem 1.6rem 1.2rem; display: grid; gap: .9rem; }
.form-dialog h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.7rem; }
.form-dialog label { display: grid; gap: .3rem; font-weight: 700; font-size: .85rem; min-width: 0; }
.form-dialog small { font-weight: 400; color: var(--mute); }
.form-dialog input, .form-dialog textarea, .form-dialog select { font-weight: 400; width: 100%; min-width: 0; }
.form-dialog .row { display: flex; gap: .8rem; }
.form-dialog .row > label { flex: 1 1 0; }
.form-dialog .emoji-field { flex: 0 0 90px !important; }
.form-dialog .emoji-field input { text-align: center; font-size: 1.4rem; padding: .35rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; font-size: .85rem; margin-bottom: .35rem; padding: 0; }
.cat-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.cat-picker label { display: block; }
.cat-picker input { position: absolute; opacity: 0; width: auto; }
.cat-picker span { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: .35rem .8rem; font-weight: 500; cursor: pointer; }
.cat-picker input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.cat-picker input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.quick-emoji { display: flex; flex-wrap: wrap; gap: .2rem; margin-top: -.4rem; }
.quick-emoji button { border: 0; background: var(--bg-3); border-radius: 8px; font-size: 1.15rem; padding: .2rem .35rem; }
.actions { display: flex; justify-content: flex-end; gap: .5rem; }
.form-error { color: var(--c-action); font-weight: 700; margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: 4.5rem; transform: translateX(-50%); z-index: 120;
  background: var(--ink); color: var(--bg); padding: .7rem 1.2rem; border-radius: 999px; font-weight: 700;
  animation: rise .25s ease both;
}

/* ---------- small screens: still sideways ---------- */
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; }
  .filters { order: 3; flex-basis: 100%; margin: 0; }
  .me { margin-left: auto; }
  .me #me-name, .me #logout { display: none; }
  .rail-months { justify-content: flex-start; }
  .stats { gap: 1.1rem; }
  .detail { width: 100vw; height: 100dvh; border-radius: 0; }
  .detail[open] { grid-template-columns: 1fr; grid-template-rows: 38dvh minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .strip.first-run .tile, .toast { animation: none; }
  .tile::before, .tile::after, .tile-img, .tile-img img, .poster-emoji { transition: none; }
}
