/*
  Tellhaven — Design System (Phase 3)
  Editorial, calm, premium. Long-form reading is the priority; the lime
  accent is used sparingly for primary actions and selected states only.
*/

/* ------------------------------------------------------------------ */
/* Fonts + tokens                                                      */
/* ------------------------------------------------------------------ */

:root {
    --font-serif: 'DM Serif Display', Georgia, 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --color-bg: #FAFAF8;
    --color-text: #171717;
    --color-text-secondary: #6B6B6B;
    --color-border: #E5E5E0;
    --color-card: #FFFFFF;
    --color-accent: #C7F36B;
    --color-accent-ink: #171717; /* text placed on top of the accent */
    --color-dark: #111111;
    /* Type scale (major third-ish, tuned for editorial headings).
       The 3xl/4xl/5xl steps are fluid (clamp) so hero and article
       headlines scale smoothly between mobile and desktop instead of
       jumping at breakpoints. */
    --text-xs: 0.8125rem;
    --text-sm: 0.9375rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;
    --text-3xl: clamp(1.75rem, 1.4rem + 1.5vw, 2.25rem);
    --text-4xl: clamp(2.125rem, 1.6rem + 2.2vw, 2.875rem);
    --text-5xl: clamp(2.5rem, 1.7rem + 3.5vw, 3.75rem);
    /* Weight + tracking tokens — use these instead of raw numbers so the
       system stays consistent as new components are added. */
    --weight-regular: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;
    --tracking-tight: -0.01em;
    --tracking-normal: 0;
    --tracking-wide: 0.04em;
    --tracking-label: 0.06em;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --content-width: 1100px;
    --article-width: 700px;
    --theme-transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* Dark theme — follows the OS setting by default; an explicit toggle
   (data-theme attribute, set by pwa.js and persisted in localStorage)
   can override that in either direction. Only the handful of tokens
   that mean "page surface / ink" flip; --color-dark and --color-accent
   are intentional fixed-dark / fixed-lime surfaces used the same way
   in both themes (footer, badges, primary buttons), so they're untouched. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-bg: #121210;
        --color-text: #F2F2ED;
        --color-text-secondary: #9F9F97;
        --color-border: #2E2E28;
        --color-card: #1A1A16;
    }
}

:root[data-theme="dark"] {
    --color-bg: #121210;
    --color-text: #F2F2ED;
    --color-text-secondary: #9F9F97;
    --color-border: #2E2E28;
    --color-card: #1A1A16;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    color-scheme: light dark;
    /* No global smooth scrolling: after posting a comment the redirect
       lands on #comments, and smooth scroll made the page visibly slide
       down from the top. Instant jump is calmer. */
    scroll-behavior: auto;
}

:root[data-theme="light"] {
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-optical-sizing: auto;
    font-feature-settings: 'kern' 1, 'liga' 1;
    transition: var(--theme-transition);
}

/* Systematic heading scale — every h1-h6 gets a sane default size even
   where a component doesn't set its own (previously h5/h6 had none at
   all, and h1-h4 fell back to inconsistent per-component overrides).
   A more specific class selector (e.g. `.article h1`, `.hero-split h1`)
   still wins over these element defaults, so existing component sizing
   is unaffected — this only fills the gaps. */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    font-weight: var(--weight-regular); /* the serif display face carries its own personality without bolding */
    line-height: 1.2;
    letter-spacing: var(--tracking-tight);
    margin: 0 0 var(--space-3);
    color: var(--color-text);
}

h1 {
    font-size: var(--text-4xl);
}

h2 {
    font-size: var(--text-3xl);
}

h3 {
    font-size: var(--text-2xl);
}

h4 {
    font-size: var(--text-xl);
}

h5 {
    font-size: var(--text-lg);
}

h6 {
    font-size: var(--text-base);
    font-family: var(--font-sans);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-normal);
}

/* Editorial headlines read better when the last line isn't a single
   orphan word — text-wrap: balance evens out the line lengths. Browsers
   without support just ignore the declaration and wrap normally. */
h1, h2, h3 {
    text-wrap: balance;
}

/* Counts (views, reading time, reactions) read more calmly with
   fixed-width digits instead of each number nudging its neighbors. */
.story-meta {
    font-variant-numeric: tabular-nums;
}

p {
    margin: 0 0 var(--space-4);
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* Respect reduced-motion preference site-wide */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--color-dark);
    color: var(--color-bg);
    padding: var(--space-3) var(--space-4);
    z-index: 100;
}

    .skip-link:focus {
        left: var(--space-4);
        top: var(--space-4);
    }

.container {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 20px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 100px;
    text-decoration: none;
    font-weight: 600;
    font-size: var(--text-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.btn--primary {
    background: var(--color-accent);
    color: var(--color-accent-ink);
}

    .btn--primary:hover {
        background: #b9e75a;
    }

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

/* Loading feedback on form submit (site.js disables + tags the submit
   button) — gives instant confirmation on slower connections that a click
   registered, instead of the button looking dead for a second or two. */
.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

    .btn.is-loading::after {
        content: "";
        position: absolute;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        border: 2px solid var(--color-text);
        border-top-color: transparent;
        animation: btn-spin 700ms linear infinite;
    }

.btn--primary.is-loading::after {
    border-color: var(--color-accent-ink);
    border-top-color: transparent;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.btn--secondary {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-border);
}

    .btn--secondary:hover {
        border-color: var(--color-text);
    }

/* ------------------------------------------------------------------ */
/* Header                                                               */
/* ------------------------------------------------------------------ */

.site-header {
    border-bottom: 1px solid var(--color-border);
    background: var(--color-card);
    position: sticky;
    top: 0;
    z-index: 20;
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: var(--space-7);
    padding: 18px 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.brand__icon {
    flex-shrink: 0;
}

.brand__word {
    font-family: var(--font-serif);
    font-size: 1.7rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--color-text);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    flex: 1;
}

    .main-nav a {
        position: relative;
        color: var(--color-text-secondary);
        text-decoration: none;
        font-size: var(--text-sm);
        font-weight: 500;
        letter-spacing: 0.01em;
        padding: 4px 0;
        transition: color 150ms ease;
    }

        .main-nav a::after {
            content: "";
            position: absolute;
            left: 0;
            right: 0;
            bottom: -2px;
            height: 2px;
            background: var(--color-accent);
            transform: scaleX(0);
            transition: transform 150ms ease;
        }

        .main-nav a:hover {
            color: var(--color-text);
        }

            .main-nav a:hover::after {
                transform: scaleX(1);
            }

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    flex-shrink: 0;
}

.header-actions__link {
    color: var(--color-text);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
}

.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

    .mobile-nav-toggle span {
        display: block;
        height: 2px;
        background: var(--color-text);
        border-radius: 2px;
    }

.mobile-nav {
    display: none; /* default: hidden regardless of viewport width */
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-5) 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-card);
}

    .mobile-nav:not([hidden]) {
        display: flex; /* JS removes [hidden] on toggle */
    }

    .mobile-nav a {
        color: var(--color-text);
        text-decoration: none;
        font-size: var(--text-base);
    }

    .mobile-nav hr {
        border: none;
        border-top: 1px solid var(--color-border);
        margin: 0;
    }

/* ------------------------------------------------------------------ */
/* Hero + notice (homepage placeholder blocks)                         */
/* ------------------------------------------------------------------ */

.hero {
    text-align: center;
    padding: var(--space-8) 0 var(--space-7);
}

    .hero h1 {
        font-size: var(--text-4xl);
        max-width: 14ch;
        margin-left: auto;
        margin-right: auto;
    }

    .hero p {
        color: var(--color-text-secondary);
        font-size: var(--text-lg);
        max-width: 44ch;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: var(--space-6);
    }

.hero-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
}

/* Medium-style split hero: big left-aligned headline + CTA, original
   brand illustration on the right. Structural reference only — the
   illustration itself is Tellhaven's own artwork, not Medium's. */
.hero-split {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: var(--space-6);
    align-items: start;
    padding: var(--space-7) 0;
}

    .hero-split h1 {
        font-size: 4.25rem;
        line-height: 1.05;
        text-align: left;
        max-width: none;
        margin: 0 0 var(--space-5);
    }

/* Animated rotating word in the hero headline ("Everyone has a ___.") —
   cycles through Stories/Life/Students/Family/University/Friendship/
   Relationships/Success, each linking to its real page. Fade+slide via
   a class toggled from site.js; disabled entirely under reduced motion. */
.hero-rotate-word {
    display: inline-block;
    color: inherit;
    text-decoration-line: underline;
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: 0.09em;
    text-underline-offset: 0.06em;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

    .hero-rotate-word:hover {
        text-decoration-color: var(--color-text);
    }

    .hero-rotate-word.is-swapping {
        opacity: 0;
        transform: translateY(0.2em);
    }

@media (prefers-reduced-motion: reduce) {
    .hero-rotate-word {
        transition: none;
    }
}

.hero-split > div:first-child {
    padding-top: var(--space-6);
}

.hero-split p {
    text-align: left;
    max-width: 42ch;
    margin: 0 0 var(--space-6);
    font-size: var(--text-lg);
}

.hero-split .hero-actions {
    justify-content: flex-start;
}

/* Popular Topics quick-links under the hero CTAs — fills the vertical gap
   next to the taller scrolling gallery, and doubles as real above-the-fold
   internal links into the curated Topic pages for SEO/crawl discovery. */
.hero-topics {
    margin-top: var(--space-6);
}

.hero-topics__label {
    display: block;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    margin-bottom: var(--space-3);
}

.hero-topics__pills .topic-pill {
    padding: 8px 16px;
    font-size: var(--text-xs);
}

.hero-split__art {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

    .hero-split__art svg {
        width: 100%;
        max-width: 380px;
        height: auto;
    }

/* Animated hero photo gallery — two columns of stock photos (student life,
   friendship, family) scrolling continuously in opposite directions.
   Purely decorative, so images are alt="" and the whole thing pauses for
   anyone who prefers reduced motion. */
.hero-gallery {
    display: flex;
    width: 100%;
    gap: var(--space-4);
    height: 460px;
    overflow: hidden;
    border-radius: var(--radius-md);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 8%, black 92%, transparent);
    mask-image: linear-gradient(to bottom, transparent, black 8%, black 92%, transparent);
}

.hero-gallery__col {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    flex: 1;
    animation: hero-scroll-up 32s linear infinite;
}

.hero-gallery__col--left {
    animation-name: hero-scroll-up;
    animation-duration: 26s;
}

.hero-gallery__col--down {
    animation-name: hero-scroll-down;
    animation-duration: 38s;
}

.hero-gallery:hover .hero-gallery__col {
    animation-play-state: paused;
}

.hero-gallery__col img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: var(--radius-md);
    display: block;
}

@keyframes hero-scroll-up {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-50%);
    }
}

@keyframes hero-scroll-down {
    from {
        transform: translateY(-50%);
    }

    to {
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-gallery__col {
        animation: none;
    }
}

@media (max-width: 900px) {
    .hero-gallery {
        height: 340px;
    }

    .hero-gallery__col--left {
        display: none;
    }
}

@media (max-width: 900px) {
    .hero-split {
        grid-template-columns: 1fr;
        text-align: center;
        padding: var(--space-7) 0;
    }

        .hero-split h1 {
            font-size: var(--text-4xl);
            text-align: center;
            margin-left: auto;
            margin-right: auto;
        }

        .hero-split p {
            text-align: center;
            margin-left: auto;
            margin-right: auto;
        }

        .hero-split .hero-actions {
            justify-content: center;
        }

    .hero-topics {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-topics__pills {
        justify-content: center;
    }

    .hero-split__art {
        order: -1;
        margin: 0 auto;
    }

        .hero-split__art.hero-gallery {
            max-width: 420px;
            width: 100%;
        }
}

.notice {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    margin-top: var(--space-6);
    color: var(--color-text-secondary);
}

    .notice h1 {
        color: var(--color-text);
        font-size: var(--text-2xl);
    }

.notice--error {
    border-color: #D9534F;
    background: #FDF2F2;
    color: #A33;
}

/* ------------------------------------------------------------------ */
/* Long-form article typography (used from Phase 5 onward)             */
/* ------------------------------------------------------------------ */

.article {
    max-width: var(--article-width);
    margin: 0 auto;
}

    .article h1 {
        font-size: var(--text-3xl);
    }

    .article p,
    .article li {
        font-size: var(--text-lg);
        line-height: 1.75;
        color: var(--color-text);
    }

    .article p {
        margin-bottom: var(--space-5);
    }

/* ------------------------------------------------------------------ */
/* Footer                                                               */
/* ------------------------------------------------------------------ */

.site-footer {
    background: var(--color-dark);
    color: #EDEDED;
    padding: var(--space-7) 0 var(--space-5);
    margin-top: var(--space-8);
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
}

.footer-statement {
    font-weight: 600;
    margin: 0;
}

.footer-columns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

    .footer-columns h3 {
        font-family: var(--font-sans);
        font-size: var(--text-xs);
        font-weight: 600;
        color: #9A9A9A;
        margin: 0 0 var(--space-3);
    }

    .footer-columns a {
        display: block;
        color: #EDEDED;
        text-decoration: none;
        font-size: var(--text-sm);
        margin-bottom: var(--space-2);
    }

        .footer-columns a:hover {
            color: var(--color-accent);
        }

.footer-copyright {
    color: #8A8A8A;
    font-size: var(--text-xs);
    border-top: 1px solid #2A2A2A;
    padding-top: var(--space-4);
    margin: 0;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                           */
/* ------------------------------------------------------------------ */

@media (max-width: 900px) {
    .main-nav,
    .header-actions {
        display: none;
    }

    .mobile-nav-toggle {
        display: flex;
        margin-left: auto;
    }

    .site-header__inner {
        justify-content: space-between;
    }
}

@media (max-width: 640px) {
    .footer-columns {
        grid-template-columns: 1fr 1fr;
    }

    .hero h1 {
        font-size: var(--text-3xl);
    }

    .hero-actions {
        flex-direction: column;
    }

        .hero-actions .btn {
            width: 100%;
        }
}

/* ------------------------------------------------------------------ */
/* Phase 4 — homepage sections, story cards, listings                  */
/* ------------------------------------------------------------------ */

.section {
    padding: var(--space-8) 0;
    border-top: 1px solid var(--color-border);
}

    .section:first-of-type {
        border-top: none;
    }

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

    .section-header h2 {
        font-size: var(--text-2xl);
        margin: 0;
    }

    .section-header p {
        color: var(--color-text-secondary);
        margin: var(--space-1) 0 0;
        font-size: var(--text-sm);
    }

    .section-header a {
        font-size: var(--text-sm);
        font-weight: 600;
        text-decoration: none;
        color: var(--color-text);
        white-space: nowrap;
    }

        .section-header a:hover {
            text-decoration: underline;
        }

/* Featured story — larger, editorial treatment */
.featured-story {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-7);
    align-items: center;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-7);
}

.featured-story__cover {
    background: var(--color-dark);
    border-radius: var(--radius-md);
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent);
    font-family: var(--font-serif);
    font-size: var(--text-lg);
    padding: var(--space-5);
    text-align: center;
}

.featured-story h3 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-3);
}

.featured-story .story-meta {
    margin-bottom: var(--space-4);
}

/* Story grid + card */
.story-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-5);
}

.story-grid--2 {
    grid-template-columns: 1fr;
}

.story-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

    .story-card:hover {
        border-color: var(--color-text);
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .story-card:hover {
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    }
}

:root[data-theme="dark"] .story-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.story-card__image {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .story-card__image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.story-card__image-letter {
    font-family: var(--font-serif);
    font-size: 3rem;
    color: var(--color-accent);
    opacity: 0.9;
}

/* No cover image set — a tasteful branded placeholder (dark, tinted
   with the accent) instead of a blank box. 5 subtle variants, picked
   deterministically per story, so a grid of un-illustrated cards still
   reads as varied rather than repetitive. */
.story-card__image--0 {
    background: linear-gradient(135deg, var(--color-dark), color-mix(in srgb, var(--color-dark) 80%, var(--color-accent) 20%));
}

.story-card__image--1 {
    background: linear-gradient(200deg, var(--color-dark), color-mix(in srgb, var(--color-dark) 70%, var(--color-accent) 30%));
}

.story-card__image--2 {
    background: linear-gradient(60deg, color-mix(in srgb, var(--color-dark) 85%, var(--color-accent) 15%), var(--color-dark));
}

.story-card__image--3 {
    background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--color-dark) 75%, var(--color-accent) 25%), var(--color-dark));
}

.story-card__image--4 {
    background: linear-gradient(160deg, var(--color-dark), color-mix(in srgb, var(--color-dark) 90%, var(--color-accent) 10%));
}

.story-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    padding: var(--space-5);
}

.story-card__topic {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-accent);
    padding: 2px 10px;
    border-radius: 100px;
    margin-bottom: var(--space-3);
    width: fit-content;
}

.story-card h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
}

.story-card p.excerpt {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
    flex: 1;
    /* Cards are a fixed-width grid/carousel item — an unclamped excerpt
       (especially a long Urdu paragraph) makes one card much taller
       than its neighbors. 3 lines keeps every card roughly the same
       height regardless of content length. */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.story-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

    .story-meta .dot::before {
        content: "·";
        margin: 0 4px;
    }

/* Topic pill grid (Explore Topics) */
.topic-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.topic-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 10px 18px;
    border: 1px solid var(--color-border);
    border-radius: 100px;
    text-decoration: none;
    color: var(--color-text);
    font-size: var(--text-sm);
    font-weight: 500;
    background: var(--color-card);
    transition: border-color 150ms ease;
}

    .topic-pill:hover {
        border-color: var(--color-text);
    }

.topic-pill--active {
    background: var(--color-text);
    color: #fff;
    border-color: var(--color-text);
}

    .topic-pill--active .topic-pill__count {
        color: rgba(255, 255, 255, 0.7);
    }

.topic-pill__count {
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
}

/* Give Me a Story */
.discovery-cta {
    text-align: center;
    background: var(--color-dark);
    color: var(--color-bg);
    border-radius: var(--radius-md);
    padding: var(--space-8) var(--space-5);
}

    .discovery-cta h2 {
        color: var(--color-bg);
        font-size: var(--text-2xl);
        margin-bottom: var(--space-2);
    }

    .discovery-cta p {
        color: #B5B5B0;
        margin-bottom: var(--space-5);
    }

/* Final CTA */
.final-cta {
    text-align: center;
    padding: var(--space-8) 0;
}

    .final-cta h2 {
        font-size: var(--text-3xl);
    }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-7);
}

    .pagination a,
    .pagination span {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        border-radius: var(--radius-sm);
        text-decoration: none;
        color: var(--color-text);
        font-size: var(--text-sm);
        border: 1px solid transparent;
    }

        .pagination a:hover {
            border-color: var(--color-border);
        }

    .pagination .active {
        background: var(--color-dark);
        color: var(--color-bg);
    }

/* Author cards / directory */
.author-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
}

.author-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
}

.author-card__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-dark);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: var(--text-lg);
    margin-bottom: var(--space-3);
    overflow: hidden;
}

    .author-card__avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.author-card h3 {
    font-size: var(--text-base);
    font-family: var(--font-sans);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.author-card p {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    margin: 0;
}

/* Author profile page */
.author-profile-header {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    padding: var(--space-7) 0;
}

    .author-profile-header .author-card__avatar {
        width: 72px;
        height: 72px;
        font-size: var(--text-2xl);
    }

/* Empty states */
.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-5);
    color: var(--color-text-secondary);
}

.empty-state__icon {
    color: var(--color-border);
    margin-bottom: var(--space-4);
}

/* Search form */
.search-form {
    display: flex;
    gap: var(--space-3);
    margin: var(--space-6) 0;
}

    .search-form input[type="search"] {
        flex: 1;
        padding: 12px 16px;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-sm);
        font-size: var(--text-base);
        font-family: var(--font-sans);
        background: var(--color-card);
        color: var(--color-text);
    }

/* Legal/editorial static pages */
.page-content h2 {
    font-size: var(--text-xl);
    margin-top: var(--space-6);
}

.page-content ul {
    padding-left: 1.25em;
}

.page-content li {
    margin-bottom: var(--space-2);
}

@media (max-width: 900px) {
    .featured-story {
        grid-template-columns: 1fr;
    }

    .story-grid,
    .story-grid--2,
    .author-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .story-grid,
    .story-grid--2,
    .author-grid {
        grid-template-columns: 1fr;
    }

    .story-card {
        flex-direction: column;
    }

    .story-card__image {
        width: 100%;
        aspect-ratio: 16 / 9;
    }

    .author-profile-header {
        flex-direction: column;
        text-align: center;
    }

    .search-form {
        flex-direction: column;
    }
}

/* ------------------------------------------------------------------ */
/* Phase 5 — auth pages, forms, story editor                           */
/* ------------------------------------------------------------------ */

.header-actions__link--button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--color-text);
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 500;
}

    .header-actions__link--button:hover {
        text-decoration: underline;
    }

.auth-page {
    display: flex;
    justify-content: center;
    padding: var(--space-8) 0;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-7);
}

    .auth-card h1 {
        font-size: var(--text-2xl);
        margin-bottom: var(--space-2);
    }

.auth-subtitle {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-6);
}

.auth-switch {
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin: var(--space-5) 0 0;
}

    .auth-switch a {
        color: var(--color-text);
        font-weight: 600;
        text-decoration: none;
    }

.form-group {
    margin-bottom: var(--space-4);
}

    .form-group label {
        display: block;
        font-size: var(--text-sm);
        font-weight: 600;
        margin-bottom: var(--space-2);
    }

.form-input,
textarea.form-input,
select.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    background: var(--color-bg);
    color: var(--color-text);
}

    .form-input:focus {
        outline: 2px solid var(--color-text);
        outline-offset: 1px;
    }

.form-error {
    display: block;
    color: #B3261E;
    font-size: var(--text-xs);
    margin-top: var(--space-1);
}

.form-error-summary {
    color: #B3261E;
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

    .form-error-summary ul {
        margin: 0;
        padding-left: 1.2em;
    }

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
    font-size: var(--text-sm);
}

.form-hint {
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    margin-top: var(--space-1);
}

.form-hint-link {
    display: inline-block;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    margin-top: var(--space-1);
    text-decoration: underline;
}

    .form-hint-link:hover {
        color: var(--color-text);
    }

/* Story editor layout */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--space-7);
    padding: var(--space-7) 0;
    align-items: start;
}

.editor-main input.form-input.editor-title {
    font-family: var(--font-serif);
    font-size: var(--text-2xl);
    border: none;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    padding: var(--space-3) 0;
}

.editor-main input.form-input.editor-subtitle {
    border: none;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    padding: var(--space-3) 0;
    color: var(--color-text-secondary);
}

.editor-main textarea.editor-content {
    border: none;
    padding: var(--space-4) 0;
    min-height: 420px;
    font-size: var(--text-lg);
    line-height: 1.75;
    resize: vertical;
}

    .editor-main textarea.editor-content:focus,
    .editor-main input.editor-title:focus,
    .editor-main input.editor-subtitle:focus {
        outline: none;
    }

.editor-toolbar {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.editor-toolbar__btn {
    min-width: 36px;
    height: 36px;
    padding: 0 var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm, 6px);
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
    font-size: var(--text-sm);
}

    .editor-toolbar__btn:hover {
        background: var(--color-card);
    }

.editor-content[contenteditable] {
    border: none;
    padding: var(--space-4) 0;
    min-height: 420px;
    font-size: var(--text-lg);
    line-height: 1.75;
    outline: none;
}

    .editor-content[contenteditable]:empty::before {
        content: attr(data-placeholder);
        color: var(--color-text-secondary);
    }

    .editor-content[contenteditable] img {
        max-width: 100%;
        border-radius: var(--radius-md);
        display: block;
        margin: var(--space-4) 0;
    }

    .editor-content[contenteditable] blockquote {
        border-inline-start: 3px solid var(--color-accent);
        padding-inline-start: var(--space-4);
        color: var(--color-text-secondary);
        font-style: italic;
        margin: var(--space-4) 0;
    }

.cover-image-preview {
    margin-bottom: var(--space-3);
}

    .cover-image-preview img {
        width: 100%;
        border-radius: var(--radius-md);
        display: block;
        margin-bottom: var(--space-2);
    }

/* Rendered story body — cover image on the article page, and inline
   images/quotes/lists inside the (now-HTML) content itself. */
.story-cover-image {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin: var(--space-5) 0;
}

.story-body img {
    max-width: 100%;
    border-radius: var(--radius-md);
    display: block;
    margin: var(--space-5) auto;
}

.story-body blockquote {
    border-inline-start: 3px solid var(--color-accent);
    padding-inline-start: var(--space-4);
    color: var(--color-text-secondary);
    font-style: italic;
    margin: var(--space-5) 0;
}

.story-body h2 {
    margin-top: var(--space-6);
}

.story-body p,
.story-body div,
.editor-content[contenteditable] div {
    margin: 0 0 1em;
}

.editor-sidebar {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    position: sticky;
    top: 90px;
}

    .editor-sidebar h3 {
        font-size: var(--text-sm);
        font-family: var(--font-sans);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--color-text-secondary);
        margin: 0 0 var(--space-3);
    }

    .editor-sidebar .form-group:last-child {
        margin-bottom: 0;
    }

.editor-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border);
}

.autosave-status {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    margin-top: var(--space-3);
}

.identity-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

    .identity-options label {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        font-weight: 500;
        font-size: var(--text-sm);
    }

.suggestion-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.suggestion-chip {
    font-size: var(--text-xs);
    padding: 4px 10px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 100px;
}

.status-badge {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 100px;
}

.status-badge--draft {
    background: #EFEFEF;
    color: #6B6B6B;
}

.status-badge--public {
    background: var(--color-accent);
    color: var(--color-accent-ink);
}

.owner-story-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border);
}

.owner-story-row__actions {
    display: flex;
    gap: var(--space-3);
    font-size: var(--text-sm);
}

    .owner-story-row__actions form {
        display: inline;
    }

    .owner-story-row__actions button {
        background: none;
        border: none;
        padding: 0;
        font: inherit;
        color: #B3261E;
        cursor: pointer;
    }

@media (max-width: 900px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }

    .editor-sidebar {
        position: static;
    }
}

/* ------------------------------------------------------------------ */
/* Phase 8 — comments, reactions, bookmarks, notifications             */
/* ------------------------------------------------------------------ */

.notif-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #B3261E;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 100px;
    margin-left: 4px;
    vertical-align: middle;
}

/* Reactions */
.reaction-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

    .reaction-bar form {
        display: inline;
    }

.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: 100px;
    background: var(--color-card);
    color: var(--color-text);
    font-size: var(--text-sm);
    cursor: pointer;
    font-family: var(--font-sans);
}

    .reaction-btn:hover {
        border-color: var(--color-text);
    }

.reaction-btn--active {
    background: var(--color-dark);
    color: var(--color-bg);
    border-color: var(--color-dark);
}

.reaction-btn .count {
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
}

.reaction-btn--active .count {
    color: #B5B5B0;
}

/* Bookmark button */
.bookmark-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-card);
    color: var(--color-text);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-sans);
}

/* Social share row on the story page */
.share-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.share-bar__label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-right: var(--space-1);
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-card);
    color: var(--color-text);
    cursor: pointer;
    transition: background 150ms ease, transform 150ms ease;
}

    .share-btn:hover {
        background: var(--color-border);
        transform: translateY(-1px);
    }

.bookmark-btn--active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-accent-ink);
}

/* Comments */
.comment-form textarea {
    min-height: 90px;
}

.comment-thread {
    margin-top: var(--space-6);
}

    .comment-thread > .comment {
        border-top: 1px solid var(--color-border);
    }

        .comment-thread > .comment:first-child {
            border-top: none;
        }

.comment {
    padding: var(--space-4) 0;
}

.comment__row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.comment__avatar {
    margin-top: 2px;
}

/* Nested replies get a slightly smaller avatar — keeps the visual
   weight on the top-level comment, same idea Medium/YouTube use. */
.comment__replies .comment__avatar {
    width: 28px;
    height: 28px;
    font-size: var(--text-sm);
}

.comment__col {
    flex: 1;
    min-width: 0;
}

.comment__header {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin-bottom: 2px;
}

.comment__author {
    font-weight: 600;
    font-size: var(--text-sm);
    text-decoration: none;
    color: var(--color-text);
}

.comment__meta {
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
}

.comment__body {
    font-size: var(--text-sm);
    line-height: 1.5;
    margin-bottom: var(--space-2);
    white-space: pre-wrap;
}

.comment__actions {
    display: flex;
    gap: var(--space-4);
    font-size: var(--text-xs);
}

    .comment__actions button,
    .comment__actions a {
        background: none;
        border: none;
        padding: 0;
        color: var(--color-text-secondary);
        cursor: pointer;
        font-size: var(--text-xs);
        font-weight: 600;
        text-decoration: none;
    }

        .comment__actions button:hover,
        .comment__actions a:hover {
            color: var(--color-text);
            text-decoration: underline;
        }

.comment__replies {
    margin-top: var(--space-3);
    margin-left: var(--space-5);
    border-left: 2px solid var(--color-border);
    padding-left: var(--space-4);
}

    .comment__replies .comment {
        padding: var(--space-3) 0;
    }

        .comment__replies .comment + .comment {
            border-top: 1px solid var(--color-border);
        }

.reply-form {
    margin-top: var(--space-3);
    display: none;
}

    .reply-form.open {
        display: block;
    }

/* ------------------------------------------------------------------ */
/* Phase 11 — accessibility utility                                    */
/* ------------------------------------------------------------------ */

/* Visually hidden but still announced by screen readers (was referenced
   on the search page's label but never actually defined — Phase 11 audit). */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ------------------------------------------------------------------ */
/* Medium-inspired: avatar circles + feed-style story rows             */
/* ------------------------------------------------------------------ */

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-dark);
    color: var(--color-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: var(--text-base);
    flex-shrink: 0;
    overflow: hidden;
}

    .avatar-circle img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

/* Profile edit page — photo upload widget */
.profile-photo-widget {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.profile-photo-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
}

    .profile-photo-preview img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.avatar-circle--sm {
    width: 24px;
    height: 24px;
    font-size: var(--text-xs);
}

.avatar-circle--lg {
    width: 56px;
    height: 56px;
    font-size: var(--text-xl);
}

/* Feed row — Medium's signature listing pattern: byline on top, bold
   serif title, gray excerpt, meta row below, optional thumbnail block
   on the right. Used on the /stories feed instead of a card grid. */
.feed-row {
    display: flex;
    gap: var(--space-6);
    padding: var(--space-6) 0;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: inherit;
}

    .feed-row:first-child {
        padding-top: 0;
    }

.feed-row__main {
    flex: 1;
    min-width: 0;
}

.feed-row__byline {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

    .feed-row__byline strong {
        color: var(--color-text);
        font-weight: 600;
    }

.feed-row h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
    line-height: 1.3;
}

.feed-row p.excerpt {
    color: var(--color-text-secondary);
    font-size: var(--text-base);
    line-height: 1.5;
    margin-bottom: var(--space-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-row__meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.feed-row__stats {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-3);
}

.feed-row__stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

    .feed-row__stat svg {
        width: 16px;
        height: 16px;
    }

.feed-row__thumb {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-border);
    font-family: var(--font-serif);
    font-size: var(--text-2xl);
    overflow: hidden;
}

    .feed-row__thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

@media (max-width: 640px) {
    .feed-row {
        gap: var(--space-4);
    }

    .feed-row__thumb {
        width: 80px;
        height: 80px;
    }

    .feed-row h3 {
        font-size: var(--text-lg);
    }

    /* Deep reply threads (reply-to-a-reply, several levels) would
       otherwise keep adding margin-left at every level and squeeze the
       actual text into a sliver on a narrow phone. Cap the indent from
       the 3rd nested level onward — depth is still visible (border),
       it just stops compounding. */
    .comment__replies .comment__replies .comment__replies {
        margin-left: var(--space-3);
        padding-left: var(--space-3);
    }
}

.feed-list {
    max-width: 720px;
}

.feed-sentinel {
    text-align: center;
    padding: var(--space-6) 0;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

/* ------------------------------------------------------------------ */
/* Authenticated home feed — sidebar + feed + picks panel               */
/* ------------------------------------------------------------------ */

.feed-shell {
    display: grid;
    grid-template-columns: 220px 1fr 300px;
    gap: var(--space-7);
    padding: var(--space-6) 40px var(--space-6) 0;
    max-width: 1400px;
    align-items: start;
    transition: grid-template-columns 200ms ease;
}

    .feed-shell.is-collapsed {
        grid-template-columns: 64px 1fr 300px;
    }

.feed-sidebar {
    position: sticky;
    top: 90px;
    align-self: start;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    padding: 0 var(--space-4) var(--space-6) var(--space-4);
    transition: width 200ms ease;
}

.feed-sidebar__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    margin-bottom: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: color 150ms ease, border-color 150ms ease;
}

    .feed-sidebar__toggle:hover {
        color: var(--color-text);
        border-color: var(--color-text);
    }

    .feed-sidebar__toggle svg {
        width: 20px;
        height: 20px;
    }

.feed-shell.is-collapsed .feed-sidebar__toggle svg path:last-child {
    transform: scaleX(-1);
    transform-origin: center;
}

.feed-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.feed-sidebar__link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-text);
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
}

    .feed-sidebar__link:hover {
        background: var(--color-card);
    }

.feed-sidebar__link--active {
    font-weight: 700;
}

.feed-sidebar__icon {
    width: 21px;
    height: 21px;
    flex-shrink: 0;
    color: var(--color-text-secondary);
}

.feed-sidebar__link--active .feed-sidebar__icon {
    color: var(--color-text);
}

/* Collapsed state — icon rail only, no labels, no wide CTA button */
.feed-shell.is-collapsed .feed-sidebar__label,
.feed-shell.is-collapsed .feed-sidebar__write {
    display: none;
}

.feed-shell.is-collapsed .feed-sidebar__link {
    justify-content: center;
    padding: 10px;
}

.feed-tabs {
    display: flex;
    gap: var(--space-5);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-2);
}

.feed-tab {
    padding: var(--space-3) 0;
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.feed-tab--active {
    color: var(--color-text);
    border-bottom-color: var(--color-text);
}

.feed-picks {
    position: sticky;
    top: 90px;
}

.feed-picks__section {
    margin-bottom: var(--space-6);
}

    .feed-picks__section h3 {
        font-family: var(--font-sans);
        font-size: var(--text-sm);
        font-weight: 700;
        margin-bottom: var(--space-3);
    }

.feed-picks__item {
    display: block;
    text-decoration: none;
    color: var(--color-text);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-2);
}

    .feed-picks__item:last-child {
        border-bottom: none;
    }

.feed-picks__eyebrow {
    display: block;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    margin-bottom: 2px;
}

.feed-picks__item strong {
    font-size: var(--text-sm);
    line-height: 1.3;
    display: block;
}

@media (max-width: 1000px) {
    .feed-shell {
        grid-template-columns: 1fr;
        max-width: none;
        margin-left: 0;
        padding: var(--space-5) 20px;
    }

    .feed-sidebar,
    .feed-picks {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        padding: 0;
    }

    .feed-shell.is-collapsed .feed-sidebar {
        width: auto;
        padding: 0;
    }

    .feed-sidebar nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .feed-sidebar__toggle {
        display: none;
    }
}

/* Narrow phones: 6 icon+label links wrapping into ragged rows looks
   cluttered. Below 480px, drop to a single-row icon bar instead — the
   label stays for screen readers (sr-only pattern), it's just not
   painted, so nothing is lost for assistive tech. */
@media (max-width: 480px) {
    .feed-sidebar nav {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: var(--space-1, 4px);
    }

    .feed-sidebar__link {
        flex: 1;
        justify-content: center;
        padding: 10px 2px;
    }

    .feed-sidebar__label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

/* ------------------------------------------------------------------ */
/* Medium-style header: icon buttons + account avatar dropdown          */
/* ------------------------------------------------------------------ */

.header-actions__icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--color-text);
    text-decoration: none;
}

    .header-actions__icon-btn:hover {
        background: var(--color-bg);
    }

    .header-actions__icon-btn svg {
        width: 20px;
        height: 20px;
    }

.notif-badge--dot {
    position: absolute;
    top: 6px;
    right: 7px;
    width: 8px;
    height: 8px;
    padding: 0;
    min-width: 0;
}

.avatar-circle--button {
    border: none;
    cursor: pointer;
    font-family: var(--font-serif);
}

.account-menu {
    position: relative;
}

/* Reuses .reply-form's hidden-by-default / .open toggle mechanics from
   site.js, but repositioned + restyled as a floating dropdown card. */
.account-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: var(--space-4) 0;
    z-index: 30;
}

.account-dropdown__header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-4) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-2);
}

    .account-dropdown__header strong {
        display: block;
        font-size: var(--text-sm);
    }

.account-dropdown a {
    display: block;
    padding: 10px var(--space-4);
    color: var(--color-text);
    text-decoration: none;
    font-size: var(--text-sm);
}

    .account-dropdown a:hover {
        background: var(--color-bg);
    }

.account-dropdown hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-2) 0;
}

.account-dropdown__signout {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 10px var(--space-4);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
    color: var(--color-text);
    cursor: pointer;
}

    .account-dropdown__signout:hover {
        background: var(--color-bg);
    }

    .account-dropdown__signout .story-meta {
        display: block;
        margin-top: 2px;
    }

/* ------------------------------------------------------------------ */
/* About page — Medium-style dark hero + linked rows                    */
/* ------------------------------------------------------------------ */

.about-hero {
    background: var(--color-dark);
    color: var(--color-bg);
    padding: var(--space-8) 0;
    position: relative;
    overflow: hidden;
}

.about-hero__dots span {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-accent);
    opacity: 0.6;
}

.about-hero h1 {
    color: #fff;
    font-size: 3.5rem;
    line-height: 1.1;
    max-width: 16ch;
    margin: 0 0 var(--space-6);
    position: relative;
}

.about-hero p {
    color: #C9C9C9;
    font-size: var(--text-lg);
    max-width: 62ch;
    line-height: 1.6;
    margin-bottom: var(--space-4);
    position: relative;
}

.about-rows {
    background: var(--color-dark);
}

.about-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6) 0;
    border-top: 1px solid #2A2A2A;
    text-decoration: none;
    color: #fff;
}

    .about-row:last-child {
        border-bottom: 1px solid #2A2A2A;
    }

    .about-row h2 {
        color: #fff;
        font-size: 2.5rem;
        margin: 0;
    }

.about-row__arrow {
    font-size: 2rem;
    color: #fff;
    transition: transform 150ms ease;
}

.about-row:hover .about-row__arrow {
    transform: translateX(6px);
}

/* ------------------------------------------------------------------ */
/* Membership page — same structural pattern as Medium's, priced Free   */
/* ------------------------------------------------------------------ */

.membership-hero {
    background: var(--color-dark);
    color: #fff;
    text-align: center;
    padding: var(--space-8) 40px;
    position: relative;
    overflow: hidden;
}

    .membership-hero h1 {
        color: #fff;
        font-family: var(--font-serif);
        font-size: 3.5rem;
        line-height: 1.1;
        max-width: 18ch;
        margin: 0 auto var(--space-5);
        position: relative;
    }

    .membership-hero p {
        color: #C9C9C9;
        font-size: var(--text-lg);
        max-width: 56ch;
        line-height: 1.6;
        margin: 0 auto var(--space-6);
        position: relative;
    }

    .membership-hero .hero-actions {
        justify-content: center;
        position: relative;
    }

    .membership-hero .btn--secondary {
        color: #fff;
        border-color: rgba(255, 255, 255, 0.45);
    }

        .membership-hero .btn--secondary:hover {
            border-color: #fff;
            background: rgba(255, 255, 255, 0.08);
        }

.membership-features {
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--space-8) 40px;
    text-align: center;
}

    .membership-features h2 {
        font-size: 2.25rem;
    }

    .membership-features > p {
        color: var(--color-text-secondary);
        font-size: var(--text-lg);
        max-width: 56ch;
        margin: var(--space-3) auto var(--space-7);
    }

.membership-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
    text-align: left;
}

.membership-feature {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin: 0;
    transition: border-color 150ms ease, transform 150ms ease;
}

    .membership-feature:hover {
        border-color: var(--color-text);
        transform: translateY(-2px);
    }

.membership-feature__icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
    color: var(--color-accent-ink);
}

    .membership-feature__icon svg {
        width: 20px;
        height: 20px;
    }

.membership-feature h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
}

.membership-feature p {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    margin: 0;
}

@media (max-width: 700px) {
    .membership-feature-grid {
        grid-template-columns: 1fr;
    }
}

.membership-plan-card {
    max-width: 400px;
    margin: 0 auto;
    background: var(--color-card);
    border: 2px solid var(--color-text);
    border-radius: 20px;
    padding: var(--space-8) var(--space-7) var(--space-7);
    text-align: center;
    position: relative;
    box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.25);
}

    .membership-plan-card::before {
        content: "Always Free";
        position: absolute;
        top: -15px;
        left: 50%;
        transform: translateX(-50%);
        background: var(--color-accent);
        color: var(--color-accent-ink);
        font-size: var(--text-xs);
        font-weight: 700;
        letter-spacing: 0.03em;
        text-transform: uppercase;
        padding: 5px 18px;
        border-radius: 100px;
        white-space: nowrap;
    }

    .membership-plan-card .price {
        font-family: var(--font-serif);
        font-size: 3.5rem;
        margin: var(--space-5) 0 var(--space-4);
        color: var(--color-text);
    }

        .membership-plan-card .price span {
            font-size: var(--text-base);
            color: var(--color-text-secondary);
            font-family: var(--font-sans);
        }

@media (max-width: 900px) {
    .about-hero h1 {
        font-size: var(--text-3xl);
    }

    .about-row h2 {
        font-size: var(--text-2xl);
    }

    .membership-hero h1 {
        font-size: var(--text-3xl);
    }
}

/* ---------------------------------------------------------------
   Legal pages (Privacy/Terms) — sticky "on this page" nav beside a
   readable content column. Section anchors let the nav jump straight
   to each heading instead of the page being one long undifferentiated
   scroll — same idea as most SaaS legal pages (Stripe, Notion, etc).
   --------------------------------------------------------------- */
.legal-page {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: var(--space-8);
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--space-7) 40px var(--space-8);
    align-items: start;
}

.legal-page__nav {
    position: sticky;
    top: 110px;
}

.legal-page__nav-label {
    display: block;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-3);
}

.legal-page__nav a {
    display: block;
    padding: 6px 0 6px var(--space-3);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    border-left: 2px solid var(--color-border);
    transition: color 150ms ease, border-color 150ms ease;
}

    .legal-page__nav a:hover {
        color: var(--color-text);
        border-left-color: var(--color-text);
    }

.legal-page__content h1 {
    font-family: var(--font-serif);
    font-size: var(--text-3xl);
    margin-bottom: var(--space-3);
}

.legal-page__meta {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-7);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.legal-page__content h2 {
    font-size: var(--text-xl);
    scroll-margin-top: 110px; /* so the sticky header doesn't cover the heading when jumped to */
    margin: var(--space-7) 0 var(--space-3);
}

.legal-page__content p {
    color: var(--color-text);
    line-height: 1.75;
    margin-bottom: var(--space-4);
}

.legal-page__content ul {
    margin: 0 0 var(--space-5);
    padding-left: var(--space-5);
}

.legal-page__content li {
    color: var(--color-text);
    line-height: 1.75;
    margin-bottom: var(--space-2);
}

@media (max-width: 900px) {
    .legal-page {
        grid-template-columns: 1fr;
        padding: var(--space-6) 20px;
    }

    .legal-page__nav {
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-3);
        margin-bottom: var(--space-6);
    }

    .legal-page__nav-label {
        width: 100%;
    }

    .legal-page__nav a {
        border-left: none;
        border: 1px solid var(--color-border);
        border-radius: 100px;
        padding: 6px 14px;
    }
}

/* ---------------------------------------------------------------
   Contact page — centered intro + three method cards
   --------------------------------------------------------------- */
.contact-hero {
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
    padding: var(--space-8) 40px var(--space-6);
}

    .contact-hero h1 {
        font-family: var(--font-serif);
        font-size: 3rem;
        margin-bottom: var(--space-4);
    }

    .contact-hero p {
        color: var(--color-text-secondary);
        font-size: var(--text-lg);
    }

.contact-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 40px var(--space-8);
}

.contact-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    text-align: center;
    transition: border-color 150ms ease, transform 150ms ease;
}

    .contact-card:hover {
        border-color: var(--color-text);
        transform: translateY(-2px);
    }

.contact-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
    color: var(--color-accent-ink);
}

    .contact-card__icon svg {
        width: 22px;
        height: 22px;
    }

.contact-card h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
}

.contact-card p {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.contact-card a.contact-card__email {
    display: inline-block;
    color: var(--color-text);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid var(--color-accent);
    word-break: break-word;
}

    .contact-card a.contact-card__email:hover {
        color: var(--color-text-secondary);
    }

.contact-note {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 40px var(--space-8);
    text-align: center;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

@media (max-width: 900px) {
    .contact-cards {
        grid-template-columns: 1fr;
    }
}

/* ---------------------------------------------------------------
   Blog page (/blog) — Medium publication-page style masthead,
   tabs, and the single big "most viewed" spotlight story.
   --------------------------------------------------------------- */
.blog-masthead {
    text-align: center;
    padding: var(--space-8) var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.blog-masthead__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--color-dark);
    margin-bottom: var(--space-4);
}

    .blog-masthead__icon img {
        display: block;
    }

.blog-masthead h1 {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-3);
}

.blog-masthead__tagline {
    color: var(--color-text-secondary);
    font-size: var(--text-lg);
    max-width: 520px;
    margin: 0 auto var(--space-6);
}

.blog-tabs {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
}

.blog-tab {
    padding: 10px 20px;
    border-radius: 100px;
    text-decoration: none;
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: var(--text-sm);
    border: 1px solid transparent;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

    .blog-tab:hover {
        border-color: var(--color-border);
        color: var(--color-text);
    }

.blog-tab--active {
    background: var(--color-dark);
    color: var(--color-bg);
}

    .blog-tab--active:hover {
        color: var(--color-bg);
    }

.blog-spotlight {
    display: flex;
    gap: var(--space-6);
    align-items: center;
    text-decoration: none;
    color: inherit;
    padding: var(--space-6) 0 var(--space-7);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-6);
}

.blog-spotlight__thumb {
    width: 220px;
    height: 160px;
    flex-shrink: 0;
    background: var(--color-accent);
    color: var(--color-accent-ink);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: var(--text-4xl);
}

.blog-spotlight__body {
    flex: 1;
    min-width: 0;
}

    .blog-spotlight__body h2 {
        font-size: var(--text-3xl);
        margin: var(--space-2) 0;
        line-height: 1.25;
    }

.blog-spotlight__subtitle {
    color: var(--color-text-secondary);
    font-size: var(--text-lg);
    margin-bottom: var(--space-4);
}

@media (max-width: 640px) {
    .blog-masthead h1 {
        font-size: var(--text-3xl);
    }

    .blog-spotlight {
        flex-direction: column;
        align-items: stretch;
    }

    .blog-spotlight__thumb {
        width: 100%;
        height: 140px;
    }
}

/* ------------------------------------------------------------------ */
/* PWA install banner                                                  */
/* ------------------------------------------------------------------ */

.pwa-install-banner {
    position: fixed;
    right: var(--space-5);
    bottom: var(--space-5);
    bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
    left: auto;
    z-index: 60;
    animation: pwa-banner-rise 0.35s ease-out;
}

@keyframes pwa-banner-rise {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pwa-install-banner__inner {
    width: 340px;
    max-width: calc(100vw - var(--space-8));
    background: var(--color-dark);
    color: var(--color-bg);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.4);
}

    .pwa-install-banner__inner img {
        flex-shrink: 0;
        border-radius: var(--radius-sm);
    }

.pwa-install-banner__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: var(--text-sm);
}

    .pwa-install-banner__text strong {
        font-size: var(--text-base);
    }

    .pwa-install-banner__text span {
        color: rgba(250, 250, 248, 0.7);
        font-size: var(--text-xs);
    }

.pwa-install-banner__actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex-shrink: 0;
}

    .pwa-install-banner__actions button {
        font-family: var(--font-sans);
        border-radius: var(--radius-sm);
        border: none;
        cursor: pointer;
        white-space: nowrap;
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-sm);
    }

    .pwa-install-banner__actions [data-pwa-install] {
        background: var(--color-accent);
        color: var(--color-accent-ink);
        font-weight: 600;
    }

    .pwa-install-banner__actions [data-pwa-dismiss] {
        background: transparent;
        color: rgba(250, 250, 248, 0.7);
    }

        .pwa-install-banner__actions [data-pwa-dismiss]:hover {
            color: var(--color-bg);
        }

@media (max-width: 480px) {
    .pwa-install-banner {
        left: var(--space-4);
        right: var(--space-4);
    }

    .pwa-install-banner__inner {
        width: auto;
        max-width: none;
        flex-wrap: wrap;
    }

    .pwa-install-banner__actions {
        flex-direction: row;
        width: 100%;
        justify-content: flex-end;
    }
}

/* ------------------------------------------------------------------ */
/* Dark mode — secondary surface refinements                           */
/* A few components use hardcoded colors (rather than the --color-*    */
/* tokens) because they're deliberately neutral/muted in light mode.   */
/* Give just those a dark-mode-appropriate variant so nothing reads as */
/* a stray light box against the dark page background.                */
/* ------------------------------------------------------------------ */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .status-badge--draft {
        background: #2A2A24;
        color: #B5B5AD;
    }

    :root:not([data-theme="light"]) .notice--error {
        background: #2A1514;
        border-color: #7A2E29;
        color: #F0A29C;
    }

    :root:not([data-theme="light"]) .site-footer {
        background: var(--color-card);
        border-top: 1px solid var(--color-border);
    }
}

:root[data-theme="dark"] .status-badge--draft {
    background: #2A2A24;
    color: #B5B5AD;
}

:root[data-theme="dark"] .notice--error {
    background: #2A1514;
    border-color: #7A2E29;
    color: #F0A29C;
}

:root[data-theme="dark"] .site-footer {
    background: var(--color-card);
    border-top: 1px solid var(--color-border);
}

/* ------------------------------------------------------------------ */
/* Theme toggle button (header)                                        */
/* ------------------------------------------------------------------ */

.theme-toggle {
    position: relative;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 100px;
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
}

    .theme-toggle:hover {
        background: var(--color-border);
        color: var(--color-text);
    }

    .theme-toggle svg {
        width: 20px;
        height: 20px;
    }

    .theme-toggle .icon-moon {
        display: none;
    }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun {
        display: none;
    }

    :root:not([data-theme="light"]) .theme-toggle .icon-moon {
        display: inline-flex;
    }
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: inline-flex;
}

.mobile-theme-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--color-text);
    cursor: pointer;
}

    .mobile-theme-toggle .icon-moon {
        display: none;
    }

:root[data-theme="dark"] .mobile-theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .mobile-theme-toggle .icon-moon {
    display: inline;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .mobile-theme-toggle .icon-sun {
        display: none;
    }

    :root:not([data-theme="light"]) .mobile-theme-toggle .icon-moon {
        display: inline;
    }
}

/* ------------------------------------------------------------------ */
/* Reading progress bar                                                */
/* Thin accent-colored bar pinned above the sticky header, filling as  */
/* the reader scrolls through a story's .article content. Present in   */
/* every page's markup but only ever animated by site.js when an       */
/* .article element exists on the page — everywhere else it just sits  */
/* at 0 width and is invisible.                                        */
/* ------------------------------------------------------------------ */

.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: var(--color-accent);
    z-index: 70;
    transition: width 100ms linear;
}

/* ------------------------------------------------------------------ */
/* Cookie consent banner                                               */
/* Full-width bar (deliberately distinct from the bottom-right PWA     */
/* install card) so the two never visually collide if both show at    */
/* once. Sits above the PWA banner's z-index since a consent choice    */
/* takes priority over an install prompt.                              */
/* ------------------------------------------------------------------ */

.cookie-consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    background: var(--color-card);
    border-top: 1px solid var(--color-border);
    padding: var(--space-5) var(--space-4);
    padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
    animation: pwa-banner-rise 0.35s ease-out;
}

.cookie-consent-banner__inner {
    max-width: var(--content-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

    .cookie-consent-banner__inner p {
        flex: 1;
        margin: 0;
        font-size: var(--text-sm);
        color: var(--color-text-secondary);
    }

        .cookie-consent-banner__inner p a {
            color: var(--color-text);
        }

.cookie-consent-banner__actions {
    display: flex;
    gap: var(--space-3);
    flex-shrink: 0;
}

    .cookie-consent-banner__actions .btn {
        padding: 10px 20px;
        white-space: nowrap;
    }

@media (max-width: 640px) {
    .cookie-consent-banner__inner {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-4);
    }

    .cookie-consent-banner__actions {
        justify-content: stretch;
    }

        .cookie-consent-banner__actions .btn {
            flex: 1;
        }
}

.footer-link-button {
    display: block;
    background: none;
    border: none;
    padding: 0;
    margin-bottom: var(--space-2);
    color: #EDEDED;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    text-align: left;
    cursor: pointer;
}

    .footer-link-button:hover {
        color: var(--color-accent);
    }

/* ------------------------------------------------------------------ */
/* Checkbox form groups (signup age/terms confirmation, etc.)          */
/* ------------------------------------------------------------------ */

.form-group--checkbox {
    margin-top: var(--space-2);
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
}

    .checkbox-label input[type="checkbox"] {
        margin-top: 3px;
        flex-shrink: 0;
        width: 16px;
        height: 16px;
        accent-color: var(--color-accent);
    }

    .checkbox-label a {
        color: var(--color-text);
    }

/* ------------------------------------------------------------------ */
/* Continue reading rail (signed-in feed)                              */
/* ------------------------------------------------------------------ */

.feed-continue-reading {
    margin-bottom: var(--space-6);
}

    .feed-continue-reading h3 {
        font-family: var(--font-sans);
        font-size: var(--text-sm);
        font-weight: var(--weight-semibold);
        color: var(--color-text-secondary);
        margin-bottom: var(--space-3);
    }

.feed-continue-reading__row {
    display: flex;
    flex-direction: column;
}

/* ------------------------------------------------------------------ */
/* Content-language support (RTL scripts)                              */
/* Not UI localization — the interface stays English (Medium/Quora/    */
/* Wattpad's approach, see LanguageCatalog). This is purely for        */
/* rendering a story's own title/subtitle/body correctly when the      */
/* author wrote it in Urdu, Arabic, Persian, or Hebrew.                */
/* ------------------------------------------------------------------ */

.rtl-content {
    font-family: 'Noto Nastaliq Urdu', 'Noto Naskh Arabic', serif;
    line-height: 2.1; /* Nastaliq's vertical stacking needs more room than Latin type */
    text-align: right;
}

/* The brand serif (DM Serif Display) has no Arabic/Urdu glyphs, so the
       headline needs the RTL font too, not just the body. */
h1.rtl-content {
    font-family: 'Noto Nastaliq Urdu', 'Noto Naskh Arabic', serif;
    line-height: 1.9;
}

/* Editor inputs (title/subtitle/content) need their own override since
   .editor-title etc. set font-family with higher specificity than the
   standalone .rtl-content rule above would otherwise win against. */
.editor-main input.editor-title.rtl-content,
.editor-main input.editor-subtitle.rtl-content,
.editor-main .editor-content.rtl-content {
    font-family: 'Noto Nastaliq Urdu', 'Noto Naskh Arabic', serif;
}

.editor-main input.editor-title.rtl-content {
    line-height: 1.9;
}

/* ---------------------------------------------------------------
   Blog page — two-column layout (feed + sidebar), story image
   thumbnails and coloured placeholders when a story has no image.
   --------------------------------------------------------------- */
.blog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--space-8);
    align-items: start;
}

    .blog-layout .feed-list {
        max-width: none;
    }

.blog-sidebar {
    position: sticky;
    top: 92px;
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    padding-left: var(--space-6);
    border-left: 1px solid var(--color-border);
}

.blog-sidebar__cta {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
}

    .blog-sidebar__cta h3 {
        font-size: var(--text-lg);
        margin-bottom: var(--space-2);
    }

    .blog-sidebar__cta p {
        color: var(--color-text-secondary);
        font-size: var(--text-sm);
        line-height: 1.5;
        margin-bottom: var(--space-4);
    }

.blog-sidebar__section h3 {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 700;
    margin-bottom: var(--space-3);
}

.blog-sidebar__section .topic-pill {
    padding: 7px 14px;
    font-size: var(--text-xs);
}

.blog-sidebar__links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
}

    .blog-sidebar__links a {
        color: var(--color-text-secondary);
        text-decoration: none;
    }

        .blog-sidebar__links a:hover {
            color: var(--color-text);
            text-decoration: underline;
        }

/* Spotlight thumbnail when the story has an image */
.blog-spotlight__thumb {
    overflow: hidden;
}

.blog-spotlight__thumb--image {
    background: var(--color-border);
}

    .blog-spotlight__thumb--image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

/* Feed thumbnails without an image: coloured tile with the first letter
   instead of an empty grey box. */
.feed-row__thumb--placeholder {
    border-color: transparent;
}

.feed-row__thumb--c0 {
    background: var(--color-accent);
    color: var(--color-accent-ink);
}

.feed-row__thumb--c1 {
    background: #ECEBE3;
    color: #171717;
}

.feed-row__thumb--c2 {
    background: #111111;
    color: #C7F36B;
}

@media (max-width: 900px) {
    .blog-layout {
        grid-template-columns: 1fr;
        gap: var(--space-7);
    }

    .blog-sidebar {
        position: static;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--color-border);
        padding-top: var(--space-6);
    }
}

/* ------------------------------------------------------------------ */
/* Social chips, footer social icons                                    */
/* ------------------------------------------------------------------ */

.social-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
    background: var(--color-bg);
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

    .social-chip:hover {
        background: var(--color-accent);
        border-color: var(--color-accent);
        color: var(--color-accent-ink);
        transform: translateY(-2px);
    }

.footer-social {
    display: flex;
    gap: var(--space-3);
    margin: calc(-1 * var(--space-3)) 0 var(--space-6);
}

    .footer-social a {
        display: grid;
        place-items: center;
        width: 38px;
        height: 38px;
        border: 1px solid #3A3A3A;
        border-radius: 50%;
        color: #EDEDED;
        transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, transform 150ms ease;
    }

        .footer-social a:hover {
            background: var(--color-accent);
            border-color: var(--color-accent);
            color: var(--color-accent-ink);
            transform: translateY(-2px);
        }

/* ------------------------------------------------------------------ */
/* About page — founder (text + portrait, same width as the page)       */
/* ------------------------------------------------------------------ */

.about-founder {
    background: var(--color-bg);
    padding: var(--space-8) 0;
    overflow: hidden; /* the lime block behind the photo sticks out a little */
}

.about-founder__inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: var(--space-8);
    align-items: center;
}

.about-founder__eyebrow {
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-4);
}

.about-founder__content h2 {
    font-size: clamp(2.6rem, 5vw, 4.25rem);
    line-height: 1.05;
    margin: 0;
}

.about-founder__role {
    display: inline-block;
    margin: var(--space-4) 0 var(--space-6);
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-accent-ink);
    font-size: var(--text-sm);
    font-weight: 700;
}

.about-founder__quote {
    margin: 0 0 var(--space-5);
    padding-left: var(--space-5);
    border-left: 4px solid var(--color-accent);
    font-size: 1.3rem;
    line-height: 1.65;
    max-width: 60ch;
}

.about-founder__values {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-5);
}

    .about-founder__values li {
        padding: 6px 14px;
        border: 1px solid var(--color-border);
        border-radius: 999px;
        background: var(--color-card);
        color: var(--color-text-secondary);
        font-size: var(--text-sm);
    }

.about-founder__links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.about-founder__photo {
    position: relative;
    margin: 0;
    width: 100%;
    max-width: 460px;
    justify-self: end;
}

    /* offset lime block behind the portrait */
    .about-founder__photo::before {
        content: "";
        position: absolute;
        inset: 26px -26px -26px 26px;
        border-radius: 28px;
        background: var(--color-accent);
    }

    .about-founder__photo img {
        position: relative;
        display: block;
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 5;
        object-fit: cover;
        border-radius: 28px;
        box-shadow: 0 30px 60px -32px rgba(0, 0, 0, 0.55);
    }

/* ------------------------------------------------------------------ */
/* Membership page — featured member                                    */
/* ------------------------------------------------------------------ */

.members {
    padding: var(--space-8) 0 var(--space-6);
}

.members__inner {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 40px;
}

.members__eyebrow {
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-3);
}

.members h2 {
    font-size: var(--text-2xl);
    margin: 0 0 var(--space-3);
}

.members__lead {
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-6);
}

.member-card {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: var(--space-6);
    align-items: start;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-top: 4px solid var(--color-accent);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    box-shadow: 0 24px 50px -38px rgba(0, 0, 0, 0.5);
}

.member-card__photo {
    margin: 0;
}

    .member-card__photo img {
        display: block;
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 5;
        object-fit: cover;
        object-position: 50% 15%;
        border-radius: 16px;
    }

.member-card__main h3 {
    font-size: 2rem;
    margin: var(--space-2) 0 var(--space-1);
}

.member-card__role {
    color: var(--color-text-secondary);
    margin: 0;
}

.member-card__tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-accent-ink);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.member-card__bio {
    margin: var(--space-4) 0 var(--space-5);
    line-height: 1.65;
}

.member-card__companies {
    grid-column: 1 / -1;
}

.member-card__companies {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.company-tile {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    color: var(--color-text);
    text-decoration: none;
    transition: border-color 150ms ease, transform 150ms ease, box-shadow 200ms ease;
}

    .company-tile strong {
        font-size: var(--text-lg);
    }

    .company-tile span {
        color: var(--color-text-secondary);
        font-size: var(--text-sm);
        line-height: 1.55;
        flex: 1;
    }

    .company-tile em {
        font-style: normal;
        font-weight: 600;
        font-size: var(--text-sm);
    }

    .company-tile:hover {
        border-color: var(--color-accent);
        transform: translateY(-3px);
        box-shadow: 0 18px 34px -24px rgba(0, 0, 0, 0.55);
    }

.members__note {
    margin: var(--space-4) 0 0;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    text-align: center;
}

.members__cta {
    margin: var(--space-5) 0 0;
    color: var(--color-text-secondary);
    text-align: center;
}

    .members__cta a {
        color: var(--color-text);
        font-weight: 600;
    }

@media (max-width: 900px) {
    .about-founder__inner {
        grid-template-columns: 1fr;
        gap: var(--space-7);
    }

    .about-founder__photo {
        order: -1;
        justify-self: start;
        width: calc(100% - 26px);
        max-width: 340px;
    }
}

@media (max-width: 720px) {
    .about-founder__inner,
    .members__inner {
        padding: 0 20px;
    }

    .about-founder__quote {
        font-size: var(--text-lg);
    }

    .member-card {
        grid-template-columns: 1fr;
        padding: var(--space-5);
    }

    .member-card__photo {
        max-width: 260px;
    }

    .member-card__companies {
        grid-template-columns: 1fr;
    }
}

/* "Continue with Google" button and the "or" divider on the login/sign-up pages */
.auth-google {
    margin: 0 0 var(--space-3);
}

.btn--google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #FFFFFF;
    color: #1F1F1F;
    border: 1px solid #DADCE0;
    font-weight: 600;
}

    .btn--google:hover {
        background: #F7F8F8;
        border-color: #C6C9CC;
        box-shadow: 0 1px 3px rgba(60, 64, 67, 0.25);
    }

.auth-google__note {
    margin: 0 0 var(--space-4);
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    text-align: center;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-4) 0;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
}

    .auth-divider::before,
    .auth-divider::after {
        content: "";
        flex: 1;
        height: 1px;
        background: var(--color-border);
    }

/* ---- Append to the END of wwwroot/css/site.css ---- */

/* Heading dropdown in the editor toolbar */
.editor-toolbar__select {
    height: 36px;
    padding: 0 var(--space-3, 12px);
    border: 1px solid var(--color-border, #d9d9d9);
    border-radius: 6px;
    background: var(--color-surface, #fff);
    color: inherit;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

/* H3/H4 in the published story and inside the editor */
.story-body h3,
.editor-content[contenteditable] h3 {
    font-size: 1.3rem;
    line-height: 1.35;
    margin: 1.6em 0 0.5em;
}

.story-body h4,
.editor-content[contenteditable] h4 {
    font-size: 1.1rem;
    line-height: 1.4;
    margin: 1.4em 0 0.4em;
}

.editor-content[contenteditable] h2 {
    margin: 1.8em 0 0.5em;
}

/* ---- Editor v2: sticky toolbar, figures/captions, dialogs ---- */
.editor-toolbar {
    position: sticky;
    top: var(--editor-sticky-top, 0px); /* story-editor.js sets this to the site header height */
    z-index: 15;
    background: var(--color-bg);
    flex-wrap: nowrap;
    overflow-x: auto;
}

.editor-content[contenteditable] figure,
.story-body figure {
    margin: var(--space-5, 24px) 0;
    text-align: center;
}

    .editor-content[contenteditable] figure img,
    .story-body figure img {
        margin: 0 auto;
    }

.editor-content[contenteditable] img {
    cursor: pointer;
}

.editor-content[contenteditable] figcaption,
.story-body figcaption {
    margin-top: 8px;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    text-align: center;
    line-height: 1.5;
}

    .editor-content[contenteditable] figcaption:empty::before {
        content: "Add credit and caption";
        opacity: 0.7;
    }

.editor-content[contenteditable] a {
    color: inherit;
    text-decoration: underline;
}

.editor-dialog {
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 0;
    width: min(560px, calc(100vw - 32px));
    background: var(--color-card);
    color: var(--color-text);
}

    .editor-dialog::backdrop {
        background: rgba(0, 0, 0, 0.55);
    }

.editor-dialog__head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    font-weight: var(--weight-semibold, 600);
    font-size: var(--text-lg);
}

.editor-dialog__body {
    padding: 20px;
    display: grid;
    gap: 14px;
}

.editor-dialog__foot {
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.editor-dialog__preview {
    max-height: 280px;
    max-width: 100%;
    margin: 0 auto;
    display: block;
    border-radius: 8px;
}

.editor-dialog__tools {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.editor-dialog__error {
    color: #c0392b;
    font-size: var(--text-xs);
    margin: 0;
}


/* ================================================================== */
/* Comments — compact, Medium-style (overrides .article p sizing)       */
/* ================================================================== */

#comments {
    scroll-margin-top: 80px;
}

/* Comments live inside <article>, so `.article p` (large reading size,
   1.75 line-height, bottom margin) was winning over .comment__body. */
.article .comment__body {
    font-size: var(--text-sm);
    line-height: 1.55;
    margin: 2px 0 var(--space-2);
    color: var(--color-text);
}

.comment {
    padding: var(--space-3) 0;
}

.comment__row {
    gap: 10px;
}

.comment__avatar {
    width: 32px;
    height: 32px;
    font-size: var(--text-sm);
}

.comment__replies .comment__avatar {
    width: 26px;
    height: 26px;
    font-size: 0.8125rem;
}

.comment__header {
    flex-wrap: wrap;
    row-gap: 0;
}

.comment__author {
    font-size: var(--text-sm);
}

.comment__meta {
    font-size: 0.75rem;
}

.comment__actions {
    align-items: center;
    gap: var(--space-4);
}

    .comment__actions form {
        margin: 0;
        display: inline;
    }

    .comment__actions button,
    .comment__actions a {
        font-family: var(--font-sans);
        font-weight: 500;
        font-size: 0.8125rem;
        padding: 4px 0;
    }

.comment__replies {
    margin-top: var(--space-2);
    margin-left: 15px;
    padding-left: var(--space-3);
}

    .comment__replies .comment {
        padding: var(--space-2) 0;
    }

        .comment__replies .comment + .comment {
            border-top: none;
        }

.reply-form textarea,
.comment-form textarea {
    font-size: var(--text-sm);
}

.comment-form textarea {
    min-height: 80px;
}

@media (max-width: 640px) {
    .comment__replies {
        margin-left: 12px;
        padding-left: 10px;
    }

    .comment__avatar {
        width: 30px;
        height: 30px;
    }
}

/* ================================================================== */
/* Mobile menu — grouped, with account card                             */
/* ================================================================== */

.mobile-nav {
    gap: 0;
    padding: 14px 20px 24px;
    max-height: calc(100vh - 72px);
    max-height: calc(100dvh - 72px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mnav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
}

    .mnav-user .avatar-circle {
        width: 44px;
        height: 44px;
        font-size: var(--text-lg);
    }

.mnav-user__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

    .mnav-user__text strong {
        font-size: var(--text-base);
        line-height: 1.25;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mnav-user__text small {
        color: var(--color-text-secondary);
        font-size: 0.8125rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.mnav-user__cta {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.mobile-nav .mnav-write {
    width: 100%;
    margin: 0 0 8px;
    color: var(--color-accent-ink);
}

.mnav-group {
    display: flex;
    flex-direction: column;
    padding: 6px 0;
}

    .mnav-group + .mnav-group {
        border-top: 1px solid var(--color-border);
    }

.mnav-label {
    margin: 6px 0 2px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.mobile-nav .mnav-group > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 0;
    font-size: var(--text-base);
    font-weight: 500;
}

.mnav-badge {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-accent-ink);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

.mnav-group--foot {
    gap: 4px;
}

    .mnav-group--foot .mobile-theme-toggle {
        padding: 11px 0;
        font-weight: 500;
    }

.mnav-logout {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 11px 0;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
}

.mnav-auth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.mobile-nav .mnav-auth .btn {
    color: var(--color-text);
}

/* ================================================================== */
/* Like (heart) button on the story page                                */
/* ================================================================== */

.like-form {
    margin: 0;
}

.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 16px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-card);
    color: var(--color-text-secondary);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

    .like-btn:hover {
        border-color: var(--color-text);
        color: var(--color-text);
    }

.like-btn__icon {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linejoin: round;
    transition: fill 150ms ease, stroke 150ms ease;
}

.like-btn--active,
.like-btn--active:hover {
    color: #E5484D;
    border-color: #E5484D;
}

    .like-btn--active .like-btn__icon {
        fill: #E5484D;
        stroke: #E5484D;
    }

.like-btn__count:empty {
    display: none;
}

.like-btn--pop .like-btn__icon {
    animation: like-pop 320ms ease-out;
}

@keyframes like-pop {
    0% { transform: scale(1); }
    45% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ================================================================== */
/* Topics page                                                          */
/* ================================================================== */

.topics-heading {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin: var(--space-6) 0 var(--space-3);
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

.tcard {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: var(--space-5);
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text);
    transition: border-color 150ms ease, transform 150ms ease;
}

    .tcard:hover {
        border-color: var(--color-text);
        transform: translateY(-2px);
    }

.tcard__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.tcard__name {
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    line-height: 1.2;
}

.tcard__count {
    min-width: 28px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-accent-ink);
    font-size: 0.8125rem;
    font-weight: 700;
    text-align: center;
}

.tcard__desc {
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--color-text-secondary);
}

.tcard__meta {
    margin-top: auto;
    padding-top: var(--space-2);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text);
}

.tcard--empty {
    background: transparent;
    border-style: dashed;
}

    .tcard--empty .tcard__name {
        color: var(--color-text-secondary);
    }

    .tcard--empty .tcard__meta {
        color: var(--color-text-secondary);
        font-weight: 500;
    }

.topics-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-top: var(--space-7);
    padding: var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

    .topics-cta p {
        margin: 0;
        font-weight: 600;
    }

@media (max-width: 900px) {
    .topic-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .topic-grid {
        grid-template-columns: 1fr;
    }

    .tcard {
        padding: var(--space-4);
    }

    .topics-cta {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
}


/* ================================================================== */
/* Feed row actions (like / comments / save)                            */
/* ================================================================== */

/* The row is now an <article>; the title link is stretched over the whole row
   so a tap anywhere still opens the story, and the action buttons sit on top. */
.feed-row {
    position: relative;
}

.feed-row__link {
    color: inherit;
    text-decoration: none;
}

    .feed-row__link::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 1;
    }

.feed-row__stats {
    position: relative;
    z-index: 2;
    pointer-events: none; /* only the buttons themselves are tappable */
    margin-top: var(--space-2);
}

.feed-act {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0 -6px;
    padding: 7px 8px;
    border: none;
    border-radius: 999px;
    background: none;
    font-family: inherit;
    font-size: var(--text-xs);
    line-height: 1;
    color: var(--color-text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: color 150ms ease, background-color 150ms ease;
}

    .feed-act:hover {
        color: var(--color-text);
        background: var(--color-bg);
    }

    .feed-act svg {
        width: 18px;
        height: 18px;
    }

    .feed-act.is-active svg path {
        fill: currentColor;
    }

.feed-act--like.is-active,
.feed-act--like.is-active:hover {
    color: #E5484D;
}

.feed-act--save {
    margin-left: auto;
}

    .feed-act--save.is-active,
    .feed-act--save.is-active:hover {
        color: var(--color-text);
    }

.feed-act.is-pop svg {
    animation: like-pop 320ms ease-out;
}

.feed-act:focus-visible,
.feed-row__link:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 2px;
}

/* ================================================================== */
/* Story page: comments folded behind a button                          */
/* ================================================================== */

.comments-section {
    margin-top: var(--space-6);
}

.comments-heading {
    margin: 0;
    font-size: var(--text-base);
}

.comments-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text);
    text-align: left;
    cursor: pointer;
    transition: border-color 150ms ease;
}

    .comments-toggle:hover {
        border-color: var(--color-text);
    }

.comments-toggle__chevron {
    margin-left: auto;
    transition: transform 150ms ease;
}

.comments-toggle[aria-expanded="true"] .comments-toggle__chevron {
    transform: rotate(180deg);
}

.comments-body {
    margin-top: var(--space-5);
}

/* ================================================================== */
/* Community page                                                       */
/* ================================================================== */

/* Topic filter: one scrollable line instead of a wall of pills. */
.cm-filter {
    display: flex;
    gap: 8px;
    margin-bottom: var(--space-5);
    padding-bottom: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.cm-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-card);
    color: var(--color-text);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 150ms ease;
}

    .cm-chip:hover {
        border-color: var(--color-text);
    }

.cm-chip--active,
.cm-chip--active:hover {
    background: var(--color-text);
    border-color: var(--color-text);
    color: var(--color-bg);
}

.cm-chip__count {
    font-size: 0.75rem;
    opacity: 0.7;
}

.cm-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.cm-thread {
    position: relative;
    padding: var(--space-5);
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color 150ms ease;
}

    .cm-thread:hover {
        border-color: var(--color-text);
    }

.cm-thread__top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.cm-thread__topic {
    position: relative;
    z-index: 2;
    padding: 2px 10px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-bg);
    color: var(--color-text);
    font-weight: 600;
    text-decoration: none;
}

.cm-thread__title {
    margin: 0 0 6px;
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    line-height: 1.3;
}

.cm-thread__link {
    color: inherit;
    text-decoration: none;
}

    .cm-thread__link::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 1;
    }

.cm-thread__excerpt {
    margin: 0 0 14px;
    color: var(--color-text-secondary);
    font-size: var(--text-base);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cm-thread__foot {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.cm-thread__replies {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--color-text);
}

.cm-empty {
    padding: var(--space-7) var(--space-5);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    text-align: center;
}

.cm-empty__icon {
    margin-bottom: var(--space-3);
    color: var(--color-text-secondary);
}

.cm-empty h2 {
    margin: 0 0 6px;
    font-family: var(--font-serif);
    font-size: var(--text-xl);
}

.cm-empty p {
    max-width: 420px;
    margin: 0 auto var(--space-5);
    color: var(--color-text-secondary);
}

.cm-empty__actions {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

@media (max-width: 560px) {
    .cm-thread {
        padding: var(--space-4);
    }
}

/* ================================================================== */
/* Mobile menu v2 — compact, icon-led                                   */
/* ================================================================== */

.mobile-nav {
    padding: 12px 16px 18px;
}

/* Account card: room for the name, a chevron instead of the "View profile" text */
.mnav-user {
    padding: 10px 12px;
    margin-bottom: 10px;
    gap: 12px;
}

    .mnav-user .avatar-circle {
        width: 40px;
        height: 40px;
        font-size: var(--text-base);
        flex-shrink: 0;
        overflow: hidden;
    }

        .mnav-user .avatar-circle img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

.mnav-user__text strong {
    font-size: 0.9375rem;
}

.mnav-user__text small {
    font-size: 0.8125rem;
}

.mnav-user__chev {
    flex-shrink: 0;
    color: var(--color-text-secondary);
}

.mobile-nav .mnav-write {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    margin: 0 0 6px;
    font-size: 0.9375rem;
}

.mnav-group {
    padding: 4px 0;
}

.mnav-label {
    margin: 10px 4px 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

/* Explore links sit in two columns so the whole menu fits on one screen */
.mnav-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
}

.mobile-nav .mnav-group .mnav-item,
.mobile-nav .mnav-foot .mnav-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
}

    .mobile-nav .mnav-group .mnav-item:hover,
    .mobile-nav .mnav-group .mnav-item:active,
    .mobile-nav .mnav-foot .mnav-item:hover,
    .mobile-nav .mnav-foot .mnav-item:active {
        background: var(--color-bg);
    }

.mnav-icon {
    flex-shrink: 0;
    color: var(--color-text-secondary);
}

.mnav-badge {
    margin-left: auto;
}

/* Theme + log out share one row at the bottom */
.mnav-foot {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
}

    .mnav-foot form {
        margin: 0;
    }

.mnav-btn {
    width: 100%;
    background: none;
    border: none;
    font-family: var(--font-sans);
    text-align: left;
    cursor: pointer;
}

    .mnav-foot .mobile-theme-toggle .icon-sun,
    .mnav-foot .mobile-theme-toggle .icon-moon {
        width: 20px;
        text-align: center;
        font-size: 1rem;
        color: var(--color-text-secondary);
    }

.mnav-logout {
    color: var(--color-text-secondary);
}

.mnav-auth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}


/* ================================================================== */
/* Featured Member badge + profile card                                 */
/* ================================================================== */

.member-badge {
    display: inline-block;
    width: max(0.8em, 16px);
    height: max(0.8em, 16px);
    margin-left: 0.3em;
    vertical-align: -0.12em;
    flex-shrink: 0;
}

.author-profile-header h1 .member-badge {
    width: 0.7em;
    height: 0.7em;
    vertical-align: -0.04em;
}

.member-panel {
    max-width: 720px;
    margin: var(--space-5) 0 0;
    padding: var(--space-5);
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-accent);
    border-radius: var(--radius-md);
}

.member-panel__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--space-3);
    font-weight: 600;
}

    .member-panel__head .member-badge {
        width: 22px;
        height: 22px;
        margin: 0;
        vertical-align: middle;
    }

.member-panel__since {
    font-size: var(--text-sm);
    font-weight: 400;
    color: var(--color-text-secondary);
}

.member-panel__item + .member-panel__item {
    margin-top: var(--space-4);
}

.member-panel__item h3 {
    margin: 0 0 4px;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.member-panel__item p {
    margin: 0;
    line-height: 1.55;
    white-space: pre-line;
}

.member-panel__note {
    margin: var(--space-4) 0 0;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.member-edit {
    margin: var(--space-6) 0;
    padding: var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.member-edit__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 var(--space-2);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: 600;
}

    .member-edit__title .member-badge {
        width: 22px;
        height: 22px;
        margin: 0;
    }


/* ================================================================== */
/* Profile photo editor (crop / zoom / rotate)                          */
/* ================================================================== */

.form-hint.is-error { color: #E5484D; }
.form-hint.is-ok { color: #2E9E5B; }

.pe-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.6);
}

    .pe-backdrop[hidden] {
        display: none;
    }

.pe-dialog {
    width: 100%;
    max-width: 400px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    padding: var(--space-5);
    background: var(--color-card);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.pe-title {
    margin: 0 0 4px;
    font-family: var(--font-serif);
    font-size: var(--text-xl);
}

.pe-hint {
    margin: 0 0 var(--space-3);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.pe-stage {
    position: relative;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 12px;
    background: #1b1b19;
    cursor: grab;
    touch-action: none;
    outline: none;
}

    .pe-stage:active {
        cursor: grabbing;
    }

    .pe-stage:focus-visible {
        box-shadow: 0 0 0 2px var(--color-text);
    }

    .pe-stage canvas {
        display: block;
        width: 100%;
        height: 100%;
        touch-action: none;
    }

/* The dimmed area outside the circle is the box-shadow of the circle itself. */
.pe-circle {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.55);
    pointer-events: none;
}

.pe-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: var(--space-3);
}

    .pe-controls input[type="range"] {
        flex: 1;
        min-width: 0;
        accent-color: var(--color-text);
    }

.pe-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

    .pe-icon:hover {
        border-color: var(--color-text);
    }

.pe-error {
    margin: var(--space-3) 0 0;
    font-size: var(--text-sm);
    color: #E5484D;
}

    .pe-error[hidden] {
        display: none;
    }

.pe-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: var(--space-4);
}
