/* WebTimeline — "Phòng chiếu" / Cinema (A3), with a daylight gallery variant for an explicit light theme.
   Layout B1: a vertical spine with milestones alternating left and right. */

/* ================= TOKENS ================= */
:root {
    --serif: 'Cormorant Garamond', 'Cormorant', 'Times New Roman', Georgia, serif;
    --sans: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    --ease: cubic-bezier(.2, .8, .2, 1);
    --ease-io: cubic-bezier(.65, 0, .35, 1);
    --gutter: 16px;
    --max: 1240px;
    --top-h: 60px;

    --brand-red: #E92047;
}

:root,
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #08080a;
    --bg-2: #0e0e11;
    --panel: #131317;
    --panel-2: #1a1a1f;
    --ink: #efe9dd;
    --ink-2: #c3bcae;
    --ink-3: #8a8478;
    --ink-4: #5f5a52;
    --line: rgba(239, 233, 221, .09);
    --line-2: rgba(239, 233, 221, .17);
    --accent: #d8b878;
    --accent-2: #f0d9a6;
    --accent-ink: #1b1508;
    --accent-soft: rgba(216, 184, 120, .13);
    --accent-line: rgba(216, 184, 120, .4);
    --red: #ff5c78;
    --good: #8fd6b0;
    --field: rgba(255, 255, 255, .04);
    --field-border: rgba(239, 233, 221, .14);
    --hover: rgba(239, 233, 221, .06);
    --screen: #000;
    --chrome: #17171b;
    --shadow-screen: 0 40px 90px -40px rgba(0, 0, 0, .95), 0 0 0 1px rgba(0, 0, 0, .7);
    --shadow-pop: 0 30px 80px -20px rgba(0, 0, 0, .8);
    --ambient: .42;
    --grain: .075;
    --dim: brightness(.78) saturate(.9);
    --veil: rgba(4, 4, 6, .78);
    --year-stroke: rgba(239, 233, 221, .16);
    --glass: rgba(10, 10, 12, .72);
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f3efe7;
    --bg-2: #ece7dc;
    --panel: #fbf9f4;
    --panel-2: #f1ece2;
    --ink: #1d1b17;
    --ink-2: #4a453c;
    --ink-3: #777064;
    --ink-4: #a39b8d;
    --line: rgba(29, 27, 23, .1);
    --line-2: rgba(29, 27, 23, .2);
    --accent: #8a6a32;
    --accent-2: #6d5124;
    --accent-ink: #fffdf8;
    --accent-soft: rgba(138, 106, 50, .1);
    --accent-line: rgba(138, 106, 50, .38);
    --red: #d3173d;
    --good: #1f7a52;
    --field: #fffdf9;
    --field-border: rgba(29, 27, 23, .16);
    --hover: rgba(29, 27, 23, .05);
    --screen: #fff;
    --chrome: #ebe6dc;
    --shadow-screen: 0 30px 70px -36px rgba(60, 45, 20, .45), 0 0 0 1px rgba(29, 27, 23, .1);
    --shadow-pop: 0 24px 60px -20px rgba(60, 45, 20, .35);
    --ambient: .28;
    --grain: .035;
    --dim: none;
    --veil: rgba(243, 239, 231, .86);
    --year-stroke: rgba(29, 27, 23, .18);
    --glass: rgba(243, 239, 231, .78);
}

/* ================= BASE ================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 140px; }
html.has-dialog { overflow: hidden; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color .5s var(--ease), color .5s var(--ease);
}
img { max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

.skip {
    position: fixed; left: 16px; top: -60px; z-index: 100;
    background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 999px;
    text-decoration: none; font-weight: 500; transition: top .2s;
}
.skip:focus { top: 12px; }

/* Film grain over everything — static texture, never intercepts input. */
.grain {
    position: fixed; inset: -50%; z-index: 60; pointer-events: none; opacity: var(--grain);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grain 1.2s steps(6) infinite;
}
:root[data-theme="light"] .grain { mix-blend-mode: multiply; filter: invert(1); }
@keyframes grain {
    0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
    60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

/* ================= BUTTONS / CONTROLS ================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    min-height: 42px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line-2);
    background: transparent; color: var(--ink); cursor: pointer; font-size: 14px; font-weight: 500; letter-spacing: .01em;
    text-decoration: none; transition: background .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
.btn:hover { background: var(--hover); border-color: var(--ink-4); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn-ghost { border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink); border-color: var(--line-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); background: var(--red); }
.btn-danger-ghost { border-color: transparent; color: var(--red); }
.btn-danger-ghost:hover { border-color: var(--red); background: transparent; }
.btn .i { width: 16px; height: 16px; }

.btn-play {
    min-height: 52px; padding: 0 26px 0 8px; gap: 14px; font-size: 15px;
    border-color: var(--accent-line); color: var(--ink);
    background: linear-gradient(180deg, var(--accent-soft), transparent);
}
.btn-play:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn-play-icon {
    width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
    background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 6px var(--accent-soft), 0 0 30px rgba(216, 184, 120, .35);
    transition: transform .4s var(--ease);
}
.btn-play-icon .i { width: 16px; height: 16px; margin-left: 2px; }
.btn-play:hover .btn-play-icon { transform: scale(1.06); }

.icon-btn {
    width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 50%;
    border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--field); }
.seg button {
    border: 0; background: transparent; color: var(--ink-3); cursor: pointer; border-radius: 999px;
    padding: 5px 11px; font-size: 12px; font-weight: 600; letter-spacing: .08em;
    display: inline-flex; align-items: center; gap: 6px; transition: background .2s, color .2s;
}
.seg button[aria-checked="true"], .seg button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.seg .i { width: 15px; height: 15px; }

kbd {
    font-family: var(--sans); font-size: 11px; padding: 1px 6px; border-radius: 5px;
    border: 1px solid currentColor; opacity: .6; font-weight: 500;
}

/* ================= TOP BAR ================= */
.top {
    position: fixed; inset: 0 0 auto; z-index: 40; height: var(--top-h);
    display: flex; align-items: center; gap: 16px; padding: 0 max(var(--gutter), env(safe-area-inset-left)) 0 max(var(--gutter), env(safe-area-inset-left));
    transition: background .4s var(--ease), border-color .4s var(--ease), backdrop-filter .4s;
    border-bottom: 1px solid transparent;
}
.is-scrolled .top { background: var(--glass); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); border-bottom-color: var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 6px 4px; border-radius: 8px; }
.brand img { width: 18px; height: auto; opacity: .92; }
.brand-name { font-weight: 500; font-size: 14px; letter-spacing: .02em; }
.top-title {
    position: absolute; left: 50%; transform: translate(-50%, 6px); opacity: 0; pointer-events: none;
    font-family: var(--serif); font-size: 19px; font-style: italic; color: var(--ink-2);
    transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.is-scrolled .top-title { opacity: 1; transform: translate(-50%, 0); }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#theme-btn .i-light { display: none; }
:root[data-theme="light"] #theme-btn .i-dark { display: none; }
:root[data-theme="light"] #theme-btn .i-light { display: block; }

/* ================= HERO ================= */
.hero {
    position: relative; min-height: min(100svh, 940px); display: grid; place-items: center; text-align: center;
    padding: calc(var(--top-h) + 64px) var(--gutter) 120px; overflow: hidden; isolation: isolate;
}
.hero-backdrop {
    position: absolute; inset: -10%; z-index: -2; background-size: cover; background-position: center top;
    filter: blur(70px) saturate(1.2); opacity: .16; transform: scale(1.1);
    transition: opacity 1.2s var(--ease);
}
:root[data-theme="light"] .hero-backdrop { opacity: .14; }
.hero::after {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: radial-gradient(ellipse 80% 70% at 50% 40%, transparent 30%, var(--bg) 80%), linear-gradient(to bottom, transparent 60%, var(--bg));
}
.hero-beam {
    position: absolute; left: 50%; top: -30%; width: 150vmax; height: 120%; transform: translateX(-50%); z-index: -1; pointer-events: none;
    background:
        radial-gradient(ellipse 36% 55% at 50% 0%, rgba(240, 217, 166, .17), transparent 72%),
        conic-gradient(from 180deg at 50% 0%, transparent 162deg, rgba(240, 217, 166, .055) 171deg, transparent 175deg, rgba(240, 217, 166, .045) 182deg, transparent 186deg, rgba(240, 217, 166, .05) 193deg, transparent 198deg);
    -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 85%); mask-image: linear-gradient(to bottom, #000 30%, transparent 85%);
    animation: flicker 7s ease-in-out infinite;
}
:root[data-theme="light"] .hero-beam {
    background: radial-gradient(ellipse 40% 55% at 50% 0%, rgba(255, 255, 255, .85), transparent 72%);
}
@keyframes flicker { 0%, 100% { opacity: 1; } 45% { opacity: .82; } 52% { opacity: .95; } 70% { opacity: .88; } }
.hero-inner { max-width: 900px; animation: rise 1.4s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.eyebrow {
    display: inline-flex; gap: 10px; align-items: center; font-size: 11.5px; letter-spacing: .34em; text-transform: uppercase;
    color: var(--accent); font-weight: 500;
}
.eyebrow::before, .eyebrow::after { content: ""; width: 34px; height: 1px; background: var(--accent-line); }
.hero-title {
    margin-top: 26px; font-family: var(--serif); font-weight: 300; font-size: clamp(46px, 9vw, 112px);
    line-height: .98; letter-spacing: -.012em;
}
.hero-title span { display: block; font-size: .5em; font-style: italic; color: var(--ink-2); letter-spacing: 0; margin-bottom: .18em; }
.hero-title em {
    font-style: normal; font-weight: 400;
    background: linear-gradient(180deg, var(--ink) 30%, var(--accent-2) 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
:root[data-theme="light"] .hero-title em { background: linear-gradient(180deg, var(--ink) 40%, var(--accent) 100%); -webkit-background-clip: text; background-clip: text; }
.hero-lead { max-width: 600px; margin: 28px auto 0; color: var(--ink-2); font-size: clamp(15px, 1.6vw, 17.5px); line-height: 1.75; font-weight: 300; }

.stats { display: flex; justify-content: center; margin: 48px auto 0; padding: 0; }
.stats:empty { display: none; }
.stat { display: flex; flex-direction: column-reverse; padding: 2px 30px; border-left: 1px solid var(--line-2); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat dd { margin: 0; font-family: var(--serif); font-size: clamp(30px, 3.4vw, 42px); font-weight: 400; line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; color: var(--ink); }
.stat .stat-date { font-size: .78em; letter-spacing: .02em; }
.stat dt { margin-top: 6px; font-size: 10.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.hero-actions { margin-top: 46px; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

.scroll-cue {
    position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    font-size: 10.5px; letter-spacing: .3em; text-transform: uppercase; color: var(--ink-3); text-decoration: none;
}
.scroll-cue i { width: 1px; height: 46px; background: linear-gradient(var(--ink-3), transparent); position: relative; overflow: hidden; }
.scroll-cue i::after { content: ""; position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--accent); animation: drip 2.4s var(--ease-io) infinite; }
@keyframes drip { to { top: 110%; } }

/* ================= TOOLBAR ================= */
.bar {
    position: sticky; top: var(--top-h); z-index: 30;
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
    background: var(--glass); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
}
.bar-inner { max-width: var(--max); margin: 0 auto; padding: 10px var(--gutter); display: flex; align-items: center; gap: 16px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; padding: 2px; margin: -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: none; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 999px;
    border: 1px solid var(--line); background: transparent; color: var(--ink-2); cursor: pointer; font-size: 13px;
    transition: all .25s var(--ease);
}
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip.is-on { border-color: var(--accent-line); color: var(--ink); background: var(--accent-soft); }
.chip-n { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip.is-on .chip-n { color: var(--accent); }
.chip-draft { border-style: dashed; }
.bar-end { display: flex; align-items: center; gap: 6px; flex: none; }
.bar-count { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; letter-spacing: .02em; }

/* ================= STAGE + RAIL ================= */
.stage {
    max-width: var(--max); margin: 0 auto; padding: 90px var(--gutter) 40px;
    display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 24px;
}
.tl-area { min-width: 0; outline: none; }
.rail { position: sticky; top: calc(var(--top-h) + 90px); align-self: start; }
.rail-label { font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--ink-4); margin-bottom: 14px; }
.rail ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.rail button {
    position: relative; display: flex; align-items: baseline; gap: 8px; width: 100%; padding: 7px 0 7px 16px;
    border: 0; background: none; cursor: pointer; text-align: left; color: var(--ink-3);
    transition: color .3s var(--ease);
}
.rail button::before {
    content: ""; position: absolute; left: -1px; top: 50%; width: 1px; height: 0; background: var(--accent);
    transform: translateY(-50%); transition: height .4s var(--ease); box-shadow: 0 0 10px var(--accent);
}
.rail button:hover { color: var(--ink); }
.rail button.is-on { color: var(--ink); }
.rail button.is-on::before { height: 70%; }
.rail-y { font-family: var(--serif); font-size: 21px; font-variant-numeric: lining-nums; line-height: 1.2; }
.rail-n { font-size: 10.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.rail button.is-on .rail-n { color: var(--accent); }

.year-fab {
    position: fixed; left: max(14px, env(safe-area-inset-left)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 35;
    display: none; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px;
    border: 1px solid var(--line-2); background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    color: var(--ink); cursor: pointer; font-family: var(--serif); font-size: 19px; font-variant-numeric: lining-nums;
    opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .3s, transform .3s var(--ease);
}
.year-fab .i { width: 14px; height: 14px; color: var(--ink-3); }
.year-fab.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.year-pop {
    position: fixed; left: max(14px, env(safe-area-inset-left)); bottom: 68px; z-index: 36; min-width: 160px;
    padding: 10px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--panel); box-shadow: var(--shadow-pop);
}
.year-pop p { font-size: 10px; letter-spacing: .26em; text-transform: uppercase; color: var(--ink-3); padding: 4px 8px 8px; }
.year-pop button {
    display: flex; justify-content: space-between; align-items: baseline; width: 100%; padding: 8px; border: 0; border-radius: 10px;
    background: none; cursor: pointer; font-family: var(--serif); font-size: 20px; color: var(--ink);
}
.year-pop button:hover { background: var(--hover); }
.year-pop button span { font-family: var(--sans); font-size: 11px; color: var(--ink-3); }

/* ================= TIMELINE ================= */
.tl { --lit: 0; position: relative; list-style: none; margin: 0; padding: 0; }
.tl::before, .tl::after {
    content: ""; position: absolute; left: 50%; top: 0; width: 1px; transform: translateX(-.5px); pointer-events: none;
}
.tl::before { bottom: 0; background: linear-gradient(to bottom, transparent, var(--line-2) 120px, var(--line-2) calc(100% - 160px), transparent); }
.tl::after {
    height: calc(var(--lit) * 100%);
    background: linear-gradient(to bottom, transparent, var(--accent) 140px);
    box-shadow: 0 0 12px 1px rgba(216, 184, 120, .45);
    transition: height .15s linear;
}
:root[data-theme="light"] .tl::after { box-shadow: none; }

/* Year markers */
.y { position: relative; display: flex; justify-content: center; margin: 10px 0 90px; }
.y-num {
    position: relative; padding: 0 .25em; background: var(--bg);
    font-family: var(--serif); font-weight: 300; font-size: clamp(76px, 12vw, 170px); line-height: .9;
    font-variant-numeric: lining-nums; letter-spacing: .02em;
    color: transparent; -webkit-text-stroke: 1px var(--year-stroke);
    transition: -webkit-text-stroke-color 1.4s var(--ease), color 1.4s var(--ease), opacity 1.2s var(--ease), transform 1.2s var(--ease);
    opacity: 0; transform: translateY(24px);
}
.y.is-in .y-num { opacity: 1; transform: none; -webkit-text-stroke-color: var(--accent-line); }
@supports not (-webkit-text-stroke: 1px black) { .y-num { color: var(--line-2); } }

/* Milestone rows */
.m {
    position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1fr);
    align-items: start; margin: 0 0 150px;
}
.m[data-side="l"] .m-card { grid-column: 1; grid-row: 1; }
.m[data-side="l"] .m-date { grid-column: 3; grid-row: 1; text-align: left; }
.m[data-side="r"] .m-card { grid-column: 3; grid-row: 1; }
.m[data-side="r"] .m-date { grid-column: 1; grid-row: 1; text-align: right; align-items: flex-end; }
.m-node { grid-column: 2; grid-row: 1; display: flex; justify-content: center; padding-top: 46px; position: sticky; top: calc(var(--top-h) + 84px); z-index: 2; }
.m-node span {
    width: 13px; height: 13px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg);
    transition: background .8s var(--ease), border-color .8s var(--ease), box-shadow .8s var(--ease), transform .8s var(--ease);
}
.m.is-in .m-node span { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft), 0 0 26px rgba(216, 184, 120, .6); }

/* Date column — stays beside the card while it scrolls past. */
.m-date {
    position: sticky; top: calc(var(--top-h) + 84px); padding-top: 22px; display: flex; flex-direction: column; align-items: flex-start;
    opacity: 0; transform: translateY(20px); transition: opacity 1s var(--ease) .1s, transform 1s var(--ease) .1s;
}
.m.is-in .m-date { opacity: 1; transform: none; }
.m-date time { display: flex; flex-direction: column; align-items: inherit; }
.d-day { font-family: var(--serif); font-weight: 300; font-size: clamp(64px, 6.4vw, 96px); line-height: .86; font-variant-numeric: lining-nums; color: var(--ink); }
.d-month { margin-top: 14px; font-size: 11.5px; letter-spacing: .3em; text-transform: uppercase; color: var(--accent); font-weight: 500; }
.d-year { margin-top: 6px; font-size: 12.5px; letter-spacing: .22em; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.d-label {
    margin-top: 18px; display: inline-block; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--accent-line);
    color: var(--accent); font-size: 11px; letter-spacing: .14em; font-weight: 500;
}
.d-now { margin-top: 14px; display: inline-flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); }
.d-now i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-red); box-shadow: 0 0 0 0 rgba(233, 32, 71, .6); animation: pulse 2.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(233, 32, 71, .55); } 70% { box-shadow: 0 0 0 10px rgba(233, 32, 71, 0); } 100% { box-shadow: 0 0 0 0 rgba(233, 32, 71, 0); } }

/* Card */
.m-card {
    position: relative; min-width: 0;
    opacity: 0; transform: translateY(46px); transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
}
.m.is-in .m-card { opacity: 1; transform: none; }

.m-media {
    position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; text-align: left;
    border-radius: 14px; isolation: isolate;
}
.m-media .ambient {
    position: absolute; inset: 10% 4% -6%; z-index: -1; border-radius: 30px;
    background-size: cover; background-position: center top; filter: blur(46px) saturate(1.35);
    opacity: 0; transform: scale(.94); transition: opacity 1.6s var(--ease), transform 1.6s var(--ease);
}
.m.is-in .m-media .ambient { opacity: var(--ambient); transform: none; }
.screen { position: relative; display: block; border-radius: 12px; overflow: hidden; background: var(--screen); box-shadow: var(--shadow-screen); }
.chrome {
    display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; background: var(--chrome);
    border-bottom: 1px solid var(--line);
}
.chrome i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.chrome .url {
    margin: 0 auto; transform: translateX(-14px); padding: 1px 14px; border-radius: 6px; background: var(--hover);
    font-size: 10.5px; letter-spacing: .04em; color: var(--ink-3);
}
.shot { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--panel); }
.shot img {
    display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0;
    filter: var(--dim); transition: filter 1.4s var(--ease), object-position var(--pan, 6s) cubic-bezier(.45, .05, .4, 1), transform 1.2s var(--ease);
}
.m.is-in .shot img { filter: none; }
.m-media.can-pan:hover .shot img, .m-media.can-pan:focus-visible .shot img { object-position: 50% 100%; }
.m-media:not(.can-pan):hover .shot img { transform: scale(1.015); }
.m-media.is-mobile { display: grid; place-items: center; padding: 18px 0; }
.m-media.is-mobile .ambient { inset: 0 10%; }
.m-media.is-mobile .screen { width: min(270px, 62%); border-radius: 30px; border: 5px solid #1b1b20; box-shadow: var(--shadow-screen), 0 0 0 1px var(--line-2); }
:root[data-theme="light"] .m-media.is-mobile .screen { border-color: #2a2824; }
.m-media.is-mobile .shot { aspect-ratio: 9 / 19.5; border-radius: 25px; }
.m-media.is-empty {
    display: grid; place-items: center; gap: 10px; aspect-ratio: 16 / 10; cursor: default; border: 1px dashed var(--line-2);
    color: var(--ink-4); font-size: 13px; border-radius: 12px; align-content: center;
}
.m-media.is-empty .i { width: 30px; height: 30px; stroke-width: 1.2; }

.m-badge, .m-pins {
    position: absolute; top: 40px; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
    font-size: 11px; font-weight: 500; letter-spacing: .06em; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.m-badge { left: 12px; background: rgba(10, 10, 12, .78); color: var(--accent-2); border: 1px dashed var(--accent-line); }
.m-pins { right: 12px; background: rgba(10, 10, 12, .7); color: #efe9dd; }
.m-media.is-mobile .m-badge, .m-media.is-mobile .m-pins { top: 12px; }
.m-badge .i, .m-pins .i { width: 13px; height: 13px; }

.m-tools {
    position: absolute; top: -18px; right: 10px; z-index: 3; display: flex; gap: 4px; padding: 4px; border-radius: 999px;
    background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
    opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s var(--ease);
}
.m-card:hover .m-tools, .m-card:focus-within .m-tools { opacity: 1; transform: none; }
@media (hover: none) { .m-tools { opacity: 1; transform: none; } }
.m-tools .icon-btn { width: 34px; height: 34px; }
.m-tools .icon-btn .i { width: 16px; height: 16px; }

.m.is-draft .screen { outline: 1px dashed var(--accent-line); outline-offset: 6px; }
.m.is-draft .m-title, .m.is-draft .m-text { opacity: .82; }

.m-body { padding: 30px 4px 0; }
.m-tags { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 12px; }
.tag { font-size: 10.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-3); display: inline-flex; align-items: center; gap: 7px; }
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-4); }
.tag-redesign::before { background: var(--accent); }
.tag-feature::before { background: #7fb6ff; }
.tag-content::before { background: #b9a3ff; }
.tag-fix::before { background: var(--good); }
:root[data-theme="light"] .tag-feature::before { background: #2f6fd0; }
:root[data-theme="light"] .tag-content::before { background: #7356d6; }
.m-title { font-family: var(--serif); font-weight: 500; font-size: clamp(27px, 2.7vw, 36px); line-height: 1.12; letter-spacing: -.005em; color: var(--ink); text-wrap: balance; }
.m-text { margin-top: 14px; color: var(--ink-2); font-size: 15.5px; line-height: 1.78; font-weight: 300; }
.m-text p + p { margin-top: .85em; }
.m-text:empty { display: none; }

.m-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.m-strip button {
    width: 70px; height: 46px; padding: 0; border-radius: 7px; overflow: hidden; border: 1px solid var(--line-2); background: var(--panel);
    cursor: zoom-in; opacity: .78; transition: opacity .25s, border-color .25s, transform .25s var(--ease);
}
.m-strip button:hover { opacity: 1; border-color: var(--accent-line); transform: translateY(-2px); }
.m-strip img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; display: block; }
.m-strip img.is-mobile { object-position: 50% 8%; }
.m-strip .m-more { display: grid; place-items: center; font-size: 13px; color: var(--ink-2); cursor: pointer; }

.m-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 20px; font-size: 12.5px; color: var(--ink-3); }
.m-foot > span, .m-link { display: inline-flex; align-items: center; gap: 7px; }
.m-foot .i { width: 14px; height: 14px; }
.m-link { border: 0; background: none; padding: 4px 0; color: var(--ink-3); cursor: pointer; font-size: 12.5px; transition: color .2s; }
.m-link:hover { color: var(--accent); }

.m.is-flash .screen { animation: flash 2.4s var(--ease); }
@keyframes flash { 0%, 100% { box-shadow: var(--shadow-screen); } 25% { box-shadow: var(--shadow-screen), 0 0 0 2px var(--accent), 0 0 60px rgba(216, 184, 120, .5); } }

/* End of the line */
.tl-end { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px 0 30px; opacity: 0; transition: opacity 1.4s var(--ease); }
.tl-end.is-in { opacity: 1; }
.tl-end.is-top { padding: 0 0 110px; }
.end-node { width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--accent-line); background: var(--bg); position: relative; }
.end-node::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); opacity: .5; animation: pulse-soft 3s ease-in-out infinite; }
@keyframes pulse-soft { 50% { opacity: .15; } }
.end-title { margin-top: 22px; font-family: var(--serif); font-style: italic; font-size: 30px; color: var(--ink-2); background: var(--bg); padding: 0 12px; }
.end-date { margin-top: 6px; font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-4); background: var(--bg); padding: 0 12px; }

/* Empty / error */
.tl-state { padding: 40px 0 120px; }
.empty { max-width: 460px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty > .i { width: 40px; height: 40px; stroke-width: 1.1; color: var(--accent); }
.empty h2 { font-family: var(--serif); font-weight: 400; font-size: 32px; }
.empty p { color: var(--ink-3); }
.empty .btn { margin-top: 8px; }

/* Skeleton */
.m-skel .m-card, .m-skel .m-date { opacity: 1; transform: none; }
.sk { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--hover), var(--line), var(--hover)); background-size: 200% 100%; animation: shimmer 1.6s infinite; }
.sk-media { aspect-ratio: 16 / 10; border-radius: 12px; }
.sk-title { height: 30px; width: 70%; margin-top: 30px; }
.sk-line { height: 12px; width: 90%; margin-top: 14px; }
.sk-line.short { width: 50%; }
.sk-day { width: 80px; height: 70px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ================= FOOTER ================= */
.foot { position: relative; text-align: center; padding: 70px var(--gutter) calc(110px + env(safe-area-inset-bottom)); color: var(--ink-3); font-size: 13px; }
.foot-line { width: 1px; height: 60px; margin: 0 auto 30px; background: linear-gradient(var(--line-2), transparent); }
.foot-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 22px; color: var(--ink); }
.foot-links { margin-top: 18px; display: flex; justify-content: center; gap: 8px 26px; flex-wrap: wrap; }
.foot-links a, .foot-links button {
    display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--ink-3); text-decoration: none;
    font-size: 13px; cursor: pointer; padding: 6px 2px; transition: color .2s;
}
.foot-links a:hover, .foot-links button:hover { color: var(--ink); }
.foot-links .i { width: 15px; height: 15px; }
.foot-copy { margin-top: 18px; font-size: 11.5px; letter-spacing: .1em; color: var(--ink-4); }

/* ================= ADMIN BAR ================= */
.adminbar {
    position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 45;
    display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 999px; max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none;
    background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
    animation: ab-rise .6s var(--ease) both;
}
@keyframes ab-rise { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
.adminbar::-webkit-scrollbar { display: none; }
.ab-badge { display: inline-flex; align-items: center; gap: 8px; padding: 0 12px 0 10px; font-size: 10.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.ab-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.ab-btn {
    position: relative; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border: 0; border-radius: 999px;
    background: none; color: var(--ink-2); cursor: pointer; font-size: 13px; white-space: nowrap; transition: background .2s, color .2s;
}
.ab-btn:hover { background: var(--hover); color: var(--ink); }
.ab-btn .i { width: 16px; height: 16px; }
.ab-primary { background: var(--accent); color: var(--accent-ink); }
.ab-primary:hover { background: var(--accent-2); color: var(--accent-ink); }
.ab-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.ab-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--hover); font-size: 10.5px; display: inline-grid; place-items: center; font-weight: 600; }
.is-preview .adminbar .ab-btn:not([data-admin="preview"]):not(.ab-primary), .is-preview .adminbar .ab-primary { display: none; }

.dropveil {
    position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: var(--veil); backdrop-filter: blur(6px);
    pointer-events: none;
}
.dropveil > div { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 46px 60px; border: 1px dashed var(--accent); border-radius: 26px; color: var(--ink); font-family: var(--serif); font-size: 26px; }
.dropveil .i { width: 40px; height: 40px; color: var(--accent); stroke-width: 1.2; }

/* ================= TOASTS ================= */
.toasts { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 24px); pointer-events: none; }
.toast {
    display: flex; align-items: center; gap: 10px; padding: 11px 16px 11px 14px; border-radius: 14px; pointer-events: auto;
    background: var(--ink); color: var(--bg); font-size: 13.5px; box-shadow: var(--shadow-pop);
    opacity: 0; transform: translateY(12px) scale(.98); transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.toast.is-in { opacity: 1; transform: none; }
.toast .i { width: 16px; height: 16px; color: var(--accent); }
:root[data-theme="dark"] .toast .i { color: #8a6a32; }
.toast.is-error .i { color: var(--red); }
:root[data-theme="dark"] .toast.is-error .i { color: #c4163a; }
.toast button { margin-left: 6px; border: 0; background: none; color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13px; }

/* ================= DIALOGS (shared) ================= */
dialog { color: var(--ink); }
dialog::backdrop { background: rgba(3, 3, 5, .72); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
:root[data-theme="light"] dialog::backdrop { background: rgba(40, 32, 18, .35); }

.modal {
    width: min(430px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 30px 28px 24px; border-radius: 22px;
    border: 1px solid var(--line-2); background: var(--panel); box-shadow: var(--shadow-pop); overflow: auto;
}
.modal[open] { animation: pop .35s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-wide { width: min(620px, calc(100vw - 32px)); }
.modal-mark { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--accent-line); color: var(--accent); background: var(--accent-soft); margin-bottom: 18px; }
.modal-mark .i { width: 20px; height: 20px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -6px -8px 0 0; }
.modal-title { font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.15; }
.modal-text { margin-top: 10px; color: var(--ink-2); font-size: 14.5px; line-height: 1.65; }
.confirm-text { margin-top: 0; font-size: 16px; color: var(--ink); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 26px; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 7px; margin-top: 18px; font-size: 12.5px; color: var(--ink-2); letter-spacing: .02em; }
.field > span:first-child { font-weight: 500; }
.field input, .field textarea {
    width: 100%; border-radius: 12px; border: 1px solid var(--field-border); background: var(--field); color: var(--ink);
    font: inherit; font-size: 15px; padding: 11px 14px; letter-spacing: 0; transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-hint { color: var(--ink-3); font-size: 12px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 46px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-3); cursor: pointer; border-radius: 10px; }
.pw-eye:hover { color: var(--ink); }
.form-msg { margin-top: 14px; display: flex; gap: 8px; align-items: flex-start; color: var(--red); font-size: 13.5px; line-height: 1.5; }

/* Trash list */
.trash-list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.trash-list li { display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; align-items: center; padding: 10px; border-radius: 14px; border: 1px solid var(--line); }
.trash-thumb { width: 76px; height: 48px; border-radius: 8px; overflow: hidden; background: var(--panel-2); display: grid; place-items: center; color: var(--ink-4); }
.trash-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.trash-meta { min-width: 0; }
.trash-meta b { display: block; font-family: var(--serif); font-size: 19px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trash-meta span { font-size: 12px; color: var(--ink-3); }
.trash-acts { display: flex; gap: 2px; }
.trash-empty { padding: 30px 0 10px; text-align: center; color: var(--ink-3); }

/* ================= EDITOR DRAWER ================= */
.drawer {
    margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(600px, 100vw); max-width: 100vw; padding: 0;
    border: 0; border-left: 1px solid var(--line-2); background: var(--panel); box-shadow: var(--shadow-pop);
}
.drawer[open] { animation: slide-in .45s var(--ease); }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer form { display: flex; flex-direction: column; height: 100%; }
.ed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 14px 28px; border-bottom: 1px solid var(--line); }
.ed-head h2 { font-family: var(--serif); font-weight: 500; font-size: 28px; }
.ed-body { flex: 1; overflow-y: auto; padding: 6px 28px 30px; overscroll-behavior: contain; }
.ed-row { display: grid; gap: 12px; }
.ed-row-3 { grid-template-columns: 1.25fr 1fr 1fr; }
.ed-datehint { margin-top: 10px; font-size: 12.5px; color: var(--accent); display: flex; gap: 8px; align-items: center; }
.ed-datehint .i { width: 14px; height: 14px; }
.ed-lang { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ed-lang-label { font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-3); }
.seg-sm button { font-size: 12px; letter-spacing: .02em; padding: 6px 12px; font-weight: 500; }
.seg .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
.ed-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.ed-tags button {
    display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font-size: 13px; transition: all .2s;
}
.ed-tags button[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.ed-tags button .i { width: 14px; height: 14px; opacity: 0; margin-left: -4px; transition: opacity .2s; }
.ed-tags button[aria-pressed="true"] .i { opacity: 1; color: var(--accent); }
.ed-count { color: var(--ink-3); font-weight: 400; }

.drop {
    display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 96px; padding: 18px; border-radius: 16px; text-align: center;
    border: 1px dashed var(--line-2); background: var(--field); color: var(--ink-3); cursor: pointer; font-size: 13.5px; line-height: 1.5;
    transition: border-color .2s, background .2s, color .2s;
}
.drop:hover, .drop.is-over { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.drop .i { width: 24px; height: 24px; color: var(--accent); stroke-width: 1.4; }

.ed-images { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.ed-img { position: relative; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2); overflow: hidden; transition: border-color .2s, opacity .2s, transform .2s; }
.ed-img.is-cover { border-color: var(--accent-line); }
.ed-img.is-dragging { opacity: .4; }
.ed-img.is-target { border-color: var(--accent); transform: scale(1.02); }
.ed-thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--panel-2); cursor: grab; }
.ed-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; display: block; pointer-events: none; }
.ed-img.is-mobile .ed-thumb img { object-fit: contain; background: #000; }
.ed-cover-badge { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; }
.ed-cover-badge .i { width: 12px; height: 12px; fill: currentColor; }
.ed-progress { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; }
.ed-progress::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p, 0%); background: var(--accent); transition: width .2s; }
.ed-progress.is-error { background: rgba(120, 10, 30, .75); padding: 10px; text-align: center; line-height: 1.4; }
.ed-img-acts { display: flex; justify-content: space-between; padding: 4px; border-top: 1px solid var(--line); }
.ed-img-acts .icon-btn { width: 32px; height: 32px; }
.ed-img-acts .icon-btn .i { width: 15px; height: 15px; }
.ed-img-acts .icon-btn.is-on { color: var(--accent); }
.ed-img-acts .icon-btn.is-on .i { fill: currentColor; }
.ed-img-acts .notes-n { font-size: 10px; margin-left: -4px; }
.ed-img input { width: 100%; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-size: 12.5px; padding: 9px 10px; }
.ed-img input:focus { outline: none; background: var(--accent-soft); }

.ed-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)) 28px; border-top: 1px solid var(--line); background: var(--panel); }
.ed-msg { margin-right: auto; font-size: 12.5px; color: var(--ink-3); }
.ed-msg.is-error { color: var(--red); }
#ed-save kbd { margin-left: 4px; border-color: currentColor; }

/* ================= VIEWER ================= */
.viewer {
    width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; padding: 0; border: 0;
    background: rgba(5, 5, 7, .97); color: #efe9dd; overflow: hidden;
}
:root[data-theme="light"] .viewer { background: rgba(22, 20, 17, .97); }
.viewer::backdrop { background: transparent; }
.viewer[open] { animation: fade .3s var(--ease); display: block; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.viewer .icon-btn { color: rgba(239, 233, 221, .75); }
.viewer .icon-btn:hover { background: rgba(239, 233, 221, .08); color: #fff; }
.viewer .icon-btn[aria-pressed="true"] { color: #d8b878; border-color: rgba(216, 184, 120, .4); background: rgba(216, 184, 120, .12); }
.v-top {
    position: absolute; inset: 0 0 auto; z-index: 5; height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 12px 0 22px;
    background: linear-gradient(rgba(5, 5, 7, .9), rgba(5, 5, 7, 0));
}
.v-meta { min-width: 0; display: flex; align-items: baseline; gap: 14px; }
.v-date { flex: none; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: #d8b878; }
.v-title { min-width: 0; font-family: var(--serif); font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; flex: none; }
.v-count { font-size: 12px; color: rgba(239, 233, 221, .55); margin-right: 10px; font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.v-sep { width: 1px; height: 20px; background: rgba(239, 233, 221, .14); margin: 0 6px; }
.v-zoom { min-width: 56px; height: 32px; border: 0; border-radius: 8px; background: none; color: rgba(239, 233, 221, .8); font-size: 12px; cursor: pointer; font-variant-numeric: tabular-nums; }
.v-zoom:hover { background: rgba(239, 233, 221, .08); }
.v-notes-btn { width: auto; padding: 0 10px; gap: 6px; display: inline-flex; border-radius: 999px; }
.v-notes-btn b { font-size: 12px; font-weight: 500; }
.v-notes-btn b:empty { display: none; }

.v-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.v-stage.is-dragging { cursor: grabbing; }
.viewer.is-adding .v-stage { cursor: crosshair; }
.v-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.v-canvas img { position: absolute; left: 0; top: 0; width: 100%; display: block; user-select: none; -webkit-user-drag: none; box-shadow: 0 40px 120px -30px #000; }
.v-ph { filter: blur(0); opacity: .9; }
.v-img { opacity: 0; transition: opacity .35s var(--ease); }
.v-img.is-ready { opacity: 1; }
.v-spin { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px; border-radius: 50%; border: 2px solid rgba(239, 233, 221, .15); border-top-color: #d8b878; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.v-hint { position: absolute; left: 50%; top: 76px; transform: translateX(-50%); z-index: 6; padding: 8px 16px; border-radius: 999px; background: rgba(216, 184, 120, .16); border: 1px solid rgba(216, 184, 120, .4); color: #f0d9a6; font-size: 12.5px; white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }

.v-nav {
    position: absolute; top: 50%; z-index: 5; width: 52px; height: 52px; margin-top: -26px; border-radius: 50%; display: grid; place-items: center;
    border: 1px solid rgba(239, 233, 221, .14); background: rgba(10, 10, 12, .55); color: #efe9dd; cursor: pointer;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background .2s, opacity .2s;
}
.v-nav:hover { background: rgba(30, 30, 34, .8); }
.v-nav:disabled { opacity: 0; pointer-events: none; }
.v-prev { left: 18px; }
.v-next { right: 18px; }
.v-bottom {
    position: absolute; inset: auto 0 0; z-index: 5; padding: 40px 20px calc(16px + env(safe-area-inset-bottom));
    background: linear-gradient(rgba(5, 5, 7, 0), rgba(5, 5, 7, .92) 45%); display: flex; flex-direction: column; align-items: center; gap: 12px;
    pointer-events: none;
}
.v-bottom > * { pointer-events: auto; }
.v-caption { font-size: 14px; color: rgba(239, 233, 221, .82); text-align: center; max-width: 760px; }
.v-caption:empty { display: none; }
.v-strip { display: flex; gap: 6px; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 3px; }
.v-strip::-webkit-scrollbar { display: none; }
.v-strip button { flex: none; width: 64px; height: 42px; padding: 0; border-radius: 6px; overflow: hidden; border: 1px solid rgba(239, 233, 221, .14); background: #111; opacity: .5; cursor: pointer; transition: opacity .2s, border-color .2s; }
.v-strip button:hover { opacity: .85; }
.v-strip button.is-on { opacity: 1; border-color: #d8b878; }
.v-strip img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; display: block; }

/* Pins (C7) — positioned in image space, counter-scaled so they keep their size at any zoom. */
.v-pins { position: absolute; inset: 0; }
.pin {
    position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; padding: 0; cursor: pointer;
    border: 2px solid #fff; background: #d8b878; color: #1b1508; font-size: 12.5px; font-weight: 700; font-family: var(--sans);
    display: grid; place-items: center; transform: scale(var(--inv, 1)); transform-origin: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .55);
}
.pin::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid rgba(216, 184, 120, .7); animation: ring 2.4s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
.pin.is-active { background: #fff; border-color: #d8b878; }
.pins-off .v-pins { display: none; }
.viewer.is-adding .pin { cursor: move; }

.v-notes {
    position: absolute; right: 16px; top: 76px; bottom: 140px; z-index: 6; width: 300px; overflow-y: auto; padding: 18px 18px 10px;
    border-radius: 18px; border: 1px solid rgba(239, 233, 221, .12); background: rgba(14, 14, 17, .86);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.v-notes h3 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin-bottom: 10px; }
.v-notes ol { list-style: none; margin: 0; padding: 0; }
.v-notes li button { display: grid; grid-template-columns: 24px 1fr; gap: 10px; width: 100%; text-align: left; padding: 10px 6px; border: 0; border-top: 1px solid rgba(239, 233, 221, .08); background: none; color: rgba(239, 233, 221, .86); cursor: pointer; font-size: 13.5px; line-height: 1.55; border-radius: 8px; }
.v-notes li:first-child button { border-top: 0; }
.v-notes li button:hover, .v-notes li button.is-active { background: rgba(216, 184, 120, .1); }
.v-notes li b { width: 22px; height: 22px; border-radius: 50%; background: #d8b878; color: #1b1508; font-size: 11px; display: grid; place-items: center; }
.v-notes .v-empty { color: rgba(239, 233, 221, .5); font-size: 13px; padding: 6px 0; }

.v-pop {
    position: absolute; z-index: 8; width: min(300px, calc(100vw - 24px)); padding: 14px 16px; border-radius: 14px;
    background: #f5efe2; color: #1b1810; box-shadow: 0 20px 50px rgba(0, 0, 0, .6); font-size: 14px; line-height: 1.55;
}
.v-pop p { white-space: pre-wrap; }
.v-pop label { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #7a6a4c; margin: 8px 0 4px; }
.v-pop label:first-child { margin-top: 0; }
.v-pop textarea { width: 100%; min-height: 64px; resize: vertical; border-radius: 10px; border: 1px solid rgba(27, 24, 16, .2); padding: 8px 10px; font: inherit; font-size: 13.5px; background: #fff; color: #1b1810; }
.v-pop textarea:focus { outline: none; border-color: #8a6a32; box-shadow: 0 0 0 3px rgba(138, 106, 50, .18); }
.v-pop-acts { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.v-pop-acts button { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(27, 24, 16, .2); background: none; font-size: 12.5px; cursor: pointer; color: #1b1810; }
.v-pop-acts .is-primary { background: #1b1810; border-color: #1b1810; color: #f5efe2; }
.v-pop-acts .is-danger { color: #b0132f; border-color: transparent; margin-right: auto; }

/* ================= TIME-LAPSE ================= */
.tlapse {
    width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; padding: 0; border: 0; overflow: hidden;
    background: #050506; color: #efe9dd;
}
.tlapse::backdrop { background: #000; }
.tlapse[open] { display: block; animation: fade .6s var(--ease); }
.tlapse .icon-btn { color: rgba(239, 233, 221, .8); }
.tlapse .icon-btn:hover { background: rgba(239, 233, 221, .08); color: #fff; }
.tp-ambient i { position: absolute; inset: -15%; background-size: cover; background-position: center top; filter: blur(90px) saturate(1.4) brightness(.7); opacity: 0; transition: opacity 1.8s var(--ease); }
.tp-ambient i.is-on { opacity: .2; }
.tlapse::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 70% 65% at 50% 40%, transparent 35%, rgba(0, 0, 0, .9)); z-index: 1; }
.tp-stage { position: absolute; inset: 64px 0 250px; z-index: 2; display: grid; place-items: center; }
.tp-slide {
    position: absolute; margin: 0; display: grid; place-items: center; opacity: 0; transition: opacity 1.4s var(--ease-io);
}
.tp-slide.is-on { opacity: 1; }
.tp-slide .screen { width: var(--w); box-shadow: 0 50px 140px -40px #000, 0 0 0 1px rgba(255, 255, 255, .08); background: #000; }
.tp-slide .chrome { background: #17171b; border-bottom-color: rgba(239, 233, 221, .08); }
.tp-slide .chrome i { background: rgba(239, 233, 221, .2); }
.tp-slide .chrome .url { color: rgba(239, 233, 221, .5); background: rgba(239, 233, 221, .06); }
.tp-slide .tp-shot { display: block; overflow: hidden; aspect-ratio: var(--ar); }
.tp-slide img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.tp-slide.is-on img { animation: kenburns var(--hold, 5s) linear both; }
.tp-slide.is-mobile .screen { border-radius: 34px; border: 6px solid #1b1b20; }
.tp-slide.is-mobile .tp-shot { border-radius: 28px; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.045) translateY(-1.2%); } }
.tp-caption {
    position: absolute; left: max(28px, 5vw); right: calc(max(28px, 5vw) + 250px); bottom: 122px; z-index: 3;
    display: flex; align-items: flex-end; gap: 30px; min-width: 0;
}
.tp-year {
    flex: none; font-family: var(--serif); font-weight: 300; font-size: clamp(66px, 8vw, 128px); line-height: .78;
    font-variant-numeric: lining-nums tabular-nums; letter-spacing: .01em;
    color: transparent; -webkit-text-stroke: 1px rgba(216, 184, 120, .7);
    background: linear-gradient(180deg, rgba(240, 217, 166, .22), rgba(240, 217, 166, 0)); -webkit-background-clip: text; background-clip: text;
}
.tp-text { min-width: 0; padding-bottom: 2px; }
.tp-text > * { transition: opacity .6s var(--ease), transform .6s var(--ease); }
.tp-caption.is-out .tp-text > * { opacity: 0; transform: translateY(10px); }
.tp-date { font-size: 11.5px; letter-spacing: .3em; text-transform: uppercase; color: #d8b878; }
.tp-title { margin-top: 8px; font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 2.8vw, 40px); line-height: 1.1; text-wrap: balance; }
.tp-label { margin-top: 8px; font-size: 12px; letter-spacing: .16em; color: rgba(239, 233, 221, .6); }
.tp-label:empty { display: none; }
.tp-axis { position: absolute; left: max(28px, 5vw); right: max(28px, 5vw); bottom: 64px; z-index: 3; }
.tp-track { position: relative; height: 20px; }
.tp-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(239, 233, 221, .16); }
.tp-fill { position: absolute; left: 0; top: 50%; height: 1px; width: 0; background: #d8b878; box-shadow: 0 0 10px #d8b878; transition: width 1.2s var(--ease-io); }
.tp-dot { position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; padding: 0; border: 1px solid rgba(239, 233, 221, .4); background: #050506; cursor: pointer; transition: all .5s var(--ease); }
.tp-dot::after { content: ""; position: absolute; inset: -8px; }
.tp-dot.is-past { background: #d8b878; border-color: #d8b878; }
.tp-dot.is-on { transform: scale(1.6); background: #f0d9a6; border-color: #fff; box-shadow: 0 0 16px #d8b878; }
.tp-ends { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; letter-spacing: .2em; color: rgba(239, 233, 221, .45); font-variant-numeric: tabular-nums; }
.tp-controls {
    position: absolute; right: max(20px, 4vw); bottom: 104px; z-index: 4; display: flex; align-items: center; gap: 4px; padding: 5px;
    border-radius: 999px; background: rgba(14, 14, 17, .7); border: 1px solid rgba(239, 233, 221, .1); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    transition: opacity .5s var(--ease);
}
.tlapse.is-idle .tp-controls, .tlapse.is-idle .v-top { opacity: 0; }
.tlapse.is-idle { cursor: none; }
.tp-play { width: 46px; height: 46px; border-radius: 50%; border: 0; background: #d8b878; color: #1b1508; display: grid; place-items: center; cursor: pointer; }
.tp-play .i { width: 18px; height: 18px; }
.tp-speed { min-width: 44px; height: 36px; border: 0; border-radius: 999px; background: none; color: rgba(239, 233, 221, .8); font-size: 12.5px; cursor: pointer; font-variant-numeric: tabular-nums; }
.tp-speed:hover { background: rgba(239, 233, 221, .08); }
.tp-end {
    position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; align-content: center; gap: 28px; text-align: center;
    background: rgba(5, 5, 6, .82); backdrop-filter: blur(8px); animation: fade .8s var(--ease);
}
.tp-end-title { font-family: var(--serif); font-style: italic; font-size: clamp(34px, 5vw, 60px); font-weight: 300; }
.tp-end-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.tp-end .btn { color: #efe9dd; }
.tp-end .btn-play { border-color: rgba(216, 184, 120, .4); }
.tp-end .btn-play-icon { background: #d8b878; color: #1b1508; }

/* ================= RESPONSIVE ================= */
@media (max-width: 1180px) {
    .stage { grid-template-columns: minmax(0, 1fr); }
    .rail { display: none; }
    .year-fab { display: inline-flex; }
}

@media (max-width: 900px) {
    .tl::before, .tl::after { left: 15px; }
    .m { grid-template-columns: 30px minmax(0, 1fr); margin-bottom: 96px; }
    .m[data-side] .m-card { grid-column: 2; grid-row: 2; }
    .m[data-side] .m-date {
        grid-column: 2; grid-row: 1; position: static; text-align: left; align-items: flex-start;
        flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 0 0 20px;
    }
    .m-date time { flex-direction: row; align-items: baseline; gap: 10px; }
    .d-day { font-size: 54px; }
    .d-month { margin-top: 0; }
    .d-year { margin-top: 0; }
    .d-label, .d-now { margin-top: 0; }
    .m-node { grid-column: 1; grid-row: 1; justify-content: flex-start; padding: 22px 0 0 9px; position: static; }
    .y { justify-content: flex-start; margin: 0 0 60px; }
    .y-num { padding: 0 .12em 0 0; margin-left: 0; font-size: clamp(72px, 22vw, 120px); }
    .tl-end { align-items: flex-start; text-align: left; padding-left: 8px; }
    .end-title, .end-date { padding-left: 0; }
    .stage { padding-top: 60px; }
    .ed-row-3 { grid-template-columns: 1fr 1fr; }
    .ed-row-3 .field:last-child { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
    :root { --top-h: 56px; }
    .brand-name { display: none; }
    .top-title { display: none; }
    .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 0; max-width: 360px; }
    .stat { padding: 2px 14px; }
    .stat:nth-child(3) { border-left: 0; }
    .hero { padding-bottom: 110px; }
    .bar-inner { padding: 8px var(--gutter); gap: 10px; }
    .bar-count { display: none; }
    #sort-label { display: none; }
    .m-text { font-size: 15px; }
    .m-media .ambient { inset: 12% 2% -4%; }
    .chrome { height: 22px; }
    .chrome .url { font-size: 9.5px; }
    .m-badge, .m-pins { top: 32px; }
    .adminbar { left: 12px; right: 12px; transform: none; animation-name: fade; }
    .ab-btn span { display: none; }
    .ab-btn { padding: 0 11px; }
    .ab-primary span { display: inline; }
    .modal { padding: 26px 20px 20px; }
    .ed-head { padding-left: 20px; }
    .ed-body { padding: 4px 20px 30px; }
    .ed-foot { padding-left: 20px; }
    .ed-foot .btn-ghost { display: none; }
    .ed-images { grid-template-columns: 1fr 1fr; }
    .v-title { display: none; }
    .v-top { padding-left: 16px; }
    .v-count { margin-right: 2px; }
    .v-nav { display: none; }
    .v-zoom { display: none; }
    .v-tools .icon-btn[data-v="zoomOut"], .v-tools .icon-btn[data-v="zoomIn"], .v-sep { display: none; }
    .v-notes { left: 12px; right: 12px; width: auto; top: auto; bottom: 130px; max-height: 40vh; }
    .tp-stage { inset: 60px 0 290px; }
    .tp-caption { left: 20px; right: 20px; bottom: 156px; gap: 16px; }
    .tp-year { font-size: 58px; }
    .tp-controls { left: 50%; right: auto; transform: translateX(-50%); bottom: 96px; }
    .tp-axis { left: 20px; right: 20px; bottom: 54px; }
    .trash-list li { grid-template-columns: 60px 1fr; }
    .trash-thumb { width: 60px; height: 40px; }
    .trash-acts { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
    .grain { animation: none; }
    .m-card, .m-date, .y-num { opacity: 1; transform: none; }
}
