:root {
    --bg: #07070a;
    --ink: #f4f0e8;             /* warm off-white, like a projected frame */
    --ink-2: #a19d96;
    --ink-3: #6b6862;
    --face: rgba(16, 16, 20, 0.82);
    --line: rgba(244, 240, 232, 0.09);
    --line-2: rgba(244, 240, 232, 0.16);
    --tally: #ff3b30;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* ---------- Atmosphere ---------- */

#space {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* vignette + film grain */
.grain {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 45%, transparent 35%, rgba(0, 0, 0, 0.7) 100%);
}

.grain::after {
    content: '';
    position: absolute;
    inset: -50%;
    opacity: 0.07;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grain 0.5s steps(5) infinite;
}

@keyframes grain {
    0%   { transform: translate(0, 0); }
    20%  { transform: translate(-6%, 4%); }
    40%  { transform: translate(5%, -7%); }
    60%  { transform: translate(-3%, -4%); }
    80%  { transform: translate(7%, 5%); }
    100% { transform: translate(0, 0); }
}

/* the opening shot: bars part like a shutter, settle as a subtle letterbox */
.letterbox span {
    position: fixed;
    left: 0;
    right: 0;
    height: 50vh;
    background: #000;
    z-index: 5;
    pointer-events: none;
    transition: transform 1.1s var(--ease-out);
}

.letterbox span:first-child { top: 0; transform-origin: top; }
.letterbox span:last-child  { bottom: 0; transform-origin: bottom; }

.ready .letterbox span { transform: scaleY(0.06); }

/* ---------- Stage & card ---------- */

.stage {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: max(28px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
    perspective: 1400px;
}

.tilt {
    width: 100%;
    max-width: 340px;
    transform-style: preserve-3d;
    will-change: transform;
}

.card {
    display: grid;
    transform-style: preserve-3d;
    transition: transform 0.9s var(--ease-out);
    opacity: 0;
}

.ready .card {
    opacity: 1;
    animation: card-in 1.2s var(--ease-out) 0.15s backwards;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(28px) rotateX(10deg); }
}

.face {
    grid-area: 1 / 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 20px 20px;
    border-radius: 28px;
    background: var(--face);
    border: 1px solid var(--line);
    box-shadow:
        0 50px 100px -20px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
    overflow: hidden;
}

/* specular light that follows the pointer */
.face::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, -20%), rgba(255, 240, 220, 0.07), transparent 45%);
}


/* ---------- HUD ---------- */

.hud {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    min-height: 34px;
}

.rec {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--ink-2);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-variant-numeric: tabular-nums;
}

.rec i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--tally);
    box-shadow: 0 0 10px var(--tally);
    animation: blink 1.6s steps(1) infinite;
}


@keyframes blink { 50% { opacity: 0.2; } }

.icon-btn {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--ink-2);
    cursor: pointer;
    transition: color 0.2s, background 0.2s, transform 0.2s var(--ease-spring);
}

.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.07); }
.icon-btn:active { transform: scale(0.9); }

/* ---------- Portrait ---------- */

.frame {
    position: relative;
    width: 124px;
    height: 124px;
    margin-bottom: 18px;
}

.frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
    display: block;
    background: #1a1a1e;
    /* starts over-exposed and colourless, then "develops" */
    filter: grayscale(1) brightness(2.4) contrast(0.5) blur(3px);
    transform: scale(1.06);
    transition: filter 1.8s var(--ease-out) 0.35s, transform 1.8s var(--ease-out) 0.35s;
}

.ready .frame img {
    filter: grayscale(0.15) brightness(1) contrast(1.02) blur(0);
    transform: scale(1);
}


/* ---------- Type ---------- */

.name {
    font-weight: 600;
    font-size: 30px;
    line-height: 1.05;
    letter-spacing: -0.035em;
    text-align: center;
}

.role {
    margin-top: 10px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-2);
}

/* ---------- Channels ---------- */

.channels {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 22px 0 18px;
    padding: 16px 0 0;
    border-top: 1px dashed var(--line-2);
}

.channels a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    color: var(--ink-2);
    text-decoration: none;
    font-size: 11.5px;
    border-radius: 14px;
    transition: color 0.2s;
}

.chip {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.035);
    color: var(--ink);
    transition: transform 0.35s var(--ease-spring), background 0.2s, border-color 0.2s;
}

.chip svg { width: 22px; height: 22px; }
.chip .fill { fill: currentColor; stroke: none; }

.channels a:hover { color: var(--ink); }
.channels a:hover .chip { transform: translateY(-3px); background: rgba(255, 255, 255, 0.08); border-color: var(--line-2); }
.channels a:active .chip { transform: scale(0.92); }

/* ---------- Buttons ---------- */

.actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    height: 50px;
    border-radius: 16px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: transform 0.35s var(--ease-spring), background 0.2s, box-shadow 0.3s;
}

.btn svg { width: 18px; height: 18px; stroke-width: 1.9; }

.btn.primary {
    background: var(--ink);
    color: #0b0b0e;
    box-shadow: 0 10px 30px -10px rgba(244, 240, 232, 0.35);
}

.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -10px rgba(244, 240, 232, 0.45); }

.btn.secondary {
    color: var(--ink);
    border: 1px solid var(--line-2);
    background: rgba(255, 255, 255, 0.02);
}

.btn.secondary .arrow { transition: transform 0.35s var(--ease-spring); color: var(--ink-2); }
.btn.secondary:hover { background: rgba(255, 255, 255, 0.06); }
.btn.secondary:hover .arrow { transform: translateX(3px); }

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

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

/* ---------- Staggered entrance ---------- */

.reveal {
    opacity: 0;
    transform: translateY(14px);
}

.ready .reveal {
    opacity: 1;
    transform: none;
    transition: opacity 0.7s ease, transform 0.9s var(--ease-out);
    transition-delay: calc(0.3s + var(--i) * 0.07s);
}

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: max(28px, env(safe-area-inset-bottom));
    z-index: 10;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--ink);
    color: #0b0b0e;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 12px);
    transition: opacity 0.25s, transform 0.4s var(--ease-spring);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Small / short screens ---------- */

@media (max-width: 360px) {
    .face { padding: 12px 14px 16px; }
    .name { font-size: 27px; }
    .chip { width: 44px; height: 44px; }
}

@media (max-height: 700px) {
    .frame { width: 104px; height: 104px; margin-bottom: 14px; }
    .channels { margin: 18px 0 14px; padding-top: 14px; }
    .btn { height: 48px; }
}

/* ---------- Respect reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
        animation: none !important;
    }
    .letterbox { display: none; }
}
