/* ===============================================================
   Shared Project Page Styles — V5 aligned
   Used by: projects/project1.html, project2-science.html,
            project2-systems.html, projects.html

   Load order on every project page:
     1. core-styles.css    (base + pre/code + .callout)
     2. v5-tokens.css      (design tokens — --v5-* + --m1..m6)
     3. v5-projects.css    (v5 chrome: nav, h1/h2, body bg)
     4. project-styles.css (this file — page components)

   Design language: V5 minimal.
   - Surfaces: white cards on a pale neutral page background.
   - Borders: 1px hairlines, no heavy color frames.
   - Accent: a single blue (m1) left-bar on key surfaces — sparingly.
   - Headings: Fraunces serif (inherited from v5-projects).
   - Body: Inter Tight sans.
   - Code: dark theme inherited from core-styles.css (pre::before
     labels replaced per-language below).
   =============================================================== */

/* ─────────────── Page wrapper */
.project-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

.project-page .subtitle {
    font-size: 1rem;
    color: var(--v5-muted);
    margin-bottom: 1.5rem;
}

.project-page .project-hero {
    text-align: center;
    margin: 1.5rem 0 2rem 0;
}

.project-page .project-hero img {
    max-width: 540px;
    width: 100%;
    height: auto;
    border-radius: var(--v5-r);
    box-shadow: var(--v5-shadow-2);
}

/* ─────────────── Shared section surface
   Mission / Schedule / Why / Rubric / Library Policy / FAQ /
   Submission / Honor all sit on the same white-card surface with
   the same hairline and radius. Personality comes from a small
   left-bar accent, not heavy colored frames. */
.mission-briefing,
.schedule-section,
.why-section,
.rubric-section,
.faq-section,
.submission-box,
.honor-code,
.callout.info,
.callout.success,
.callout.warning,
.callout.danger {
    background: var(--v5-surface);
    border: 1px solid var(--v5-hairline);
    border-radius: var(--v5-r);
    padding: 1.5rem 1.5rem;
    margin: 1.75rem 0;
    box-shadow: none;
}

/* Section identity lives in the heading chip (see .*-section > h2
   below), not in a heavy border-left bar. No outer accent bars —
   double-bar stacking with inner items was confusing. */

/* core-styles.css ships a global h2::before decorative bar (4px
   teal→blue gradient). On project pages we provide our own accent
   via border-left on the heading, so kill the built-in bar. */
.project-page h2::before { content: none !important; }

/* Section h2 — identity lives here via a subtle left accent bar
   on the heading itself, not on the whole card. Breathing room
   between the bar and the serif so first glyph doesn't collide. */
.mission-briefing > h2,
.schedule-section > h2,
.why-section > h2,
.rubric-section > h2,
.faq-section > h2,
.submission-box > h2,
.callout.info > h2,
.callout.success > h2,
.callout.warning > h2,
.callout.danger > h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    border: none;
    padding: 0.1rem 0 0.1rem 0.85rem;
    color: var(--v5-ink);
    border-left: 3px solid var(--v5-muted);
    line-height: 1.15;
}

.mission-briefing  > h2 { border-left-color: var(--m1); }
.schedule-section  > h2 { border-left-color: var(--m3); }
.why-section       > h2 { border-left-color: var(--v5-warn); }
.rubric-section    > h2 { border-left-color: var(--m1); }
.faq-section       > h2 { border-left-color: var(--v5-muted); }
.submission-box    > h2 { border-left-color: var(--v5-warn); }

.honor-code > h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    padding: 0.1rem 0 0.1rem 0.85rem;
    color: var(--v5-ink);
    font-family: var(--v5-serif);
    font-weight: 500;
    font-size: 1.35rem;
    letter-spacing: -0.015em;
    border-left: 3px solid var(--v5-danger);
    line-height: 1.15;
}

/* ─────────────── Mission section */
.mission-section {
    margin: 1.25rem 0;
}
.mission-section > h3 {
    color: var(--v5-ink);
    font-size: 1.05rem;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}
.mission-section ul {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
    color: var(--v5-text);
    line-height: 1.6;
}
.mission-section li { margin: 0.3rem 0; }

/* Requirements box — tinted hairline card inside mission */
.requirements-box {
    background: var(--m1-tint);
    border: 1px solid var(--v5-hairline);
    padding: 0.85rem 1.15rem;
    margin: 1rem 0;
    border-radius: var(--v5-r-sm);
}
.requirements-box h3 {
    color: var(--v5-ink);
    margin: 0 0 0.4rem 0;
    font-size: 1rem;
    font-weight: 600;
}
.requirements-box ul { margin: 0.3rem 0 0 1.1rem; padding: 0; }
.requirements-box li { margin: 0.25rem 0; color: var(--v5-text); }

/* Quick Links / Prerequisites */
.quick-links {
    background: var(--v5-bg);
    border: 1px solid var(--v5-hairline);
    border-radius: var(--v5-r-sm);
    padding: 0.85rem 1.15rem;
    margin: 1rem 0;
}
.quick-links h4 {
    color: var(--v5-ink);
    margin: 0 0 0.4rem 0;
    font-size: 0.95rem;
    font-weight: 600;
}
.quick-links ul { list-style: none; padding: 0; margin: 0; }
.quick-links li { margin: 0.25rem 0; color: var(--v5-text); }
.quick-links a {
    color: var(--m1);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

/* ─────────────── Work-Back Schedule */
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 0.85rem;
    margin: 1rem 0;
}
.schedule-card {
    background: var(--v5-surface);
    padding: 0.9rem 1rem;
    border: 1px solid var(--v5-hairline);
    border-radius: var(--v5-r-sm);
}
.schedule-card h4 {
    color: var(--v5-ink);
    margin: 0 0 0.2rem 0;
    font-size: 0.95rem;
    font-weight: 600;
}
.schedule-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--v5-text);
    line-height: 1.45;
}
.schedule-card p.hours {
    font-weight: 600;
    color: var(--v5-muted);
    margin-bottom: 0.2rem;
    font-family: var(--v5-mono);
    font-size: 0.8rem;
}
.schedule-total {
    background: var(--v5-bg);
    border: 1px solid var(--v5-hairline);
    padding: 0.75rem 1rem;
    border-radius: var(--v5-r-sm);
    margin-top: 0.75rem;
    text-align: center;
    font-weight: 500;
    color: var(--v5-ink);
    font-size: 0.95rem;
}

/* ─────────────── Why section content */
.why-section ul {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
}
.why-section li {
    margin: 0.55rem 0;
    color: var(--v5-text);
    line-height: 1.55;
}

/* ─────────────── Rubric */
.rubric-item {
    margin: 0.6rem 0;
    padding: 0.9rem 1.15rem;
    background: var(--v5-bg);
    border: 1px solid var(--v5-hairline);
    border-radius: var(--v5-r-sm);
}
.rubric-item h3 {
    color: var(--v5-ink);
    margin: 0 0 0.4rem 0;
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.rubric-item ul { margin: 0.35rem 0 0 1.15rem; padding: 0; }
.rubric-item li {
    margin: 0.3rem 0;
    font-size: 0.92rem;
    color: var(--v5-text);
    line-height: 1.5;
}
.rubric-item p {
    margin: 0.5rem 0 0 0;
    color: var(--v5-text);
    font-size: 0.92rem;
}

/* Points badges — single-family color, not rainbow */
.points {
    display: inline-block;
    background: var(--m1);
    color: white;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    font-family: var(--v5-sans);
    letter-spacing: 0.01em;
}
.points.bonus {
    background: var(--v5-done);
}
.points.negative {
    background: var(--v5-danger);
}

/* Grading Model nested callout */
.grading-model {
    background: var(--m1-tint);
    border: 1px solid var(--v5-hairline);
    border-radius: var(--v5-r-sm);
    padding: 1rem 1.15rem;
    margin: 1.25rem 0 0 0;
}
.grading-model h3 {
    color: var(--v5-ink);
    margin: 0 0 0.5rem 0;
    font-size: 1.05rem;
    font-weight: 600;
}
.grading-model > p {
    margin: 0.4rem 0;
    color: var(--v5-text);
    font-size: 0.92rem;
    line-height: 1.55;
}
.grading-model .grading-sub {
    background: var(--v5-surface);
    border: 1px solid var(--v5-hairline);
    border-radius: var(--v5-r-sm);
    padding: 0.85rem 1.1rem;
    margin-top: 0.85rem;
}
.grading-model .grading-sub h4 {
    margin: 0 0 0.4rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--v5-ink);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.grading-model .grading-sub ul {
    margin: 0.25rem 0 0 1.1rem;
    padding: 0;
    font-size: 0.9rem;
    color: var(--v5-text);
}
.grading-model .grading-sub li { margin: 0.25rem 0; }

/* ─────────────── FAQ — V5 minimal
   Neutral section shell, each subsection has a serif title and a
   hairline underline. No rainbow gradients. */
.faq-section > h2 {
    margin-top: 0;
}
.faq-subsection {
    margin: 1.5rem 0 0 0;
}
.faq-subsection:first-of-type { margin-top: 0.5rem; }

.faq-subsection > h3 {
    background: transparent;
    color: var(--v5-ink);
    padding: 0.35rem 0 0.5rem 0;
    margin: 0 0 0.75rem 0;
    font-family: var(--v5-serif);
    font-weight: 500;
    font-size: 1.2rem;
    letter-spacing: -0.01em;
    border: none;
    border-bottom: 1px solid var(--v5-hairline);
    font-variation-settings: 'opsz' 48;
}

.faq-item {
    margin: 0.75rem 0;
    padding: 0.85rem 1.1rem;
    background: var(--v5-surface);
    border: 1px solid var(--v5-hairline);
    border-radius: var(--v5-r-sm);
}
.faq-item h4 {
    color: var(--v5-ink);
    margin: 0 0 0.35rem 0;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.35;
}
.faq-item p {
    color: var(--v5-text);
    margin: 0.35rem 0;
    line-height: 1.55;
    font-size: 0.92rem;
}
.faq-item ul,
.faq-item ol {
    margin: 0.35rem 0 0.35rem 1.3rem;
    padding: 0;
}
.faq-item li {
    margin: 0.25rem 0;
    color: var(--v5-text);
    line-height: 1.5;
    font-size: 0.92rem;
}

/* Inline code inside FAQ / prose — light chip.
   :not(pre *) excludes <code> that's inside a <pre> block so code
   lines don't get wrapped in chips (the "gobbledygook text" look). */
.faq-item > code,
.faq-item p code,
.faq-item li code,
.mission-section code,
.rubric-item > code,
.rubric-item p code,
.rubric-item li code,
.requirements-box code,
.quick-links code,
.why-section code,
.submission-box code,
.honor-code code,
.callout code,
.grading-model code,
.example-box > p > code,
.example-box > h5 > code {
    background: var(--v5-bg);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    border: 1px solid var(--v5-hairline);
    font-family: var(--v5-mono);
    font-size: 0.85em;
    color: var(--v5-ink);
}

/* Hard reset for any <code> inside a <pre> — code blocks must
   inherit the pre's dark theme, never the inline chip look. */
.project-page pre code,
.project-page pre code * {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: inherit !important;
}
.project-page pre code {
    color: inherit !important;
    font-family: var(--v5-mono) !important;
}

/* ─────────────── Good / Bad two-column examples — V5 tone.
   Text-only comparisons stay side by side so the contrast is
   visible at a glance. Code comparisons auto-stack vertically
   so each <pre> gets the full column width instead of fighting
   four layers of nested padding for 200px of breathing room. */
.good-bad-examples {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin: 0.75rem 0;
}
.good-bad-examples:has(pre) {
    grid-template-columns: 1fr;
}
@media (max-width: 720px) {
    .good-bad-examples { grid-template-columns: 1fr; }
}
.example-box {
    padding: 0.85rem 1rem;
    border-radius: var(--v5-r-sm);
    background: var(--v5-surface);
    border: 1px solid var(--v5-hairline);
}
.example-box.good { border-color: var(--v5-done); background: color-mix(in srgb, var(--v5-done) 4%, var(--v5-surface)); }
.example-box.bad  { border-color: var(--v5-danger); background: color-mix(in srgb, var(--v5-danger) 4%, var(--v5-surface)); }
.example-box h5 {
    margin: 0 0 0.4rem 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--v5-ink);
}
.example-box ul { margin: 0.25rem 0 0 1.1rem; padding: 0; }
.example-box li {
    margin: 0.2rem 0;
    font-size: 0.88rem;
    color: var(--v5-text);
    line-height: 1.5;
}

/* ─────────────── Scoring grid (inside FAQ) */
.scoring-grid {
    background: var(--v5-bg);
    border: 1px solid var(--v5-hairline);
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    border-radius: var(--v5-r-sm);
}
.scoring-grid h5 {
    color: var(--v5-ink);
    margin: 0 0 0.35rem 0;
    font-size: 0.92rem;
    font-weight: 600;
}

/* ─────────────── Dataset cards */
.dataset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
    margin: 0.75rem 0;
}
.dataset-card {
    background: var(--v5-surface);
    border: 1px solid var(--v5-hairline);
    border-radius: var(--v5-r-sm);
    padding: 0.75rem 0.9rem;
}
.dataset-card h5 {
    color: var(--v5-ink);
    margin: 0 0 0.4rem 0;
    font-size: 0.95rem;
    font-weight: 600;
}
.dataset-card p {
    font-size: 0.85rem;
    color: var(--v5-text);
    margin: 0.15rem 0;
    line-height: 1.45;
}

/* ─────────────── Table schema hints (Systems) */
.table-schema {
    background: var(--v5-bg);
    border: 1px solid var(--v5-hairline);
    padding: 0.4rem 0.9rem;
    margin: 0.35rem 0;
    border-radius: var(--v5-r-sm);
}
.table-schema h4 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--v5-text);
    font-weight: 500;
}

/* ─────────────── Systems Gru intro (scoped personality) */
.gru-intro {
    margin: 0.75rem 0;
}
.gru-highlight {
    background: var(--m2-tint);
    padding: 0.75rem 1rem;
    border-radius: var(--v5-r-sm);
    margin: 0.75rem 0;
    border: 1px solid var(--v5-hairline);
}
.highlight-text {
    font-weight: 600;
    color: var(--v5-ink);
    font-family: var(--v5-serif);
    font-style: italic;
    font-size: 1.02rem;
}

/* ─────────────── Submission + Honor content */
.submission-box > p,
.honor-code > p {
    margin: 0.5rem 0;
    color: var(--v5-text);
}
.submission-box ul,
.honor-code ul {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
}
.submission-box li {
    margin: 0.3rem 0;
    color: var(--v5-text);
}
.honor-code li {
    margin: 0.3rem 0;
    color: var(--v5-text);
}

/* ─────────────── Comparison table (projects.html index) */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.92rem;
    background: var(--v5-surface);
    border: 1px solid var(--v5-hairline);
    border-radius: var(--v5-r-sm);
    overflow: hidden;
}
.comparison-table th {
    background: var(--v5-bg);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--v5-ink);
    border-bottom: 1px solid var(--v5-hairline);
    font-family: var(--v5-sans);
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.comparison-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--v5-hairline);
    color: var(--v5-text);
    vertical-align: top;
    line-height: 1.5;
}
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table .track-tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    font-family: var(--v5-sans);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.comparison-table .track-tag.p1       { background: var(--m1); }
.comparison-table .track-tag.science  { background: var(--m4); }
.comparison-table .track-tag.systems  { background: var(--m3); }

/* ─────────────── Architecture collapsible */
.architecture-details {
    margin: 1.5rem 0;
    border: 1px solid var(--v5-hairline);
    border-radius: var(--v5-r);
    background: var(--v5-surface);
    padding: 0;
}
.architecture-details > summary {
    padding: 0.95rem 1.25rem;
    font-weight: 500;
    font-family: var(--v5-serif);
    color: var(--v5-ink);
    cursor: pointer;
    font-size: 1.1rem;
    list-style: none;
    user-select: none;
    border-radius: var(--v5-r);
}
.architecture-details > summary::before {
    content: '▸ ';
    color: var(--v5-muted);
    margin-right: 0.5rem;
    display: inline-block;
}
.architecture-details[open] > summary::before { content: '▾ '; }
.architecture-details[open] > summary {
    border-bottom: 1px solid var(--v5-hairline);
    border-radius: var(--v5-r) var(--v5-r) 0 0;
}
.architecture-details > div { padding: 1rem 1.25rem 1.25rem 1.25rem; }

/* ─────────────── Primary CTA button */
.btn-primary {
    display: inline-block;
    padding: 0.65rem 1.25rem;
    background: var(--m1);
    color: white !important;
    text-decoration: none;
    border-radius: var(--v5-r-sm);
    font-weight: 600;
    font-size: 0.92rem;
    font-family: var(--v5-sans);
    transition: background 0.15s;
}
.btn-primary:hover { background: #1d4ed8; }

/* ─────────────── Pitfalls / performance tables.
   Full width of their container (the faq-item), fixed layout so
   columns divide evenly, and cells wrap long content including
   inline code so nothing overflows horizontally. */
.pitfalls-table,
.performance-table {
    width: 100%;
    margin: 0.75rem 0;
    border-collapse: collapse;
    font-size: 0.88rem;
    background: var(--v5-surface);
    border: 1px solid var(--v5-hairline);
    border-radius: var(--v5-r-sm);
    overflow: hidden;
    table-layout: fixed;
}
.pitfalls-table th,
.pitfalls-table td,
.performance-table th,
.performance-table td {
    word-break: break-word;
    overflow-wrap: anywhere;
}
.pitfalls-table code,
.performance-table code {
    word-break: break-all;
    white-space: normal;
}
.pitfalls-table th,
.pitfalls-table td,
.performance-table th,
.performance-table td {
    padding: 0.6rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--v5-hairline);
    vertical-align: top;
    color: var(--v5-text);
    line-height: 1.5;
}
.pitfalls-table th,
.performance-table th {
    background: var(--v5-bg);
    color: var(--v5-ink);
    font-weight: 600;
    font-family: var(--v5-sans);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--v5-hairline);
}
.pitfalls-table tr:last-child td,
.performance-table tr:last-child td { border-bottom: none; }

/* ─────────────── Code blocks — reuse core-styles.css dark theme.
   Override the generic pre::before "SQL" label per-language so
   Python blocks don't get mislabeled. Code blocks use the full
   column width of their container so long lines have breathing
   room instead of wrapping or scrolling prematurely. */
.project-page pre {
    max-width: none;
    margin: 0.75rem 0;
    padding: 1.1rem 1.4rem;
    font-size: 13px;
    line-height: 1.65;
    overflow-x: auto;
}

/* Inside example boxes (good/bad two-column grid), code blocks
   must stay inside their column. min-width:0 on the box lets the
   grid column shrink below content width; overflow-x on the pre
   lets long code lines scroll within the box instead of bleeding
   out of it. */
.example-box { min-width: 0; }
.example-box pre {
    max-width: 100%;
    margin: 0.5rem 0 0;
    overflow-x: auto;
}

/* Language label in top-right. Override the generic "SQL" label. */
.project-page pre.language-python::before {
    content: 'PYTHON';
    color: #f0ad4e;
    background: rgba(240, 173, 78, 0.1);
    border: 1px solid rgba(240, 173, 78, 0.25);
}
.project-page pre.language-js::before,
.project-page pre.language-javascript::before {
    content: 'JS';
    color: #f7df1e;
    background: rgba(247, 223, 30, 0.1);
    border: 1px solid rgba(247, 223, 30, 0.25);
}

/* Light-display blocks (arithmetic, notes) — no misleading "SQL" label,
   and override the dark theme back to a plain paper look. */
.project-page pre.light-display {
    background: var(--v5-bg) !important;
    color: var(--v5-text) !important;
    border: 1px solid var(--v5-hairline) !important;
    box-shadow: none !important;
    border-left: 3px solid var(--v5-muted) !important;
}
.project-page pre.light-display::before {
    content: 'NOTE';
    color: var(--v5-muted);
    background: transparent;
    border: 1px solid var(--v5-hairline);
}
.project-page pre.light-display code {
    color: var(--v5-text) !important;
}

/* SQL code block wrapper removed — use plain <pre class="language-sql"> instead */
.sql-code-block > pre {
    margin: 0;
}
.sql-code-block {
    margin: 1rem 0;
}
