/* Magazine variant — editorial longform, serif reading column.
   Per docs/blog-schema.md, a *generated* site's variant carries no `:root`
   fallback block: the tokens are owned by /styles/custom.css, which loads
   after this file. Every value below either comes from a token or is
   intrinsic to the variant's own visual identity. */

.mag-body {
    margin: 0;
    font-family: var(--font-body);
    background-color: var(--color-background);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.mag-skip {
    position: absolute;
    top: -100px;
    left: var(--space-sm);
    z-index: 100;
    padding: 0.75em 1.25em;
    border-radius: 999px;
    background-color: var(--color-primary);
    color: var(--color-surface);
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s ease;
}

.mag-skip:focus { top: var(--space-sm); }

/* --------------------------------------------------------------- header */

.mag-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: color-mix(in srgb, var(--color-background) 82%, transparent);
    backdrop-filter: saturate(150%) blur(12px);
    -webkit-backdrop-filter: saturate(150%) blur(12px);
    border-bottom: 1px solid var(--color-border);
}

.mag-header__inner {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2.4vw, 2rem);
    max-width: var(--container-max-width);
    margin-inline: auto;
    min-height: 76px;
    padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.mag-brand {
    margin-right: auto;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1;
    color: var(--color-text);
    text-decoration: none;
}

.mag-nav {
    display: flex;
    gap: clamp(1rem, 2vw, 1.75rem);
}

.mag-nav a {
    position: relative;
    font-size: 0.975rem;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    padding-block: 0.4rem;
    white-space: nowrap;
}

.mag-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1.5px;
    background-color: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.mag-nav a:hover,
.mag-nav a[aria-current="page"] { color: var(--color-primary); }

.mag-nav a:hover::after,
.mag-nav a:focus-visible::after,
.mag-nav a[aria-current="page"]::after { transform: scaleX(1); }

.mag-cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.6em 1.35em;
    border-radius: 999px;
    background-color: var(--color-primary);
    color: var(--color-surface);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.28s ease, box-shadow 0.28s ease;
}

.mag-cta:hover,
.mag-cta:focus-visible {
    background-color: var(--color-primary-deep, var(--color-primary));
    box-shadow: 0 6px 18px -8px rgba(110, 43, 31, 0.6);
}

/* The blog has no JS menu, so hiding the nav on small screens left every
   link but the wordmark unreachable. Scroll it instead. */
@media (max-width: 980px) {
    .mag-header__inner {
        flex-wrap: wrap;
        row-gap: 0;
        padding-bottom: 0.5rem;
    }

    .mag-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
        gap: 1.25rem;
        padding-bottom: 0.35rem;
        /* Bleed to the edges so the row reads as scrollable. */
        margin-inline: calc(-1 * clamp(1.25rem, 4vw, 2.5rem));
        padding-inline: clamp(1.25rem, 4vw, 2.5rem);
        -webkit-overflow-scrolling: touch;
    }

    .mag-nav::-webkit-scrollbar { display: none; }
    .mag-brand { font-size: 1.4rem; }
    .mag-cta { padding: 0.55em 1.1em; font-size: 0.9rem; }
}

@media (max-width: 420px) {
    .mag-cta { padding: 0.55em 0.9em; }
}

/* -------------------------------------------------------------- eyebrow
   The clay-to-silver rule used for every label across the site. */

.mag-eyebrow {
    display: flex;
    align-items: center;
    gap: 0.75em;
    margin: 0 0 var(--space-md);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-light);
}

.mag-eyebrow::before {
    content: "";
    flex-shrink: 0;
    width: clamp(24px, 3vw, 44px);
    height: 1.5px;
    background-image: linear-gradient(90deg, var(--color-primary), var(--color-text-light));
}

/* ------------------------------------------------------------ list page */

.mag-list-hero {
    max-width: var(--container-max-width);
    margin-inline: auto;
    padding: clamp(3rem, 6vw, 5rem) clamp(1.25rem, 4vw, 2.5rem) var(--space-xl);
}

.mag-list-hero h1 {
    margin: 0 0 var(--space-md);
    font-family: var(--font-heading);
    font-size: clamp(2.4rem, 1.5rem + 3.7vw, 4.25rem);
    font-weight: 600;
    line-height: 1.04;
    letter-spacing: -0.021em;
    color: var(--color-text);
    max-width: 16ch;
}

.mag-list-hero__deck {
    margin: 0;
    max-width: 52ch;
    font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.375rem);
    line-height: 1.5;
    color: var(--color-text-light);
}

.mag-list {
    max-width: var(--container-max-width);
    margin-inline: auto;
    padding: 0 clamp(1.25rem, 4vw, 2.5rem) clamp(3rem, 6vw, 5rem);
}

.mag-card {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: center;
    padding-block: clamp(2rem, 4vw, 3rem);
    border-top: 1px solid var(--color-border);
}

.mag-card:last-child { border-bottom: 1px solid var(--color-border); }

.mag-card__media { display: block; }

.mag-card__media img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: var(--radius);
}

.mag-card__title {
    margin: 0 0 var(--space-sm);
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.018em;
    text-wrap: balance;
}

.mag-card__title a {
    color: var(--color-text);
    text-decoration: none;
    background-image: linear-gradient(var(--color-primary), var(--color-primary));
    background-size: 0% 1.5px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.3s cubic-bezier(0.22, 0.61, 0.36, 1), color 0.2s ease;
}

.mag-card__title a:hover,
.mag-card__title a:focus-visible {
    color: var(--color-primary);
    background-size: 100% 1.5px;
}

.mag-card__deck {
    margin: 0 0 var(--space-md);
    max-width: 46ch;
    color: var(--color-text-light);
    line-height: 1.6;
}

.mag-card__meta {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text-light);
}

@media (max-width: 760px) {
    .mag-card { grid-template-columns: 1fr; gap: var(--space-md); }
}

/* ------------------------------------------------------------ post page */

.mag-article {
    /* ~66 characters per line. At 46rem it measured 73, which is past the
       comfortable range for sustained reading. */
    max-width: 41rem;
    margin-inline: auto;
    padding: clamp(2.5rem, 5vw, 4.5rem) clamp(1.25rem, 4vw, 2.5rem) 0;
}

.mag-article__head { margin-bottom: var(--space-xl); }

.mag-title {
    margin: 0 0 var(--space-md);
    font-family: var(--font-heading);
    font-size: clamp(2.1rem, 1.4rem + 3vw, 3.4rem);
    font-weight: 600;
    line-height: 1.07;
    letter-spacing: -0.021em;
    text-wrap: balance;
}

.mag-deck {
    margin: 0 0 var(--space-lg);
    font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.375rem);
    line-height: 1.5;
    color: var(--color-text-light);
    text-wrap: pretty;
}

.mag-byline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6em;
    margin: 0;
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.mag-byline__author { font-weight: 600; color: var(--color-text); }

/* The hero breaks out of the reading measure — the one full-width moment
   on the page. */
.mag-hero {
    margin: 0 0 clamp(2rem, 4vw, 3rem);
    width: min(calc(100vw - 2 * clamp(1.25rem, 4vw, 2.5rem)), 60rem);
    margin-inline: calc(50% - min(50vw - clamp(1.25rem, 4vw, 2.5rem), 30rem));
}

.mag-hero img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
}

/* -------------------------------------------------------------- prose
   The reading column takes the display face: this variant's whole point is
   a serif reading rhythm, and Fraunces carries an optical-size axis that
   the browser drives from font-size. */

.mag-prose {
    font-family: var(--font-heading);
    font-size: 1.1875rem;
    line-height: 1.68;
    color: var(--color-text);
}

/* Vertical rhythm is owned entirely by the flow rules below. Anything that
   sets a margin on a bare element selector (`.mag-prose p`) would outrank
   them and silently collapse the spacing. */
.mag-prose > * { margin-block: 0; }
.mag-prose > * + * { margin-top: 1.3em; }
.mag-prose > h2 { margin-top: 2.1em; }
.mag-prose > h3 { margin-top: 1.8em; }
.mag-prose > h2 + *,
.mag-prose > h3 + * { margin-top: 0.65em; }
.mag-prose > hr + * { margin-top: 0; }

.mag-prose p { text-wrap: pretty; }

.mag-prose h2 {
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 1.95rem);
    font-weight: 600;
    line-height: 1.18;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

.mag-prose h3 {
    font-size: clamp(1.2rem, 1.1rem + 0.5vw, 1.4rem);
    font-weight: 600;
    line-height: 1.25;
    text-wrap: balance;
}

.mag-prose strong { font-weight: 600; }

.mag-prose a {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.mag-prose ul,
.mag-prose ol {
    padding-left: 1.3em;
    display: flex;
    flex-direction: column;
    gap: 0.6em;
}

.mag-prose li::marker { color: var(--color-primary); }

.mag-prose blockquote {
    padding-left: var(--space-md);
    border-left: 2px solid var(--color-primary);
    font-style: italic;
    color: var(--color-text-light);
}

.mag-prose img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.mag-prose table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.mag-prose th,
.mag-prose td {
    padding: 0.85em 1em 0.85em 0;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--color-border);
}

.mag-prose th {
    font-weight: 600;
    color: var(--color-text);
    border-bottom-color: var(--color-text-light);
}

.mag-prose td { color: var(--color-text-light); }

/* The closing rule before the disclaimer. */
.mag-prose hr {
    margin-top: 2.5em;
    border: 0;
    border-top: 1px solid var(--color-border);
}

.mag-prose em { color: var(--color-text-light); }

/* Inline code carries ingredient names mid-sentence, so the padding has to
   stay tight enough that a following comma still reads as attached. */
.mag-prose code {
    font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
    font-size: 0.85em;
    padding: 0.1em 0.3em;
    border-radius: 4px;
    background-color: color-mix(in srgb, var(--color-secondary) 70%, transparent);
    white-space: nowrap;
}

/* ------------------------------------------------------------- article footer */

.mag-article__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-top: clamp(2.5rem, 5vw, 4rem);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
}

.mag-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mag-tags .blog-tag {
    padding: 0.35em 0.85em;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 0.8125rem;
    color: var(--color-text-light);
}

.mag-back {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}

.mag-back:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- appeal */

.mag-appeal {
    margin-top: clamp(3rem, 6vw, 5rem);
    padding: clamp(2.5rem, 5vw, 4rem) clamp(1.25rem, 4vw, 2.5rem);
    background-image: linear-gradient(165deg, var(--color-primary) 0%, var(--color-primary-deep, var(--color-primary)) 100%);
    color: var(--color-surface);
}

.mag-appeal__inner {
    max-width: 40rem;
    margin-inline: auto;
    text-align: center;
}

.mag-appeal h2 {
    margin: 0 0 var(--space-md);
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: var(--color-surface);
    text-wrap: balance;
}

.mag-appeal p {
    margin: 0 0 var(--space-lg);
    font-size: 1.0625rem;
    line-height: 1.55;
    color: color-mix(in srgb, var(--color-surface) 88%, transparent);
}

.mag-appeal__cta {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    padding: 0.8em 1.8em;
    border-radius: 999px;
    background-color: var(--color-background);
    color: var(--color-text);
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.mag-appeal__cta:hover,
.mag-appeal__cta:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.5);
}

/* ---------------------------------------------------------------- footer */

.mag-site-footer {
    background-color: var(--color-secondary);
    padding-block: var(--space-xl);
}

.mag-site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    max-width: var(--container-max-width);
    margin-inline: auto;
    padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.mag-site-footer__brand {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--color-text);
}

.mag-site-footer__nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.mag-site-footer__nav a {
    font-size: 0.9375rem;
    color: var(--color-text-light);
    text-decoration: none;
}

.mag-site-footer__nav a:hover { color: var(--color-primary); }

/* ----------------------------------------------------------------- a11y */

.mag-body :focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
    .mag-body *,
    .mag-body *::before,
    .mag-body *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
    .mag-appeal__cta:hover { transform: none; }
}

/* ---------------------------------------------------------------- related
   A post used to end with nothing but a back link. */

.mag-related {
    margin-top: clamp(3rem, 6vw, 5rem);
    padding-block: clamp(2.5rem, 5vw, 4rem);
    border-top: 1px solid var(--color-border);
}

.mag-related__inner {
    max-width: var(--container-max-width);
    margin-inline: auto;
    padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.mag-related__heading {
    margin: 0 0 var(--space-lg);
    font-family: var(--font-heading);
    font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
    font-weight: 600;
    letter-spacing: -0.015em;
}

.mag-related__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1.25rem, 3vw, 2rem);
}

.mag-related__media { display: block; margin-bottom: var(--space-sm); }

.mag-related__media img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: var(--radius);
}

.mag-related__title {
    margin: 0 0 0.4em;
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.012em;
    text-wrap: balance;
}

.mag-related__title a {
    color: var(--color-text);
    text-decoration: none;
}

.mag-related__title a:hover,
.mag-related__title a:focus-visible {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.mag-related__deck {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--color-text-light);
}

.mag-related .mag-eyebrow { margin-bottom: 0.5em; }

@media (max-width: 860px) {
    .mag-related__grid { grid-template-columns: 1fr; gap: var(--space-lg); }
}

/* Touch targets measured at 390px: the back link was 24px tall and related
   post titles 28px. */
@media (max-width: 980px) {
    .mag-back {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    /* A single-line title link was 33px. Padding brings it to 44 without
       changing the visual rhythm — the margin below absorbs it. */
    .mag-related__title a {
        display: inline-block;
        padding-block: 0.6rem;
    }

    .mag-related__title { margin-bottom: 0; margin-top: -0.6rem; }
}

/* ------------------------------------------------------------- breadcrumbs */

.mag-crumbs { margin-bottom: var(--space-md); }

.mag-crumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5em;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.mag-crumbs li + li::before {
    content: "/";
    margin-right: 0.5em;
    color: var(--color-border);
}

.mag-crumbs a {
    color: var(--color-text-light);
    text-decoration: none;
}

.mag-crumbs a:hover { color: var(--color-primary); text-decoration: underline; }
.mag-crumbs [aria-current="page"] { color: var(--color-text); min-width: 0; }

/* A full title can be long; truncate visually while screen readers still get
   the whole thing. */
.mag-crumbs [aria-current="page"] span {
    display: block;
    max-width: 28ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 980px) {
    .mag-crumbs a { display: inline-flex; align-items: center; min-height: 44px; }
    .mag-crumbs ol { gap: 0.4em; }
}

/* In forced-colors (Windows High Contrast) the browser replaces backgrounds,
   so a button whose only affordance is its fill stops looking like a button.
   A transparent border costs nothing normally and is forced to a visible
   system colour there. The main site's .btn already has one. */
.mag-cta,
.mag-appeal__cta {
    border: 2px solid transparent;
}

@media (forced-colors: active) {
    .mag-cta,
    .mag-appeal__cta {
        border-color: currentColor;
    }

    /* The eyebrow rule is a gradient, which forced-colors drops. It is
       decorative, so let it go rather than substitute a stray line. */
    .mag-eyebrow::before { display: none; }
}
