/* Stanford Guide — V8 (Cardinal Stripe + Mono Grid) */

:root {
    --cardinal: #8C1515;
    --cardinal-dark: #820000;
    --black: #2E2D29;
    --cool-grey: #53565A;
    --grey-mid: #767674;
    --grey-light: #ABABA9;
    --border: #EAEAEA;
    --border-soft: #F0F0EE;
    --bg: #fff;
    --bg-soft: #FAF7F0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    color: var(--black);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* === Masthead band (Cardinal stripe) === */
.masthead-band {
    background: var(--cardinal);
    color: #fff;
    padding: 1rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.masthead-band a.wordmark,
.masthead-band .wordmark {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.3px;
    color: #fff;
    text-decoration: none;
}

.masthead-band a.wordmark:hover { opacity: 0.85; }

.masthead-band .est {
    font-family: 'Roboto Mono', 'IBM Plex Mono', SF Mono, Consolas, monospace;
    font-size: 11px;
    opacity: 0.85;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* === Page container === */
main {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 2.5rem 3rem;
}

/* === Home page === */
.tagline {
    font-size: 15px;
    color: var(--cool-grey);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.sort-note {
    font-family: 'Roboto Mono', 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--grey-mid);
    letter-spacing: 0.3px;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.sort-note .tier-star {
    color: var(--cardinal);
    font-size: 12px;
    margin-right: 2px;
}

/* Tier star prefix on titles */
.tier-star {
    color: var(--cardinal);
    display: inline-block;
    line-height: 1;
    margin-right: 2px;
}

/* Tier 3 (deep cuts) — slightly muted */
.article-row.tier-3 .article-title {
    color: var(--cool-grey);
    font-weight: 500;
}

.article-row.tier-3 .article-desc {
    color: var(--grey-light);
}

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

.article-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-soft);
    align-items: baseline;
}

.article-row:last-child { border-bottom: none; }

.article-date {
    font-family: 'Roboto Mono', 'IBM Plex Mono', SF Mono, Consolas, monospace;
    color: var(--grey-mid);
    font-size: 11px;
    padding-top: 3px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.2px;
}

.article-title {
    color: var(--black);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    line-height: 1.3;
    display: block;
}

.article-title:visited { color: var(--black); }
.article-title:hover { color: var(--cardinal); text-decoration: underline; }

.article-desc {
    font-size: 13px;
    color: var(--grey-mid);
    margin-top: 4px;
    font-weight: 400;
    line-height: 1.5;
}

/* === Article page === */
article nav,
.back-nav {
    font-family: 'Roboto Mono', 'IBM Plex Mono', monospace;
    font-size: 11px;
    margin-bottom: 1.5rem;
    letter-spacing: 0.5px;
}

article nav a,
.back-nav a {
    color: var(--grey-mid);
    text-decoration: none;
}

article nav a:hover,
.back-nav a:hover { color: var(--cardinal); }

article h1 {
    font-family: 'Inter', sans-serif;
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.5px;
    color: var(--black);
    margin-bottom: 0.5rem;
}

.article-meta {
    font-family: 'Roboto Mono', 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--grey-mid);
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.75rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.article-meta .dot { color: var(--cardinal); margin: 0 4px; }

/* === Article body typography === */
article {
    font-size: 16px;
    line-height: 1.65;
    color: var(--black);
}

article p { margin: 1.05em 0; }

/* Runs of consecutive short <p>s (addresses, class lists, link lists,
   signature lines) get tagged .line so they render as a tight block. */
article p.line { margin: 0.25em 0; }
article p.line + p:not(.line) { margin-top: 1.05em; }
article p:not(.line) + p.line { margin-top: 1em; }

/* Q&A formatting: short ?-ending paragraphs are tagged .qa-q in build.
   Bold the question and tighten spacing to the immediately following answer. */
article p.qa-q {
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 0.3em;
}
article p.qa-q + p { margin-top: 0.15em; }

article h2, article h3, article h4, article h5, article h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: var(--black);
    line-height: 1.25;
    letter-spacing: -0.3px;
}

article h2 { font-size: 26px; margin: 2em 0 0.5em; }
article h3 { font-size: 22px; margin: 2em 0 0.5em; }
article h4 { font-size: 18px; margin: 1.75em 0 0.4em; font-weight: 600; }
article h5, article h6 { font-size: 16px; margin: 1.5em 0 0.4em; }

article a {
    color: var(--cardinal);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

article a:visited { color: var(--cardinal); }
article a:hover { color: var(--cardinal-dark); }

article ul, article ol {
    padding-left: 1.4em;
    margin: 1em 0;
}

article li { margin: 0.5em 0; }

article blockquote {
    margin: 1.25em 0;
    padding: 0.5em 1em;
    border-left: 3px solid var(--cardinal);
    background: var(--bg-soft);
    color: var(--cool-grey);
}

article blockquote p { margin: 0.5em 0; }
article blockquote p:first-child { margin-top: 0; }
article blockquote p:last-child { margin-bottom: 0; }

article img { max-width: 100%; height: auto; display: block; margin: 1em 0; }

article hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2em 0;
}

article code {
    font-family: 'Roboto Mono', 'IBM Plex Mono', SF Mono, Consolas, monospace;
    font-size: 0.92em;
    background: var(--bg-soft);
    padding: 0.15em 0.35em;
    border-radius: 3px;
}

article pre {
    background: var(--bg-soft);
    padding: 1em;
    overflow-x: auto;
    border-radius: 4px;
    margin: 1em 0;
    font-size: 12.5px;
}

article pre code { padding: 0; background: none; }

article strong { font-weight: 700; }
article em { font-style: italic; }

/* === Link cards (replaces broken Medium "card" embeds + embedly fallbacks) === */
.embed-fallback {
    border: 1px solid var(--border);
    border-left: 3px solid var(--cardinal);
    padding: 0.75em 1em;
    background: #fff;
    margin: 1.25em 0;
    word-break: break-word;
}

.embed-fallback .card-link {
    display: block;
    color: var(--black);
    text-decoration: none;
}

.embed-fallback .card-link:hover .card-title { color: var(--cardinal); }

.embed-fallback .card-title {
    display: block;
    font-weight: 600;
    font-size: 15px;
    color: var(--black);
    line-height: 1.35;
}

.embed-fallback .card-desc {
    display: block;
    color: var(--grey-mid);
    font-size: 13px;
    margin-top: 4px;
    line-height: 1.45;
}

.embed-fallback .card-domain {
    display: block;
    color: var(--grey-mid);
    font-size: 11px;
    font-family: 'Roboto Mono', 'IBM Plex Mono', monospace;
    margin-top: 6px;
    letter-spacing: 0.3px;
}

/* === Video embeds (16:9 responsive) === */
.video-embed,
.slideshare-embed {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    margin: 1.5em 0;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}

.video-embed iframe,
.slideshare-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Image caption fallback */
.image-caption {
    text-align: center;
    color: var(--grey-mid);
    font-size: 13px;
    font-style: italic;
    margin: 1em 0;
}

/* Article footer tags */
.article-meta-tags {
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    font-family: 'Roboto Mono', 'IBM Plex Mono', monospace;
    color: var(--grey-mid);
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.article-meta-tags .tag-text { color: var(--grey-mid); }
.article-meta-tags .tag-text + .tag-text::before { content: " · "; color: var(--cardinal); }

/* === Responsive === */
@media (max-width: 600px) {
    .masthead-band { padding: 0.875rem 1.25rem; }
    .masthead-band a.wordmark, .masthead-band .wordmark { font-size: 16px; }
    .masthead-band .est { font-size: 10px; }

    main { padding: 1.5rem 1.25rem 2.5rem; }

    .article-row {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 14px 0;
    }
    .article-date { padding-top: 0; font-size: 10.5px; }
    .article-title { font-size: 15px; }

    article h1 { font-size: 28px; letter-spacing: -0.3px; }
    article h3 { font-size: 19px; }
    article h4 { font-size: 16px; }

    article { font-size: 15.5px; }
}
