/* ==========================================================
   TidBit home page
   Two worlds: "ink" (the phone's glowing, dark side) and
   "paper" (the e-ink side). Any element with [data-theme]
   paints itself, so the page reads correctly without JS.
   ========================================================== */

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

:root {
    --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
    --font-body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

    --gutter: clamp(20px, 6vw, 104px);
    --measure: 1240px;
    /* Where the centred content column starts, so full-bleed parts (nav, first
       screen) line up with the sections below. --sbw is the scrollbar (home.js). */
    --edge: max(var(--gutter), (100vw - var(--sbw, 0px) - var(--measure)) / 2);
    --nav-h: 64px;
    --alarm: #ff453a; /* the only colour outside the phone: notification red */

    /* phone, in design pixels */
    --phone-w: 375px;
    --phone-h: 783px; /* 150.01mm at 375px = 71.85mm */
    --phone-r: 62px; /* R11.81mm */
    --phone-half-depth: 23px; /* 8.75mm body */

    /* Phone finish (blue). Keep in step with the body colours in styles.css. */
    --phone-body: #aebfd6;
    --phone-body-hi: #c3d1e3;
    --phone-body-lo: #97a9c2;
    --phone-frame-light: #dfe7f2;
    --phone-frame-dark: #6c7d95;
}

[data-theme="ink"] {
    --texture: none;
    /* Espresso: a deep, slightly red brown, warm as earth. */
    --bg: #1e1613;
    --fg: #f2ebe4;
    --muted: #b4a69c;
    --line: rgba(242, 235, 228, 0.16);
    --soft: rgba(166, 203, 214, 0.10);
    --brand: #a6cbd6;      /* pale sea blue */
    --on-brand: #1e1613;
    --accent: #a6cbd6;     /* emphasis and small marks */
    --bg-2: #2b211d;
    color-scheme: dark;
}

/* E-paper surface: a fine, even particle grain. */
[data-theme="paper"] {
    --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.11 0 0 0 0 0.09 0 0 0 0 0.07 0 0 0 1.5 -0.8'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
    --bg: #ebe6de;
    --fg: #241b17;
    --muted: #5e534c;
    --line: rgba(36, 27, 23, 0.2);
    --soft: rgba(36, 27, 23, 0.05);
    --brand: #35647a;      /* sea blue */
    --on-brand: #f4eee7;
    --accent: #35647a;     
    --bg-2: #ddd6cb;
    color-scheme: light;
}

/* Sky: a pale wash of the brand blue, the colour of the phone, for one quiet band. */
[data-theme="sky"] {
    --texture: none;
    --bg: #c9dde3;
    --fg: #241b17;
    --muted: #4e5d63;
    --line: rgba(36, 27, 23, 0.18);
    --soft: rgba(36, 27, 23, 0.05);
    --brand: #35647a;
    --on-brand: #f4eee7;
    --accent: #35647a;
    --bg-2: #b6cfd8;
    color-scheme: light;
}

/* Sand: a pale wash of terracotta, for a quieter band between paper sections. */
[data-theme="sand"] {
    --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.16 0 0 0 0 0.09 0 0 0 0 0.06 0 0 0 1.5 -0.8'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
    --bg: #e6dfd6;
    --fg: #241b17;
    --muted: #5e534c;
    --line: rgba(31, 23, 20, 0.18);
    --soft: rgba(31, 23, 20, 0.05);
    --brand: #35647a;
    --on-brand: #f4eee7;
    --accent: #35647a;
    --bg-2: #d8d0c5;
    color-scheme: light;
}

[data-theme],
.stage {
    background-color: var(--bg);
    background-image: var(--texture, none);
    background-size: 180px 180px;
    color: var(--fg);
}

::selection {
    background: var(--brand);
    color: var(--on-brand);
}

input { caret-color: currentColor; }

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

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, blockquote, table { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }
img, svg, iframe { display: block; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 100;
    padding: 10px 16px;
    background: #f2ebe4;
    color: #1e1613;
    border-radius: 8px;
    transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

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

.display,
.title {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.display {
    font-size: clamp(3.1rem, 7.4vw, 6rem);
    line-height: 0.93;
}

.title {
    font-size: clamp(2.5rem, 5vw, 4.75rem);
    line-height: 0.98;
}

.title--tour { font-size: clamp(2.2rem, 4.1vw, 3.75rem); }

.display em,
.title em {
    font-style: italic;
    letter-spacing: -0.025em;
    color: var(--accent);
}

.lede {
    max-width: 34rem;
    color: var(--muted);
    font-size: clamp(1.0625rem, 1.25vw, 1.25rem);
    text-wrap: pretty;
}

/* Small supporting labels: body face, sentence case. */
.meta {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.hint__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

/* ---------- Buttons & links ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 26px;
    border: 0;
    border-radius: 999px;
    background: var(--brand);
    color: var(--on-brand);
    box-shadow: inset 0 0 0 1.5px var(--brand);
    font: 700 0.9375rem/1 var(--font-body);
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), background-color 120ms ease, color 120ms ease;
}

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

@media (hover: hover) and (pointer: fine) {
    .btn:hover {
        background: transparent;
        color: var(--fg);
    }
}

.btn--small {
    min-height: 40px;
    padding: 0 18px;
    font-size: 0.875rem;
}

.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    font-weight: 700;
    font-size: 0.9375rem;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 6px;
    text-decoration-color: var(--line);
}
.link-arrow:hover { text-decoration-color: var(--accent); }

/* ---------- Nav ---------- */

.nav {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 40;
    height: var(--nav-h);
    padding: 0 var(--edge);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    color: var(--fg);
    border-bottom: 1px solid transparent;
}

.nav--solid {
    background: var(--bg);
    border-bottom-color: var(--line);
}

/* The mark: a phone with the TidBit on its back. */
.logo {
    width: 1.35em;
    height: 1.35em;
    flex: none;
}

.nav__brand,
.footer__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
}

.nav__brand {
    font: 800 1.125rem/1 var(--font-body);
    letter-spacing: -0.01em;
    text-decoration: none;
    padding: 12px 0;
}

.nav__links {
    display: none;
    gap: clamp(16px, 2.4vw, 36px);
    font-size: 0.875rem;
    font-weight: 600;
}

.nav__links a {
    padding: 12px 0;
    color: var(--muted);
    text-decoration: none;
}
.nav__links a:hover { color: var(--accent); }

@media (min-width: 900px) {
    .nav__links { display: flex; }
}

/* ==========================================================
   The turn
   ========================================================== */

.turn { position: relative; }

.stage {
    position: sticky;
    top: 0;
    z-index: 2;
    height: 50vh;
    height: 50svh;
    overflow: hidden;
}

.stage::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(55% 50% at 50% 46%, var(--soft), transparent 72%),
        radial-gradient(90% 70% at 60% 20%, rgba(190, 215, 225, 0.05), transparent 70%);
}

.turn__field { display: none; }

.stage__field {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.stage__scene {
    position: absolute;
    inset: 0;
    perspective: 1700px;
}

/* Centred by layout, not by transform, so the embedded demo is painted in full. */
.phone-scale {
    position: absolute;
    left: 50%;
    top: calc(50% + var(--shift, 0px));
    width: var(--phone-w);
    height: var(--phone-h);
    margin: calc(var(--phone-h) / -2) 0 0 calc(var(--phone-w) / -2);
    transform: scale(var(--s, 0.4));
    transform-style: preserve-3d;
}

.phone {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transform: rotateX(calc(var(--rx, 7) * 1deg)) rotateY(calc(var(--ry, -24) * 1deg));
    /* Also stops browsers culling the embedded demo while the phone zooms. */
    will-change: transform;
}

/* Zoomed in on the display, the phone is nearly square-on. Dropping out of 3D there
   avoids a Chromium bug that stops painting the lower part of an embedded page. */
.phone.is-flat { transform-style: flat; }

.phone__face {
    position: absolute;
    inset: 0;
    border-radius: var(--phone-r);
    overflow: hidden;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.phone__face--back {
    transform: translateZ(var(--phone-half-depth));
    background: linear-gradient(170deg, var(--phone-body-hi) 0%, var(--phone-body) 50%, var(--phone-body-lo) 100%);
}

.phone__face--front {
    transform: rotateY(180deg) translateZ(var(--phone-half-depth));
    background: #000;
}

.phone__demo {
    width: var(--phone-w);
    height: var(--phone-h);
    border: 0;
    /* Match the demo page, or Chrome paints an opaque backdrop behind a clear one. */
    color-scheme: light;
}

.phone.is-front .phone__demo { pointer-events: none; }
/* The back layer only draws the camera; the body colour is this face's own.
   Kept short, above the TidBit, so Chromium's 3D iframe painting bug can't bite. */
.phone__face--back .phone__demo { pointer-events: none; height: var(--tb-y); display: block; }

/* ---------- The TidBit on the back, in 3D ----------
   6.4mm off the glass at 375px = 71.85mm, so 33px. home.js places it where the
   demo draws it and builds the side as stacked slices, like the portfolio cover. */
.phone {
    --tb-x: 17.5px;
    --tb-y: 264px;
    --tb-w: 340px;
    --tb-h: 508px;
    --tb-r: 48px;
    --tb-depth: 33px;
}

.phone__tb {
    position: absolute;
    left: var(--tb-x);
    top: var(--tb-y);
    width: var(--tb-w);
    height: var(--tb-h);
    transform-style: preserve-3d;
    transform: translateZ(var(--phone-half-depth));
}

.phone__tbside { position: absolute; inset: 0; transform-style: preserve-3d; }

/* One strip of the side, standing on the glass (home.js places it): graphite,
   darker toward the glass, with a polished chamfer where it meets the face. */
.phone__tbstrip {
    position: absolute;
    background: linear-gradient(180deg,
        hsl(28 4% calc(7% + var(--lit) * 10%)) 0%,
        hsl(29 5% calc(14% + var(--lit) * 26%)) 82%,
        hsl(32 8% calc(30% + var(--lit) * 58%)) 88%,
        hsl(32 8% calc(24% + var(--lit) * 50%)) 100%);
}

.phone__tbface {
    position: absolute;
    inset: 0;
    border-radius: var(--tb-r);
    overflow: hidden;
    transform: translateZ(var(--tb-depth));
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.phone__tbface .phone__demo {
    position: absolute;
    left: calc(-1 * var(--tb-x));
    top: calc(-1 * var(--tb-y));
}

/* Its shadow on the phone's glass. */
.phone__tbshadow {
    position: absolute;
    left: var(--tb-x);
    top: var(--tb-y);
    width: var(--tb-w);
    height: var(--tb-h);
    border-radius: var(--tb-r);
    background: rgba(20, 24, 32, 0.45);
    transform: translate(6%, 5%);
    filter: blur(14px);
    pointer-events: none;
}

/* Zoomed in square-on (the phone drops out of 3D), the TidBit lies flat. */
.phone.is-flat .phone__tbside,
.phone.is-flat .phone__tbshadow { display: none; }

.phone__edges {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    transform-style: preserve-3d;
}

.phone__edge { position: absolute; }

.phone-shadow {
    position: absolute;
    left: 50%;
    bottom: 5%;
    width: calc(var(--phone-w) * var(--s, 0.4) * var(--shadow-w, 1));
    height: 22px;
    transform: translateX(-50%);
    background: radial-gradient(closest-side, rgba(0, 0, 0, 0.5), transparent);
    filter: blur(8px);
    opacity: var(--shadow-o, 0);
}

/* ---------- The front: a loud lock screen ---------- */

.lock {
    position: absolute;
    inset: 0;
    border-radius: var(--phone-r);
    border: 4px solid var(--phone-body);
    box-shadow: inset 0 0 0 8px #000;
    background:
        radial-gradient(70% 45% at 18% 12%, #ff5a36, transparent 70%),
        radial-gradient(70% 50% at 92% 34%, #8a3dff, transparent 70%),
        radial-gradient(90% 50% at 40% 100%, #0a84ff, transparent 70%),
        #1a0b2e;
    color: #fff;
    font-family: var(--font-body);
    overflow: hidden;
}

.lock.is-buzzing { animation: buzz 0.26s linear; }

@keyframes buzz {
    20% { transform: translateX(-2.5px); }
    40% { transform: translateX(2.5px); }
    60% { transform: translateX(-1.5px); }
    80% { transform: translateX(1.5px); }
}

.lock__island {
    position: absolute;
    top: 24px;
    left: 50%;
    width: 112px;
    height: 32px;
    margin-left: -56px;
    border-radius: 20px;
    background: #000;
}

.lock__status {
    position: absolute;
    top: 30px;
    left: 44px;
    right: 44px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 700;
}

.lock__signal {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 13px;
}
.lock__signal i {
    width: 4px;
    border-radius: 1px;
    background: #fff;
}
.lock__signal i:nth-child(1) { height: 4px; }
.lock__signal i:nth-child(2) { height: 7px; }
.lock__signal i:nth-child(3) { height: 10px; }
.lock__signal i:nth-child(4) { height: 13px; }

.lock__date {
    position: absolute;
    top: 92px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 19px;
    font-weight: 600;
    opacity: 0.9;
}

.lock__time {
    position: absolute;
    top: 116px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 96px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
}

.lock__stack {
    position: absolute;
    top: 250px;
    left: 20px;
    right: 20px;
    display: grid;
    gap: 8px;
}

.note {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 22px;
    background: #f6f5fa;
    color: #111;
    animation: drop 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards;
}

@keyframes drop {
    from { transform: translateY(-18px) scale(0.94); opacity: 0; }
}

.note__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--c, #ff453a);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 20px;
    font-weight: 800;
}

.note__top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    font-weight: 800;
}
.note__top span:last-child { font-weight: 600; opacity: 0.5; }

.note__text {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    opacity: 0.82;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lock__more {
    position: absolute;
    bottom: 34px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    opacity: 0.9;
}

/* ---------- Steps ---------- */

.steps { position: relative; z-index: 1; }

.step {
    min-height: 64vh;
    min-height: 64svh;
    padding: 28px var(--edge) 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    scroll-margin-top: 50vh;
    scroll-margin-top: 50svh;
}

.step--hero {
    justify-content: flex-start;
    min-height: 56vh;
    min-height: 56svh;
    padding-top: 20px;
    gap: 14px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 24px;
    margin-top: 6px;
}

.specline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    margin-top: 14px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--muted);
}

.noise {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 6px;
}

.noise__count {
    min-width: 1.1ch;
    font-family: var(--font-display);
    font-size: clamp(4rem, 8vw, 7rem);
    line-height: 0.85;
    color: var(--alarm);
    font-variant-numeric: tabular-nums;
}

.noise__label {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.5;
}

.hint {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.9375rem;
}


@media (min-width: 900px) {
    .turn {
        display: grid;
        grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    }

    /* Steps sit beside the stage here, so let the page's own paper show through. */
    .stage {
        background: none;
        grid-column: 2;
        grid-row: 1;
        align-self: start;
        height: 100vh;
        height: 100svh;
    }

    .steps {
        position: relative;
        z-index: 1;
        grid-column: 1;
        grid-row: 1;
    }

    /* The calm field spans the whole first screen, behind the words and the phone. */
    .turn__field {
        display: block;
        position: sticky;
        top: 0;
        grid-column: 1 / -1;
        grid-row: 1;
        align-self: start;
        height: 100vh;
        height: 100svh;
        overflow: hidden;
        pointer-events: none;
    }

    .step,
    .step--hero {
        min-height: 100vh;
        min-height: 100svh;
        justify-content: center;
        gap: 26px;
        padding: calc(var(--nav-h) + 24px) clamp(24px, 4vw, 64px) 48px var(--edge);
        scroll-margin-top: 0;
    }

    .step--tour {
        min-height: 82vh;
        min-height: 82svh;
    }

    .actions { margin-top: 10px; }
    .specline { margin-top: 28px; }
}

/* ==========================================================
   Paper sections
   ========================================================== */

.section,
.quote,
.cta {
    padding: clamp(88px, 15vh, 190px) var(--gutter);
}

.section > *,
.quote > *,
.cta > * {
    max-width: var(--measure);
    margin-inline: auto;
}

.section__head {
    display: grid;
    gap: 22px;
    margin-bottom: clamp(40px, 7vh, 88px);
}

.section__head .title { max-width: 16ch; }

/* Quote */

.quote {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-align: center;
}

.quote p {
    max-width: 17ch;
    margin-inline: auto;
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(2.6rem, 6.4vw, 6rem);
    line-height: 1;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.quote cite {
    display: block;
    margin-top: 32px;
    font-family: var(--font-body);
    font-style: normal;
    font-size: 0.875rem;
    color: var(--muted);
}

/* How it works */

.how {
    display: grid;
    gap: 48px;
}

.how__step {
    position: relative;
    display: grid;
    gap: 10px;
    align-content: start;
}

.how__art {
    width: 100%;
    max-width: 320px;
    height: auto;
    margin-bottom: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.how__art .fill { fill: var(--bg); }

/* Each step is a tiny story (home.js adds .how--ready, then .is-play on each
   step with its --delay). The outlines sketch themselves first.
   Snap: TidBit swings in and snaps onto the MagSafe ring, which pulses once.
   Pair: signal waves keep breathing out from the phone; the widgets you
   picked draw onto TidBit one by one.
   Glance: the screen holds, then every few seconds redraws the way e-paper
   does, with a hard flash, and holds again.
   Without JS or with reduced motion, the finished drawing just shows. */

.snap__target { stroke-dasharray: 3 4; opacity: 0.55; }
.snap__ring { opacity: 0; }
.snap__tb,
.snap__ring,
.pair__wave { transform-box: fill-box; transform-origin: center; }
.glance__b { opacity: 0; }
.glance__flash { fill: currentColor; stroke: none; opacity: 0; }

.how--ready .how__art .draw {
    stroke-dasharray: var(--len) var(--len);
    stroke-dashoffset: var(--len);
}
.how--ready .how__art .draw.fill { fill-opacity: 0; }
.how--ready .snap__tb { opacity: 0; }
.how--ready .snap__target { opacity: 0; }
.how--ready .pair__wave { opacity: 0; }

.how--ready .how__step h3,
.how--ready .how__step p {
    opacity: 0;
    transform: translateY(6px);
}

.how--ready .is-play .how__art .draw {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.7s cubic-bezier(0.23, 1, 0.32, 1) calc(var(--delay, 0s) + 0.1s + var(--i) * 0.12s);
}
.how--ready .is-play .how__art .draw.fill {
    fill-opacity: 1;
    transition:
        stroke-dashoffset 0.7s cubic-bezier(0.23, 1, 0.32, 1) calc(var(--delay, 0s) + 0.1s + var(--i) * 0.12s),
        fill-opacity 0.3s ease-out calc(var(--delay, 0s) + 0.4s + var(--i) * 0.12s);
}

/* Snap */
.how--ready .is-play .snap__target {
    opacity: 0.55;
    transition: opacity 0.3s steps(2) calc(var(--delay, 0s) + 0.45s);
}
.how--ready .is-play .snap__tb {
    animation: snap-in 0.85s cubic-bezier(0.2, 0.9, 0.25, 1.25) calc(var(--delay, 0s) + 0.75s) both;
}
.how--ready .is-play .snap__ring {
    animation: snap-ring 0.9s cubic-bezier(0.2, 0.7, 0.3, 1) calc(var(--delay, 0s) + 1.45s) both;
}
@keyframes snap-in {
    0% { opacity: 0; transform: translate(74px, -18px) rotate(16deg); }
    25% { opacity: 1; }
    100% { opacity: 1; transform: none; }
}
@keyframes snap-ring {
    0% { opacity: 0.9; transform: scale(0.75); }
    100% { opacity: 0; transform: scale(1.5); }
}

/* Pair */
.how--ready .is-play .pair__wave {
    animation: pair-wave 2.8s ease-out calc(var(--delay, 0s) + 0.7s + var(--w, 0) * 0.28s) infinite;
}
@keyframes pair-wave {
    0% { opacity: 0; transform: translateX(-3px); }
    18% { opacity: 1; }
    55%, 100% { opacity: 0; transform: translateX(5px); }
}
.how--ready .is-play .how__art .pair__w {
    transition: stroke-dashoffset 0.5s cubic-bezier(0.23, 1, 0.32, 1) calc(var(--delay, 0s) + 1.3s + var(--i) * 0.3s);
}

/* Glance: hold, flash, hold */
.how--ready .is-play .glance__a { animation: glance-a 7s steps(1, end) calc(var(--delay, 0s) + 2.4s) infinite; }
.how--ready .is-play .glance__b { animation: glance-b 7s steps(1, end) calc(var(--delay, 0s) + 2.4s) infinite; }
.how--ready .is-play .glance__flash { animation: glance-flash 7s linear calc(var(--delay, 0s) + 2.4s) infinite; }
@keyframes glance-a { 0% { opacity: 1; } 48% { opacity: 0; } 98% { opacity: 1; } }
@keyframes glance-b { 0% { opacity: 0; } 48% { opacity: 1; } 98% { opacity: 0; } }
@keyframes glance-flash {
    0%, 43% { opacity: 0; }
    44% { opacity: 0.85; }
    45.5% { opacity: 0.1; }
    47% { opacity: 0.6; }
    48.5%, 93% { opacity: 0; }
    94% { opacity: 0.85; }
    95.5% { opacity: 0.1; }
    97% { opacity: 0.6; }
    98.5%, 100% { opacity: 0; }
}

.how--ready .is-play h3,
.how--ready .is-play p {
    opacity: 1;
    transform: none;
    transition:
        opacity 0.35s ease-out var(--text-delay),
        transform 0.5s cubic-bezier(0.23, 1, 0.32, 1) var(--text-delay);
}
.how--ready .is-play h3 { --text-delay: calc(var(--delay, 0s) + 0.55s); }
.how--ready .is-play p { --text-delay: calc(var(--delay, 0s) + 0.65s); }

.how__step h3 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2rem, 3.4vw, 3rem);
    line-height: 1;
    letter-spacing: -0.02em;
}

.how__step p:last-child {
    max-width: 30ch;
    color: var(--muted);
}

@media (min-width: 800px) {
    .how {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: clamp(24px, 4vw, 64px);
    }
}

/* A day with TidBit, as a dial
   The day goes round like the earth: noon at the top, midnight at the bottom,
   morning on the left, evening on the right. The five moments sit on the ring,
   a sun travels to the chosen one, and the TidBit in the middle redraws.
   Without JS every moment is listed and the first picture shows. */

.day {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(32px, 5vw, 72px);
    align-items: center;
}

@media (min-width: 900px) {
    .day { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
    .day__copy { order: -1; }
}

.dial {
    position: relative;
    width: min(100%, 620px, calc(100svh - 120px));
    aspect-ratio: 1;
    justify-self: center;
}

.dial__ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.dial__day,
.dial__night,
.dial__lit { fill: none; }

.dial__day { stroke: var(--line); stroke-width: 1.5; }
.dial__night { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 2 7; stroke-linecap: round; }

/* The day so far: lit from the first moment to the chosen one. */
.dial__lit {
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 0 360;
    stroke-dashoffset: -105;
    transition: stroke-dasharray 1.1s cubic-bezier(.45, 0, .2, 1);
}

.dial__label {
    fill: var(--muted);
    font: 700 13px/1 var(--font-body);
    letter-spacing: 0.04em;
    text-anchor: middle;
}

/* The sun rides a little inside the ring, pointing at the moment. */
.dial__sun {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transform: rotate(var(--a, 105deg));
    transition: transform 1.1s cubic-bezier(.45, 0, .2, 1);
}

.dial__sun i {
    position: absolute;
    left: 50%;
    top: 87%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--brand);
    color: var(--on-brand);
    font-size: 15px;
    transform: rotate(calc(-1 * var(--a, 105deg)));
    transition: transform 1.1s cubic-bezier(.45, 0, .2, 1);
}

.dial__marks { margin: 0; padding: 0; list-style: none; }

.dial__marks li {
    position: absolute;
    left: var(--x);
    top: var(--y);
    transform: translate(-50%, -50%);
}

.dial__mark {
    min-width: 64px;
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: var(--bg);
    box-shadow: inset 0 0 0 1.5px var(--line);
    color: var(--fg);
    font: 700 0.875rem/1 var(--font-body);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.dial__mark:active { transform: scale(0.95); }

.dial__mark[aria-pressed="true"] {
    background: var(--brand);
    box-shadow: none;
    color: var(--on-brand);
}

/* The TidBit at the centre of the day. */
.dial .day__device {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 38%;
    translate: -50% -50%;
}

.dial .tb3d { width: 100%; }

/* The words for the chosen moment. */
.day__steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 40px; }

.day__step {
    display: grid;
    gap: 12px;
    max-width: 30ch;
}

.day__time {
    font-size: 0.875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.day__step h3 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.2rem, 4vw, 3.6rem);
    line-height: 1;
    letter-spacing: -0.015em;
}

.day__step p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    font-size: clamp(1.0625rem, 1.2vw, 1.1875rem);
}

.day__ctrl { display: none; gap: 10px; margin-top: 32px; }

.day__btn {
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--line);
    color: var(--fg);
    font-size: 1rem;
    cursor: pointer;
}

.day__btn:active { transform: scale(0.95); }

/* With JS: one moment at a time, arriving in a couple of hard steps. */
.day--ready .day__steps { display: grid; gap: 0; }
.day--ready .day__step { grid-area: 1 / 1; visibility: hidden; opacity: 0; }
.day--ready .day__step.is-on {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s steps(3, jump-end) 0.12s;
}
.day--ready .day__ctrl { display: flex; }

@media (max-width: 899px) {
    .day__copy { text-align: center; }
    .day__step { margin-inline: auto; justify-items: center; }
    .day__ctrl { justify-content: center; }
    .dial .day__device { width: 36%; }
    .dial__mark { min-width: 52px; min-height: 32px; padding: 0 8px; font-size: 0.75rem; }
    .dial__sun i { top: 82%; width: 24px; height: 24px; margin: -12px 0 0 -12px; font-size: 12px; }
    .dial { width: min(94%, 520px); }
    .dial__label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .dial__lit, .dial__sun, .dial__sun i { transition: none; }
}

/* ---------- The device ----------
   The same screens as the live demo on the phone (styles.css, "ONE TIDBIT"),
   drawn at its measurements: --u is one demo pixel, so 340u is TidBit's width. */

.tb {
    --u: calc(100cqw / 340);
    --ink: #33322f;
    --paper: #e6e4dd;
    --ink-2: #4a4946;
    --hair: rgba(0, 0, 0, 0.45);
    position: relative;
    container-type: inline-size;
    width: 316px;
    aspect-ratio: 340 / 508;
    border-radius: calc(48 * var(--u));
    background: linear-gradient(160deg, #3a3a39 0%, #262625 50%, #1b1b1a 100%);
    box-shadow:
        0 1px 0 #1d1d1c,
        0 2px 0 #1b1b1a,
        0 3px 0 #191918,
        0 4px 0 #161615,
        0 14px 22px rgba(10, 8, 6, 0.3),
        0 34px 48px -18px rgba(10, 8, 6, 0.45),
        inset 0 1px 1px rgba(255, 255, 255, 0.26),
        inset 0 -1px 1px rgba(0, 0, 0, 0.5);
}

.tb__screen,
.tb__flash {
    position: absolute;
    inset: calc(12 * var(--u));
    border-radius: calc(40 * var(--u));
}

.tb__screen {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: calc(16 * var(--u));
    background: var(--paper);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
    font-family: var(--font-body);
    font-size: calc(16 * var(--u));
    font-weight: 600;
    line-height: 1.35;
}

.tb__screen p { margin: 0; }

.tb__bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 calc(8 * var(--u)) calc(8 * var(--u));
    font-size: calc(14 * var(--u));
    color: var(--ink-2);
}

.tb__clock { font-size: calc(16 * var(--u)); font-weight: 800; color: var(--ink); }
.tb__batt i { margin-right: calc(5 * var(--u)); font-size: calc(14 * var(--u)); }

.tb__view {
    display: none;
    flex: 1;
    flex-direction: column;
    gap: calc(8 * var(--u));
    min-height: 0;
    padding: calc(6 * var(--u)) calc(4 * var(--u)) calc(60 * var(--u));
}

.tb__view.is-on { display: flex; }

/* Header: a big number, a label and a line. */
.tb__date {
    display: flex;
    align-items: center;
    gap: calc(16 * var(--u));
    padding-bottom: calc(8 * var(--u));
    border-bottom: 1px solid var(--hair);
}

.tb__num {
    font-family: var(--font-display);
    font-size: calc(36 * var(--u));
    line-height: 1.2;
    letter-spacing: calc(1.8 * var(--u));
}

.tb__label {
    display: block;
    font-size: calc(12 * var(--u));
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    color: var(--ink-2);
}

.tb__label--ink { font-weight: 800; letter-spacing: 0.08em; color: var(--ink); }

.tb__head { display: block; font-size: calc(16 * var(--u)); font-weight: 800; }

.tb__block {
    padding: calc(6 * var(--u)) calc(8 * var(--u));
    border-radius: calc(8 * var(--u));
    background: var(--ink);
    color: var(--paper);
    font-size: calc(14 * var(--u));
    font-weight: 800;
}

.tb__events { margin: 0; padding: 0; list-style: none; }

.tb__events li {
    position: relative;
    padding: calc(3 * var(--u)) 0 calc(3 * var(--u)) calc(16 * var(--u));
    font-size: calc(14 * var(--u));
}

.tb__events li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10%;
    bottom: 10%;
    width: calc(3 * var(--u));
    border-radius: calc(2 * var(--u));
    background: #8f8d88;
}

.tb__events li.hi::before { background: var(--ink); }
.tb__events li.lo::before { background: #c4c2bc; }
.tb__events b { display: inline-block; min-width: calc(48 * var(--u)); font-weight: 800; }

.tb__weather { margin-top: auto; padding-top: calc(10 * var(--u)); border-top: 1px solid var(--hair); }
.tb__weather .tb__date { padding: 0; border: 0; }

.tb__details {
    display: flex;
    gap: calc(16 * var(--u));
    margin-top: calc(6 * var(--u)) !important;
    font-size: calc(12 * var(--u));
    text-transform: uppercase;
    color: var(--ink-2);
}

.tb__details i { margin-right: calc(4 * var(--u)); color: var(--ink); }

/* Notifications */
.tb__note {
    display: flex;
    align-items: flex-start;
    gap: calc(10 * var(--u));
    padding-top: calc(4 * var(--u));
    font-size: calc(14 * var(--u));
    line-height: 1.3;
}

.tb__note i { padding-top: calc(2 * var(--u)); font-size: calc(15 * var(--u)); }

.tb__note small {
    display: block;
    margin-top: calc(2 * var(--u));
    font-size: calc(12 * var(--u));
    color: var(--ink-2);
}

.tb__held {
    padding-top: calc(10 * var(--u));
    border-top: 1px solid var(--hair);
    font-size: calc(12 * var(--u));
    color: var(--ink-2);
}

/* Focus */
.tb__mins {
    display: flex;
    align-items: baseline;
    gap: calc(8 * var(--u));
    font-family: var(--font-display);
    font-size: calc(104 * var(--u));
    line-height: 0.9;
    letter-spacing: -0.02em;
}

.tb__mins span {
    font-family: var(--font-body);
    font-size: calc(17 * var(--u));
    font-weight: 800;
    letter-spacing: 0;
}

.tb__dots { display: flex; gap: calc(8 * var(--u)); }

.tb__dots i {
    width: calc(11 * var(--u));
    height: calc(11 * var(--u));
    border: calc(2 * var(--u)) solid var(--ink);
    border-radius: 50%;
}

.tb__dots i.on { background: var(--ink); }

.tb__rule { width: 100%; margin: calc(6 * var(--u)) 0; border: 0; border-top: 1px solid var(--hair); }

.tb__task { margin-top: auto !important; font-size: calc(17 * var(--u)); font-weight: 800; line-height: 1.25; }
.tb__small { font-size: calc(12 * var(--u)); color: var(--ink-2); }
.tb__small b { color: var(--ink); }

.tb__buttons { display: flex; gap: calc(12 * var(--u)); margin-top: calc(8 * var(--u)); }

.tb__buttons span,
.tb__media span {
    display: grid;
    place-items: center;
    width: calc(46 * var(--u));
    height: calc(46 * var(--u));
    border: calc(1.5 * var(--u)) solid var(--ink);
    border-radius: 50%;
    font-size: calc(17 * var(--u));
}

.tb__buttons .is-ink,
.tb__media span { background: var(--ink); color: var(--paper); }

/* Music */
.tb__cover {
    display: block;
    align-self: center;
    width: calc(228 * var(--u));
    height: auto;
    aspect-ratio: 1;
    margin-bottom: calc(6 * var(--u));
    border-radius: calc(8 * var(--u));
    image-rendering: pixelated;
    filter: grayscale(1) sepia(0.08);
}

.tb__track { text-align: center; font-size: calc(13 * var(--u)); color: var(--ink-2); }
.tb__track b { display: block; font-size: calc(17 * var(--u)); font-weight: 800; line-height: 1.2; color: var(--ink); }

.tb__media {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding: 0 calc(40 * var(--u)) calc(4 * var(--u));
    font-size: calc(20 * var(--u));
}

/* Night: the last picture, no buttons. */
.tb__view--night { justify-content: center; padding-bottom: calc(20 * var(--u)); }

.tb__quote {
    font-family: var(--font-display);
    font-size: calc(52 * var(--u));
    line-height: 0.95;
    letter-spacing: -0.02em;
}

/* Bottom buttons, as on the demo. */
.tb__nav {
    position: absolute;
    left: calc(16 * var(--u));
    right: calc(16 * var(--u));
    bottom: calc(8 * var(--u));
    display: flex;
    justify-content: space-around;
    padding: calc(8 * var(--u));
}

.tb__nav > span {
    position: relative;
    display: grid;
    place-items: center;
    width: calc(54.5 * var(--u));
    height: calc(34 * var(--u));
    border: 1px solid var(--hair);
    border-radius: calc(20 * var(--u));
    font-size: calc(16 * var(--u));
    color: var(--ink-2);
}

.tb__nav b {
    position: absolute;
    top: calc(-8 * var(--u));
    right: calc(-8 * var(--u));
    display: grid;
    place-items: center;
    width: calc(24 * var(--u));
    height: calc(24 * var(--u));
    border: calc(2 * var(--u)) solid var(--paper);
    border-radius: 50%;
    background: var(--ink);
    color: var(--paper);
    font-size: calc(13 * var(--u));
    font-weight: 800;
}

.tb__nav[data-tab="0"] > span:nth-child(1),
.tb__nav[data-tab="1"] > span:nth-child(2),
.tb__nav[data-tab="2"] > span:nth-child(3),
.tb__nav[data-tab="3"] > span:nth-child(4) {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.tb__nav[data-tab="none"] { display: none; }

/* ---------- Product shot: the TidBit under a desk lamp ----------
   home.js adds the edge layers (the 6.4mm graphite side) and .day--ready.
   The shot is tilted in 3D, then rolled a little in the frame like a photo. */

#day {
    position: relative;
    overflow-x: clip;
    background-image:
        radial-gradient(42% 40% at 72% 42%, rgba(166, 203, 214, 0.07), transparent 70%),
        radial-gradient(60% 50% at 20% 0%, rgba(190, 215, 225, 0.05), transparent 70%);
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

.day__device { isolation: isolate; }

/* The lamp's pool of light, behind the device. */
.day__device::before {
    content: "";
    position: absolute;
    inset: -18% -30%;
    z-index: -1;
    background: radial-gradient(closest-side, rgba(166, 203, 214, 0.10), rgba(166, 203, 214, 0.03) 60%, transparent);
    pointer-events: none;
}

.tb3d {
    display: grid;
    width: 316px;
    container-type: inline-size;
}

.tb3d > * { grid-area: 1 / 1; }
.tb3d .tb { width: 100%; }

.tb__shadow { display: none; }

.tb__sheen {
    position: absolute;
    inset: calc(12 * var(--u));
    border-radius: calc(40 * var(--u));
    pointer-events: none;
    background:
        linear-gradient(128deg, rgba(255, 236, 206, 0.32) 0%, rgba(255, 236, 206, 0.08) 26%, transparent 42%, transparent 72%, rgba(40, 20, 0, 0.12) 100%);
}

.day--ready .day__device {
    perspective: 1400px;
    rotate: -5deg;
}

.day--ready .tb3d {
    transform-style: preserve-3d;
    transform: rotateX(var(--tilt-x, 16deg)) rotateY(var(--tilt-y, 22deg));
    transition: transform 1.2s cubic-bezier(.23, 1, .32, 1);
}

.day--ready .tb {
    transform: translateZ(9.8cqw);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.3),
        inset 0 -1px 1px rgba(0, 0, 0, 0.5);
}

/* The side: graphite, catching the lamp at the top-left, darker as it goes down. */
.tb__layer {
    border-radius: 14.1% / 9.45%;
    transform: translateZ(calc(var(--k) * 0.6cqw));
    background: linear-gradient(110deg,
        hsl(32 8% calc(34% + var(--t) * 26%)) 0%,
        hsl(30 5% calc(20% + var(--t) * 14%)) 45%,
        hsl(30 4% calc(9% + var(--t) * 6%)) 100%);
}

/* A polished chamfer right under the face. */
.tb__layer--chamfer {
    background: linear-gradient(110deg, #e6dfd3 0%, #8d887f 45%, #3a3936 100%);
}

.day--ready .tb__shadow {
    display: block;
    border-radius: 14.1% / 9.45%;
    background: rgba(6, 5, 4, 0.7);
    transform: translateZ(-2px) translate(10%, 8%);
    filter: blur(22px);
}

@media (max-width: 799px) {
    #day { background-image: none; }
}

@media (prefers-reduced-motion: reduce) {
    .day--ready .tb3d { transition: none; }
}

/* Redraw: a few hard frames, the way a panel actually refreshes. */
.tb__flash {
    pointer-events: none;
    opacity: 0;
}

.tb.is-refreshing .tb__flash { animation: tb-refresh 0.52s steps(1, jump-end); }

@keyframes tb-refresh {
    0% { opacity: 0.42; background: #33322f; }
    22% { opacity: 0.85; background: #e6e4dd; }
    44% { opacity: 0.26; background: #33322f; }
    66% { opacity: 0.5; background: #e6e4dd; }
    100% { opacity: 0; }
}

/* Dimensional drawing */

.drawing {
    margin-block: 0;
}

.drawing__frame {
    overflow-x: auto;
    border-radius: 18px;
    -webkit-overflow-scrolling: touch;
}

.drawing__svg {
    display: block;
    width: 100%;
    min-width: 760px;
    height: auto;
}

.drawing__caption {
    margin-top: 16px;
    font-size: 0.875rem;
    color: var(--muted);
}

.drawing__hint { display: none; }

@media (max-width: 799px) {
    .drawing__hint { display: inline; }
}

.dw-sheet { fill: color-mix(in srgb, var(--bg) 70%, #fff); stroke: var(--fg); stroke-width: 1.5; }
.dw-grid { fill: none; stroke: var(--fg); stroke-width: 0.6; opacity: 0.07; }
.dw-line { fill: none; stroke: var(--fg); stroke-width: 1.6; }
.dw-body { fill: color-mix(in srgb, var(--bg) 40%, #fff); }
.dw-screen { fill: #eeece6; }
.dw-thin { fill: none; stroke: var(--fg); stroke-width: 0.9; }
.dw-dim { fill: none; stroke: var(--fg); stroke-width: 0.9; }
.dw-center { fill: none; stroke: var(--fg); stroke-width: 0.8; stroke-dasharray: 14 4 3 4; opacity: 0.7; }
.dw-hidden { fill: none; stroke: var(--fg); stroke-width: 0.9; stroke-dasharray: 4 3; }
.dw-hatch { fill: url(#dw-hatch); }
.dw-ink { fill: var(--fg); stroke: none; }

.drawing__svg text { fill: var(--fg); font-family: var(--font-body); }
.dw-text { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; }
.dw-text--bold { font-weight: 800; }
.dw-text--muted { fill: var(--muted) !important; }
.dw-num { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.dw-num--small { font-size: 11px; }
.dw-view { font-family: var(--font-display) !important; font-style: italic; font-size: 24px; }
.dw-brand { font-family: var(--font-body); font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.dw-ui { font-size: 11px; font-weight: 600; }
.dw-ui--bold { font-weight: 800; }
.dw-ui--inv { fill: #eeece6 !important; font-weight: 800; }
.dw-ui-big { font-family: var(--font-display) !important; font-size: 34px; }

/* Draw-in (home.js tags each part draw or fade, with its own delay). */
.drawing--ready [data-k="draw"] {
    stroke-dasharray: var(--len) var(--len);
    stroke-dashoffset: var(--len);
    fill-opacity: 0;
}

.drawing--ready [data-k="fade"] { opacity: 0; }

.drawing--ready.is-play [data-k="draw"] {
    stroke-dashoffset: 0;
    fill-opacity: 1;
    transition:
        stroke-dashoffset 0.9s cubic-bezier(.65, 0, .35, 1) var(--d),
        fill-opacity 0.4s ease-out var(--df);
}

.drawing--ready.is-play [data-k="fade"] {
    opacity: 1;
    transition: opacity 0.4s ease-out var(--df);
}

/* Integrations index */

.index { border-top: 1px solid var(--line); }

.index li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 24px;
    padding: clamp(14px, 2vw, 22px) clamp(0px, 1.2vw, 16px);
    border-bottom: 1px solid var(--line);
    transition: background-color 0.14s steps(2), color 0.14s steps(2);
}

.index__name {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 4vw, 3.4rem);
    line-height: 1.02;
    letter-spacing: -0.02em;
}

.index__what {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--muted);
    transition: color 0.14s steps(2);
}

@media (hover: hover) {
    .index li:hover {
        background: var(--brand);
        color: var(--on-brand);
    }
    .index li:hover .index__what { color: var(--on-brand); opacity: 0.8; }
}

/* ==========================================================
   CTA + footer (back to ink)
   ========================================================== */

.cta__inner {
    display: grid;
    gap: 26px;
    justify-items: start;
}

.display--cta { font-size: clamp(3rem, 7.6vw, 6rem); }

.specline--cta {
    margin-top: 0;
    width: 100%;
    max-width: 44rem;
}

.signup {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    max-width: 34rem;
    margin-top: 6px;
}

.signup__input {
    flex: 1 1 220px;
    min-height: 50px;
    padding: 0 22px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--fg);
    font: 600 1rem/1 var(--font-body);
}

.signup__input::placeholder { color: var(--muted); opacity: 0.8; }
.signup__input:focus-visible {
    outline: none;
    border-color: var(--accent);
}

.signup__note {
    min-height: 3em;
    max-width: 34rem;
    font-size: 0.9375rem;
    color: var(--muted);
}

.signup__note.is-done { color: var(--accent); }
.signup__note.is-error { color: var(--alarm); }

.footer {
    padding: 56px var(--gutter) 40px;
    border-top: 1px solid var(--line);
}

.footer__top {
    display: grid;
    gap: 36px;
    max-width: var(--measure);
    margin-inline: auto;
}

.footer__brand {
    font-weight: 800;
    font-size: 1.25rem;
}

.footer__tag { color: var(--muted); }

.footer__links {
    display: grid;
    gap: 4px;
    align-content: start;
    font-size: 0.9375rem;
}

.footer__links a {
    padding: 6px 0;
    color: var(--muted);
    text-decoration: none;
}
.footer__links a:hover { color: var(--accent); }

.footer__legal {
    max-width: var(--measure);
    margin: 48px auto 0;
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--muted);
}

@media (min-width: 800px) {
    .footer__top { grid-template-columns: 1.6fr 1fr 1fr; }
}

/* ==========================================================
   E-ink behaviour: things arrive the way a panel redraws,
   in a few hard steps rather than a soft fade.
   ========================================================== */

.refresh {
    position: fixed;
    inset: 0;
    z-index: 30;
    pointer-events: none;
    opacity: 0;
}

.refresh.to-paper { animation: refresh-paper 0.46s steps(1, jump-end); }
.refresh.to-ink { animation: refresh-ink 0.46s steps(1, jump-end); }

@keyframes refresh-paper {
    0% { opacity: 0.55; background: #f6f4ec; }
    34% { opacity: 0.3; background: #241b17; }
    67% { opacity: 0.12; background: #241b17; }
    100% { opacity: 0; }
}

@keyframes refresh-ink {
    0% { opacity: 0.5; background: #1e1613; }
    34% { opacity: 0.22; background: #f2ebe4; }
    67% { opacity: 0.1; background: #f2ebe4; }
    100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .refresh { display: none; }
    .note,
    .lock.is-buzzing { animation: none; }
    [data-theme] { transition: background-color 0.3s, color 0.3s; }
}


/* ==========================================================
   Held: choose who gets through
   ========================================================== */

.split {
    display: grid;
    gap: clamp(40px, 6vw, 96px);
    align-items: center;
}

.split .section__head { margin-bottom: 28px; }

.split__device {
    display: grid;
    justify-items: center;
    order: -1;
}

.tb3d--flat { width: min(280px, 72vw); }
.tb3d--flat .tb { transform: rotate(-3deg); }

@media (min-width: 900px) {
    .split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
    .split__device { order: 0; }
    .tb3d--flat { width: 316px; }
}

.tb__notes { display: grid; gap: calc(10 * var(--u)); }
.tb__notes .tb__note { padding-top: 0; }
.tb__empty { font-size: calc(14 * var(--u)); color: var(--ink-2); }

/* On light grounds the glass glare is softer, or the screen washes out. */
.tb3d--flat .tb__sheen { opacity: 0.25; }



/* Night: the panel inverts, light type on black, like a lamp switched off. */
.tb.is-night .tb__screen {
    --ink: #e6e4dd;
    --ink-2: #a9a69e;
    --hair: rgba(230, 228, 221, 0.35);
    background: #161513;
    color: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.tb.is-night .tb__sheen { opacity: 0.12; }

/* ==========================================================
   Held: two trays, and names that move between them
   ========================================================== */

.bins {
    display: grid;
    gap: 12px;
}

.bin {
    padding: 20px;
    border-radius: 18px;
}

.bin--through { background: var(--brand); color: var(--on-brand); }
.bin--held { background: var(--bg-2); color: var(--fg); }

.bin__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 0.9375rem;
}

.bin__head b { font-weight: 800; }
.bin__head span { font-weight: 600; opacity: 0.85; }
.bin__head em {
    font-family: var(--font-display);
    font-style: normal;
    font-size: 2.2em;
    line-height: 0.5;
    letter-spacing: -0.02em;
    margin-right: 4px;
}

.bin__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 44px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    font: 700 0.9375rem/1 var(--font-body);
    cursor: pointer;
    transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.chip:active { transform: scale(0.96); }
.chip i { font-size: 0.875em; }
.chip__n:empty { display: none; }
.chip__n { font-weight: 600; opacity: 0.7; }

.bin--through .chip { background: var(--on-brand); color: var(--brand); }
.bin--held .chip { background: var(--bg); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }

.chip.is-new { animation: chip-in 0.36s steps(3, jump-end); }
@keyframes chip-in {
    0% { opacity: 0; }
    50% { opacity: 1; filter: invert(1); }
    100% { filter: none; }
}

.held__hint { margin-top: 14px; }

@media (max-width: 899px) {
    #held .split__copy { display: contents; }
    #held .section__head { order: 1; margin-bottom: 0; }
    #held .split__device { order: 2; }
    #held .bins { order: 3; }
    #held .held__hint { order: 4; margin-top: -26px; }
    #held .split { gap: 40px; }
    .tb3d--flat { width: min(250px, 66vw); }
}

@media (prefers-reduced-motion: reduce) {
    .chip.is-new { animation: none; }
}

/* The dial is the centrepiece: as large as the screen allows, centred,
   with the words for the moment in the margin beside it. */
#day { padding-block: clamp(24px, 4vh, 48px); }

@media (min-width: 900px) {
    /* The dial on its own, the words for the moment in one line beneath it. */
    .day { grid-template-columns: minmax(0, 1fr); gap: 28px; }
    .dial { width: min(calc(100svh - var(--nav-h) - 190px), 820px, 90vw); }
    .dial .day__device { width: 34%; }
    .day__copy {
        order: 0;
        display: flex;
        align-items: center;
        gap: 40px;
        padding-top: 24px;
        border-top: 1px solid var(--line);
    }
    .day__steps { flex: 1; }
    .day__step {
        grid-template-columns: 4.5rem minmax(0, 1fr) minmax(0, 1.25fr);
        align-items: center;
        column-gap: 32px;
        max-width: none;
        min-height: 4.5rem; /* every moment takes the same height, so nothing jumps */
    }
    .day__step h3 { line-height: 1.05; }
    .day__step p { max-width: 40ch; }
    .day__step h3 { font-size: clamp(1.8rem, 2.4vw, 2.5rem); }
    .day__ctrl { margin-top: 0; }
}

/* ---------- Entrance ----------
   The page opens dark. The ripples breathe in, the phone rises out of the dark and
   swings round to rest, then the TidBit wakes the way e-paper does: blank, a hard
   black-white flash, and the screen. The headline rises line by line; the nav last.
   Only `translate`/`rotate`/opacity move, so the scroll-driven transforms stay theirs,
   and nothing in the 3D phone is faded (that would flatten it). */

.intro .stage__scene { animation: intro-fade 1.3s ease-out 0.1s both; }
.intro .stage__field { animation: intro-fade 2.4s ease-out both; }
.intro .phone-scale { animation: intro-phone 2.1s cubic-bezier(0.16, 1, 0.3, 1) both; }
.intro .phone-shadow { animation: intro-fade 1.2s ease-out 0.9s both; }

@keyframes intro-fade { from { opacity: 0; } }
@keyframes intro-phone {
    from { translate: 0 16vh; rotate: y -64deg; }
    to { translate: 0 0; rotate: y 0deg; }
}

/* The TidBit is never blank: like e-paper, it holds its last image (a poster of the
   screen) until the live screen is ready, then home.js swaps it in (.is-live). */
.phone__tbface { background: url(images/tidbit-screen.webp) center / 100% 100% no-repeat; }
.js .phone__tbface .phone__demo { visibility: hidden; }
.js .phone__tbface.is-live .phone__demo { visibility: visible; }

.intro .step--hero h1,
.intro .step--hero .lede,
.intro .step--hero .actions,
.intro .step--hero .specline {
    animation: intro-rise 1.1s cubic-bezier(0.16, 1, 0.3, 1) var(--in, 0s) both;
}
.intro .step--hero h1 { --in: 0.55s; }
/* The italic half follows a beat later (it's inline, so it fades rather than rises). */
.intro .step--hero h1 em { animation: intro-fade 1.1s ease-out 0.85s both; }
.intro .step--hero .lede { --in: 0.95s; }
.intro .step--hero .actions { --in: 1.1s; }
.intro .step--hero .specline { --in: 1.25s; }
@keyframes intro-rise {
    from { opacity: 0; translate: 0 22px; }
}

.intro .nav { animation: intro-nav 0.9s cubic-bezier(0.16, 1, 0.3, 1) 1.4s both; }
@keyframes intro-nav {
    from { opacity: 0; translate: 0 -10px; }
}
