/* ==================================================
   RIDO DESIGN SYSTEM — tokens + global discipline
   Loads AFTER style.css/coloring.css so overrides win.
   ==================================================
   Principles (see REDESIGN.md):
   1. Keep the identity, change the tempo.
   2. Two type voices: Kumiko loud, Tiempos quiet. Caps are seasoning.
   3. Inversion is the signature; per-item accents are the only chroma.
   4. Motion serves the work, gated by [data-motion].
   ================================================== */

:root {
    /* ---------- Type scale (fluid, minor-third-ish) ---------- */
    --text-2xs: clamp(0.625rem, 0.6rem + 0.1vw, 0.6875rem);   /* 10-11 meta */
    --text-xs:  clamp(0.6875rem, 0.65rem + 0.2vw, 0.75rem);   /* 11-12 kickers */
    --text-sm:  clamp(0.8125rem, 0.78rem + 0.2vw, 0.875rem);  /* 13-14 ui */
    --text-base:clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);      /* 16-17 body */
    --text-md:  clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);   /* 18-20 lede-sm */
    --text-lg:  clamp(1.375rem, 1.2rem + 0.7vw, 1.75rem);     /* 22-28 card titles */
    --text-xl:  clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);       /* 28-40 sub heads */
    --text-2xl: clamp(2.25rem, 1.6rem + 2.8vw, 4rem);         /* 36-64 section titles */
    --text-3xl: clamp(3rem, 1.8rem + 5.2vw, 6.5rem);          /* 48-104 topic display */
    --text-hero:clamp(2.75rem, 1.5rem + 5.6vw, 6.75rem);      /* hero headline */

    /* ---------- Space scale (fluid) ---------- */
    --space-1: clamp(4px, 0.4vw, 6px);
    --space-2: clamp(8px, 0.8vw, 12px);
    --space-3: clamp(12px, 1.2vw, 18px);
    --space-4: clamp(16px, 1.8vw, 26px);
    --space-5: clamp(24px, 2.6vw, 40px);
    --space-6: clamp(36px, 4vw, 64px);
    --space-7: clamp(56px, 6.5vw, 104px);
    --space-8: clamp(84px, 10vw, 160px);

    /* ---------- Section rhythm ---------- */
    --section-pad: var(--space-7);
    --section-pad-lg: var(--space-8);

    /* ---------- Color ---------- */
    --ink: #0a0a0a;
    --paper: #ffffff;
    --paper-warm: #f7f6f3;
    --hairline: rgba(10, 10, 10, 0.14);
    --hairline-strong: rgba(10, 10, 10, 0.32);
    --ink-60: rgba(10, 10, 10, 0.6);
    --ink-40: rgba(10, 10, 10, 0.4);

    /* Per-item accent: components set --accent inline (style="--accent:#566874")
       from data; default stays ink so nothing breaks without it. */
    --accent: var(--ink);
    --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--paper));

    /* ---------- Misc ---------- */
    --radius-sm: 2px;
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-inout-soft: cubic-bezier(0.65, 0, 0.35, 1);
}

/* Dark band sections invert the local palette */
.is-inverted,
.section-dark {
    --ink: #f4f2ee;
    --paper: #0a0a0a;
    --hairline: rgba(244, 242, 238, 0.18);
    --hairline-strong: rgba(244, 242, 238, 0.4);
    --ink-60: rgba(244, 242, 238, 0.64);
    --ink-40: rgba(244, 242, 238, 0.42);
    background-color: var(--paper);
    color: var(--ink);
}

/* ---------- Selection + focus (jury-grade details) ---------- */
::selection {
    background: var(--accent, #0a0a0a);
    color: #ffffff;
}

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

a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
    outline: none;
}

/* ==================================================
   CASE DISCIPLINE
   Caps stay on kickers / nav / tags / meta.
   Titles return to mixed case for hierarchy + scannability.
   ================================================== */
.article-card__title,
.article-card__title a,
.post-title,
.project-card__title,
.home-project-card__title,
.vibe-card__title,
.rido-case-title,
.rido-capability-grid__label {
    text-transform: none;
    letter-spacing: -0.015em;
}

/* ==================================================
   THE QUIET VOICE
   Principle 2 in practice: Tiempos italic set against the loud sans.
   Section decks, page ledes and captions speak in it, and a heading can
   open with it (.rido-setup: the set-up in serif, then the turn in caps,
   as in the founder banner). Display sizes take Tiempos Headline Light,
   reading sizes Tiempos Text. The web subsets come from the Test fonts,
   which carry letters, digits, space, comma, period and hyphen only;
   other punctuation falls through to Georgia's italic, close enough at
   these sizes until the licensed files arrive.
   ================================================== */
:root {
    --voice-quiet-display: var(--font-serif-display);
    --voice-quiet-text: var(--font-serif);
    --voice-quiet-ink: rgba(10, 10, 10, 0.64);
}

.rido-setup,
html .rido-topic-divider__desc,
.hero-home .hero-desc,
.logo-wall__caption,
.articles-lead,
.article-post-dek,
.placeholder-desc {
    font-style: italic;
    letter-spacing: 0;
    text-transform: none;
}

/* A heading's set-up line. Block-level, so it keeps its own line height
   (no strut from the caps size), and sized against the heading it opens. */
.rido-setup {
    display: block;
    margin-bottom: 0.34em;
    font-family: var(--voice-quiet-display);
    font-weight: 300;
    font-size: 0.56em;
    line-height: 1.2;
    color: var(--voice-quiet-ink);
}

/* The set-up already ends its line; when the motion split has not run, a
   <br> after it would leave an empty one. */
.rido-setup + br {
    display: none;
}

/* Section decks under the giant topic titles (homepage dividers and the
   AI Engineering catalogue). The html prefix outranks section-wow.css,
   which loads after this file on the homepage. */
html .rido-topic-divider__desc {
    max-width: 640px;
    font-family: var(--voice-quiet-display);
    font-weight: 300;
    font-size: clamp(1.25rem, 0.95rem + 1vw, 1.625rem);
    line-height: 1.32;
    color: var(--voice-quiet-ink);
    text-wrap: balance;
}

/* Page ledes and captions at reading size */
.hero-home .hero-desc,
.logo-wall__caption,
.articles-lead,
.article-post-dek,
.placeholder-desc {
    font-family: var(--voice-quiet-text);
    font-weight: 400;
    line-height: 1.45;
    color: var(--voice-quiet-ink);
    text-wrap: pretty;
}

.hero-home .hero-desc {
    font-size: clamp(18px, 0.7rem + 0.75vw, 22px);
}

.articles-lead,
.article-post-dek,
.placeholder-desc {
    font-size: clamp(18px, 0.75rem + 0.8vw, 22px);
}

.logo-wall__caption {
    font-size: clamp(17px, 0.7rem + 0.6vw, 20px);
}

/* Homepage "other stuff": the handles stay in the sans, what each one
   holds is said in the serif. */
.other-stuff-line {
    font-family: var(--voice-quiet-text);
    font-style: italic;
    font-size: 15px;
    color: var(--voice-quiet-ink);
}

.other-stuff-line a,
.other-stuff-line__sep {
    font-family: var(--font-ui);
    font-style: normal;
}

.other-stuff-line a {
    font-size: 14px;
}

/* ==================================================
   COMPONENTS — shared editorial atoms
   ================================================== */

/* Kicker: the mono-feel section eyebrow */
.ds-kicker {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: var(--text-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-60);
    display: inline-flex;
    align-items: baseline;
    gap: 0.75em;
}

.ds-kicker::before {
    content: "";
    width: 28px;
    height: 1px;
    background: var(--hairline-strong);
    align-self: center;
}

/* Index number: //001 style marginalia */
.ds-index {
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: var(--text-xs);
    letter-spacing: 0.08em;
    color: var(--ink-40);
    font-variant-numeric: tabular-nums;
}

/* Pull quote — the Tiempos moment */
.pull-quote {
    font-size: clamp(1.5rem, 1.1rem + 2.2vw, 2.875rem);
    color: var(--ink);
    max-width: 22ch;
}

.pull-quote em,
.pull-quote .accent {
    font-style: italic;
    color: var(--accent);
}

/* Lede paragraph */
.lede {
    font-size: var(--text-md);
    line-height: 1.5;
    color: var(--ink-60);
    max-width: 58ch;
}

/* Hairline rules */
.ds-rule {
    border: 0;
    border-top: 1px solid var(--hairline);
    margin: 0;
}

/* Accent underline interaction for links/cards */
.ds-link {
    position: relative;
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0% 1px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.4s var(--ease-out-expo);
}

.ds-link:hover,
.ds-link:focus-visible {
    background-size: 100% 1px;
}

/* Grain overlay utility — texture that lets media compress harder */
.ds-grain {
    position: relative;
}

.ds-grain::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.5;
    mix-blend-mode: overlay;
    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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.32'/%3E%3C/svg%3E");
    background-size: 160px 160px;
}

/* Blend-mode inversion chip — for nameplate cursor + LET'S TALK hover */
.ds-invert-target {
    position: relative;
    isolation: isolate;
}

.ds-invert-dot {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #fff;
    mix-blend-mode: difference;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 2;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ds-invert-target:hover .ds-invert-dot,
.ds-invert-target.is-active .ds-invert-dot {
    opacity: 1;
}

/* ==================================================
   MOTION GOVERNANCE HOOKS
   js/motion-preferences.js sets <html data-motion="reduced|full">
   from OS preference + user toggle. Decorative motion dies here.
   ================================================== */
/* Bootstrap ships `:root { scroll-behavior: smooth }` under
   prefers-reduced-motion: no-preference. That makes every programmatic
   scroll (including GSAP ScrollTrigger.refresh()'s internal scroll
   restore) animate asynchronously, so any refresh performed while the
   page is scrolled — Show More, tab clicks, resize — caches a stale
   scroll position and shifts EVERY trigger start by -scrollY (nameplate
   stuck hidden, about-word scrub pre-completed). Anchor smoothness is
   unaffected: js/smooth-scroll.js animates anchors explicitly. */
html {
    scroll-behavior: auto !important;
}

/* The page scrollbar (style.css, 5px) takes width on the right only, so
   every centred column sat 5px closer to the left edge of the window. The
   page gives the same width back on the left (100vw - 100% is the scrollbar,
   zero where scrollbars overlay, as on phones and most Macs), and the track
   shows the page colour, so both edges read alike. scrollbar-gutter:
   both-edges would be the tidy way, but Chrome ignores it on this page. */
body {
    margin-left: calc(100vw - 100%);
}

body::-webkit-scrollbar-track {
    background: transparent;
}

html[data-motion="reduced"] .ds-grain::after {
    opacity: 0.3; /* static texture is fine; keep it calm */
}

html[data-motion="reduced"] [data-marquee],
html[data-motion="reduced"] .de-marquee-list,
html[data-motion="reduced"] .ui-marquee,
html[data-motion="reduced"] .custom-marquee {
    animation: none !important;
}

html[data-motion="reduced"] [data-scrub],
html[data-motion="reduced"] [data-parallax] {
    transform: none !important;
}

html[data-motion="reduced"] .ds-invert-dot {
    display: none;
}

/* Motion toggle button (footer) */
.motion-toggle {
    appearance: none;
    background: transparent;
    border: 1px solid var(--hairline-strong);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: var(--text-2xs);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    color: inherit;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.motion-toggle:hover {
    background: var(--ink);
    color: var(--paper);
}

.motion-toggle .motion-toggle__state::after {
    content: attr(data-state);
}

/* ==================================================
   FAVORITE BOOKMARK
   A ribbon hung from the top edge of the media, notched at the foot, holding
   a single star. No label: the mark reads on its own, and the accessible name
   rides along in visually hidden text. Used by the project grid
   (js/home-projects.js), the vibe cards (js/vibe-coding-catalog.js) and the
   AI Engineering project pages (scripts/lib/vibe-story.mjs).
   ================================================== */
.ds-fav {
    position: absolute;
    top: 0;
    right: clamp(10px, 1.1vw, 16px);
    z-index: 6;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 26px;
    height: 34px;
    padding-top: 7px;
    background: var(--ink, #0a0a0a);
    color: var(--paper, #ffffff);
    /* square shoulders, V notch at the foot */
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
    pointer-events: none;
}

.ds-fav__star {
    width: 12px;
    height: 12px;
    display: block;
    flex: 0 0 12px;
}

/* The word stays for screen readers only. */
.ds-fav__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
    border: 0;
}

@media (max-width: 767px) {
    .ds-fav {
        right: 8px;
        width: 22px;
        height: 29px;
        padding-top: 6px;
    }

    .ds-fav__star {
        width: 10px;
        height: 10px;
        flex: 0 0 10px;
    }
}

/* Phones: a long one-word section title ("AI ENGINEERING", "MILESTONES") has
   to fit the column; the template's 52px floor cropped its last letters at
   390px and below (2026-10-31). */
@media (max-width: 767px) {
    .rido-topic-divider__title {
        font-size: clamp(34px, 11.5vw, 72px);
    }
}

/* Keyboard focus is always visible (2026-10-31): the template's
   a.btn-line { outline: 0 } outranked the :focus-visible ring above, so the
   hero pills and SEE ALL ARTICLES showed nothing, and the category tabs only
   darkened their text. */
a.btn-line:focus-visible,
a.btn-main:focus-visible,
input.btn-line:focus-visible,
html [role="tab"]:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

/* Phones: a tab row that scrolls sideways shows it, with a soft fade at its
   right edge (it was cut mid-word, or hid a tab, with no hint); the end
   padding lets the last tab scroll clear of the fade (2026-10-31). */
@media (max-width: 767px) {
    .home-projects__tabs,
    .vibe-home-tabs,
    .vibe-catalog-tabs,
    .article-tabs {
        -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 40px), transparent 100%);
        mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 40px), transparent 100%);
        padding-right: 40px;
        scroll-padding-inline-end: 40px;
    }
}
