
/* Containers */
.container { max-width: 960px; margin: 0 auto; padding: 0 48px; }
.container-wide { max-width: 960px; margin: 0 auto; padding: 0 48px; }
.reading { max-width: 680px; margin: 0 auto; padding: 0 48px; }

/* Links */
a { color: var(--link); text-decoration: none; border-bottom: 1px dotted currentColor; }
a:hover { border-bottom-style: solid; }

/* Typography */
.display {
    font-family: var(--font-serif);
    font-weight: 400;
    font-variation-settings: "opsz" 144, "SOFT" 30;
    font-size: clamp(44px, 6vw, 72px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0;
}
h1, .h1 {
    font-family: var(--font-serif);
    font-weight: 500;
    font-variation-settings: "opsz" 96, "SOFT" 40;
    font-size: clamp(32px, 4vw, 48px);
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin: 0 0 .6em;
}
h2, .h2 {
    font-family: var(--font-serif);
    font-weight: 500;
    font-variation-settings: "opsz" 72, "SOFT" 50;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 .5em;
}
h3, .h3 {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 18px;
    line-height: 1.3;
    letter-spacing: -0.005em;
    margin: 0 0 .5em;
}
.eyebrow {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--amber);
    margin: 0 0 .75em;
}

/* h1.title and p.subtitle: page-opening serif headline + italic sub.
 * Shared by course-detail, legal pages, and any future article-style page. */
h1.title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-variation-settings: "opsz" 144, "SOFT" 30;
    font-size: clamp(40px, 5.5vw, 60px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0 0 18px;
}
p.subtitle {
    font-family: var(--font-serif);
    font-style: italic;
    font-variation-settings: "opsz" 24, "SOFT" 60;
    font-size: 19px;
    line-height: 1.4;
    color: var(--muted);
    margin: 0 0 36px;
}

/* Breadcrumbs — mono-typed, used in course detail, legal, profile, etc. */
.crumbs {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    letter-spacing: .08em;
    padding: 20px 0 0;
    margin: 0 0 32px;
}
.crumbs a { color: var(--muted); border-bottom: none; }
.crumbs a:hover { color: var(--amber); }
.crumbs span + span::before { content: " / "; opacity: .5; }

/* .prose — base serif reading surface used for lesson bodies and legal text.
 * Page-specific overrides (e.g. course.css adds max-width: 62ch, legal.css
 * adds an address block) layer on top of this. */
.prose {
    font-family: var(--font-serif);
    font-variation-settings: "opsz" 14, "SOFT" 55;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.7;
    letter-spacing: -0.003em;
    color: var(--text);
}
.prose p { margin: 0 0 1.1em; }
.prose h2 {
    font-family: var(--font-serif);
    font-weight: 500;
    font-variation-settings: "opsz" 72, "SOFT" 50;
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 2em 0 .6em;
    scroll-margin-top: 100px;
}
.prose h2:first-child { margin-top: 0; }
.prose h3 {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 22px;
    margin: 1.6em 0 .5em;
}
.prose h4 {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 19px;
    margin: 1.4em 0 .4em;
}
.prose em { font-style: italic; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--link); border-bottom: 1px dotted currentColor; }
.prose a:hover { border-bottom-style: solid; }
.prose code {
    font-family: var(--font-mono);
    font-size: .9em;
    background: var(--bg-2);
    padding: .1em .3em;
    border-radius: var(--radius-sm);
}
.prose ul, .prose ol {
    padding-left: 1.4em;
    margin: 0 0 1.3em;
}
.prose li { margin-bottom: .4em; font-size: 17px; line-height: 1.65; }
.prose table {
    width: 100%;
    margin: 1.5em 0;
    border-collapse: collapse;
    font-size: 15px;
}
.prose th, .prose td {
    padding: .6em .8em;
    border: 1px solid var(--rule-2);
    text-align: left;
}
.prose th { background: var(--bg-2); font-weight: 600; }
[data-theme="dark"] .prose th,
[data-theme="dark"] .prose td { border-color: rgba(232, 225, 209, .22); }

/* ---------- Flash messages (from Django messages framework) ----------
 * Width + padding mirror .container-wide (max-width: 960px, padding:
 * 0 48px) so the flash block's left edge lines up with the page's
 * breadcrumbs, title, and body copy. Square corners by choice —
 * the rounded-pill look was reading as "AI-generated", which we
 * specifically don't want for pre-launch student-facing copy. */
.flash-msgs {
    max-width: 960px;
    margin: 16px auto 0;
    padding: 0 48px;
    display: flex; flex-direction: column; gap: 8px;
}
.flash {
    padding: 12px 16px;
    border: 1px solid var(--rule-2);
    border-left: 3px solid var(--amber);
    background: var(--bg-2);
    border-radius: 0;   /* square corners — no pill look */
    font-size: 14px;
    color: var(--text);
}
.flash--success { border-left-color: var(--brand-success, #6B8E5A); }
.flash--error,
.flash--danger { border-left-color: var(--brand-danger, #9E4A3E); }
.flash--warning { border-left-color: var(--amber); }
.flash--info { border-left-color: var(--ink-blue); }

/* ---------- Cookie consent banner (fixed bottom) ---------- */
.cookie-banner {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg-2);
    border-top: 1px solid var(--rule);
    box-shadow: 0 -4px 20px rgba(0,0,0,.08);
    z-index: 9999;
    padding: 16px 24px;
}
.cookie-banner-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex; align-items: center; gap: 20px;
    flex-wrap: wrap;
}
.cookie-banner-text {
    flex: 1 1 280px;
    font-size: 14px;
    margin: 0;
    color: var(--text);
}
.cookie-banner-actions {
    display: flex; gap: 8px; flex-wrap: wrap;
}
p { margin: 0 0 1em; max-width: 62ch; }
.lead {
    font-family: var(--font-serif);
    font-style: italic;
    font-variation-settings: "opsz" 24, "SOFT" 65;
    font-size: clamp(18px, 2vw, 22px);
    line-height: 1.5;
    color: var(--muted);
}
code, kbd, .mono {
    font-family: var(--font-mono);
    font-size: .86em;
    background: var(--bg-2);
    padding: .1em .35em;
    border-radius: var(--radius-sm);
}

/* Topbar */
.topbar {
    position: sticky; top: 0; z-index: 40;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--rule);
    padding: 14px 0;
}
.topbar .container-wide {
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 19px;
    font-variation-settings: "opsz" 36, "SOFT" 50;
    letter-spacing: -0.01em;
    text-decoration: none;
    color: var(--text);
    border-bottom: none;
}
.brand:hover { color: var(--amber); border-bottom: none; }
.topnav { display: flex; gap: 28px; align-items: center; }
.topnav a {
    color: var(--text);
    border-bottom: none;
    font-size: 14px;
    opacity: .8;
}
.topnav a:hover { color: var(--amber); opacity: 1; border-bottom: none; }
.topnav a.current { color: var(--amber); opacity: 1; }
.topnav-form { margin: 0; }
.topnav-logout {
    background: none; border: 0; padding: 0;
    color: var(--text); opacity: .8;
    font: inherit; font-size: 14px; cursor: pointer;
    border-bottom: 1px dotted currentColor;
}
.topnav-logout:hover { color: var(--amber); opacity: 1; border-bottom: none; }

/* Mode toggle (theme switcher) */
.mode-toggle {
    background: transparent;
    border: 1px solid var(--rule-2);
    color: var(--text);
    padding: 7px 14px;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    display: inline-flex; align-items: center; gap: 8px;
}
.mode-toggle:hover { border-color: var(--amber); color: var(--amber); }

/* Cluster of topbar toggles (language + theme) */
.topbar-controls { display: inline-flex; gap: 8px; align-items: center; }

/* Inline locale switcher — used in the homepage hero and the footer.
   Anchors inherit the site's default link styling; the current locale
   renders as plain text (not a link). Block-level margins so it sits
   cleanly between the hero lead paragraph and the CTA button row
   without overlapping the button. */
.lang-links {
    display: flex; flex-wrap: wrap; gap: 14px;
    font-size: 14px;
    margin: 1rem 0 1.5rem;
}
/* Footer use is on a single horizontal row alongside other inline
   elements — drop the block margins there. */
.site-foot .lang-links { margin: 0; }

/* Skip / cancel link — used as a soft text alternative to a button */
.skip {
    color: var(--muted);
    border-bottom: none;
    font-size: 14px;
    text-decoration: none;
}
.skip:hover { color: var(--amber); border-bottom: none; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit;
    font-weight: 500;
    padding: 14px 26px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .05s, color .15s;
    text-decoration: none;
    line-height: 1;
    border-bottom: none;
}
.btn:active { transform: translateY(1px); }
/* Anchor-as-button: cancel the global link styling. */
a.btn,
a.btn:link,
a.btn:visited,
a.btn:hover { text-decoration: none; border-bottom: 0; }

/* These rules need !important because Bootstrap's stylesheet loads after
 * shell.css and its .btn (--bs-btn-color/--bs-btn-bg cascade) would
 * otherwise paint our redesign buttons in Bootstrap's blue. */
.btn--primary,
a.btn--primary,
a.btn--primary:link,
a.btn--primary:visited {
    background: var(--amber) !important;
    color: #1B1306 !important;
    border-color: var(--amber) !important;
}
.btn--primary:hover,
a.btn--primary:hover {
    background: var(--amber-2) !important;
    border-color: var(--amber-2) !important;
    color: #1B1306 !important;
}

.btn--secondary,
a.btn--secondary,
a.btn--secondary:link,
a.btn--secondary:visited {
    background: transparent !important;
    color: var(--text) !important;
    border-color: var(--rule-2) !important;
}
.btn--secondary:hover,
a.btn--secondary:hover {
    border-color: var(--amber) !important;
    color: var(--amber) !important;
}

.btn--ghost,
a.btn--ghost,
a.btn--ghost:link,
a.btn--ghost:visited {
    background: transparent !important;
    color: var(--muted) !important;
    border-color: transparent !important;
    padding: 10px 14px;
}
.btn--ghost:hover,
a.btn--ghost:hover { color: var(--amber) !important; }

.btn--danger,
a.btn--danger,
a.btn--danger:link,
a.btn--danger:visited {
    background: var(--brand-danger, #9E4A3E) !important;
    color: #fff !important;
    border-color: var(--brand-danger, #9E4A3E) !important;
}
.btn--sm { padding: 8px 14px; font-size: 14px; }
.btn--lg { padding: 18px 34px; font-size: 17px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

/* Footer */
footer.site-foot {
    padding: 48px 0 48px;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 13px;
}
footer.site-foot .container-wide {
    display: flex; justify-content: space-between; align-items: center;
    gap: 24px; flex-wrap: wrap;
}
footer.site-foot nav { display: flex; gap: 22px; }
footer.site-foot nav a { color: var(--muted); border-bottom: none; }
footer.site-foot nav a:hover { color: var(--amber); }
footer.site-foot .foot-brand {
    font-family: var(--font-serif);
    font-style: italic;
    font-variation-settings: "opsz" 14, "SOFT" 70;
}

/* ---------- Base body ---------- */
html body {
    background: var(--bg);
    color: var(--text);
}

/* ---------- Feedback dialog (floating bug-report button + native <dialog>) ---------- */
.feedback-fab {
    position: fixed; bottom: 24px; right: 24px;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--brand-danger, #9E4A3E);
    color: #fff;
    border: none;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 16px rgba(0,0,0,.28);
    z-index: 1000;
    transition: transform .1s, background .15s;
}
.feedback-fab:hover { background: color-mix(in srgb, var(--brand-danger, #9E4A3E) 85%, #000); transform: scale(1.05); }
.feedback-fab:active { transform: scale(.97); }

.feedback-dialog {
    margin: auto;
    width: min(520px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--rule-2);
    border-radius: var(--radius-lg);
    background: var(--bg-2);
    color: var(--text);
    box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.feedback-dialog::backdrop {
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(3px);
}
.feedback-dialog-inner { display: flex; flex-direction: column; }
.feedback-dialog-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--rule);
}
.feedback-dialog-title {
    font-family: var(--font-serif); font-weight: 500; font-size: 18px;
}
.feedback-dialog-close {
    background: none; border: none; cursor: pointer;
    color: var(--muted); font-size: 22px; line-height: 1;
    padding: 0 4px;
}
.feedback-dialog-close:hover { color: var(--text); }
.feedback-dialog-body { padding: 20px 24px; overflow-y: auto; max-height: 65vh; }
.feedback-dialog-foot {
    padding: 14px 24px;
    border-top: 1px solid var(--rule);
    display: flex; justify-content: flex-end; gap: 8px;
}

.feedback-field { margin-bottom: 18px; }
.feedback-label {
    display: block;
    font-family: var(--font-mono); font-size: 11px;
    color: var(--muted); letter-spacing: .14em;
    text-transform: uppercase; margin: 0 0 6px;
}
.feedback-optional { font-weight: 400; opacity: .7; text-transform: none; letter-spacing: 0; }
.feedback-select,
.feedback-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--rule-2);
    border-radius: var(--radius-md);
    font: inherit; font-size: 15px;
    appearance: none;
}
.feedback-select:focus,
.feedback-textarea:focus { outline: 0; border-color: var(--amber); }
.feedback-textarea { resize: vertical; }
.feedback-screenshot-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.feedback-screenshot-img {
    max-height: 200px; max-width: 100%;
    border: 1px solid var(--rule-2);
    border-radius: var(--radius-md);
}
.feedback-error-banner {
    padding: 10px 14px;
    border: 1px solid var(--brand-danger, #9E4A3E);
    border-radius: var(--radius-md);
    color: var(--brand-danger, #9E4A3E);
    font-size: 13px;
    margin-bottom: 12px;
}
.feedback-info-banner {
    padding: 10px 14px;
    background: color-mix(in srgb, var(--amber) 10%, var(--bg));
    border: 1px solid color-mix(in srgb, var(--amber) 30%, var(--rule));
    border-radius: var(--radius-md);
    color: var(--muted); font-size: 13px;
}
.feedback-success {
    text-align: center; padding: 16px 0;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.feedback-success-icon {
    font-size: 2.5rem;
    color: var(--brand-success, #6B8E5A);
}
.feedback-success h5 {
    font-family: var(--font-serif); font-weight: 500; font-size: 20px;
    margin: 0;
}
.feedback-success p { color: var(--muted); font-size: 14px; max-width: 36ch; margin: 0; }
.feedback-ticket-row {
    display: flex; align-items: center; gap: 10px;
    margin: 6px 0;
}
.feedback-ticket-code {
    font-family: var(--font-mono); font-size: 1.3rem;
    letter-spacing: .1em;
    padding: .3em .7em;
    background: var(--bg);
    border: 1px solid var(--rule-2);
    border-radius: var(--radius-md);
}
.feedback-copy-confirm {
    color: var(--brand-success, #6B8E5A); font-size: 13px;
}

/* ---------- Responsive visibility helpers ---------- */
@media (max-width: 560px) {
    .hide-mobile { display: none; }
}

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

/* Hamburger button — hidden on desktop */
.mobile-actions { display: none; }
.hamburger {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 36px; height: 36px;
    background: none; border: none; padding: 4px; cursor: pointer;
    /* Disable the 300ms tap delay + double-tap zoom for this button.
       Without this, iOS Safari sometimes swallows the click if the
       user taps twice quickly or with a slight movement. */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.hamburger span {
    display: block; height: 2px; border-radius: 2px;
    background: var(--text);
    transition: transform .2s, opacity .2s;
}

/* Mobile drawer — hidden by default */
.mobile-drawer {
    display: none;
    padding: 12px 16px 16px;
    border-top: 1px solid var(--rule);
    background: var(--bg);
}
.mobile-drawer-nav {
    display: flex; flex-direction: column; gap: 0;
    margin-bottom: 12px;
}
.mobile-drawer-nav a,
.mobile-drawer-nav .topnav-logout {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--rule);
    color: var(--text); font-size: 15px;
    text-decoration: none; border-right: none; border-left: none; border-top: none;
    background: none; width: 100%; text-align: left; cursor: pointer;
    font: inherit;
}
.mobile-drawer-nav a:last-child,
.mobile-drawer-nav .topnav-form:last-child .topnav-logout { border-bottom: none; }
.mobile-drawer-nav a:hover,
.mobile-drawer-nav .topnav-logout:hover { color: var(--amber); }
.mobile-drawer-controls {
    display: flex; gap: 8px; align-items: center;
    padding-top: 12px;
}

/* Open state */
.topbar.menu-open .mobile-drawer { display: block; }
.topbar.menu-open .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.topbar.menu-open .hamburger span:nth-child(2) { opacity: 0; }
.topbar.menu-open .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Hide Sign in in topbar while drawer is open — it appears inside the drawer instead */
.topbar.menu-open .topnav-mobile-signin,
.topbar.menu-open .topnav-mobile-user { opacity: 0; pointer-events: none; }

@media (max-width: 560px) {
    .topnav, .topbar-controls { display: none; }
    .mobile-actions {
        display: flex; align-items: center; gap: 12px; margin-left: auto;
    }
    .topnav-mobile-signin, .topnav-mobile-user {
        font-size: 14px; color: var(--text); text-decoration: none;
        border-bottom: none; white-space: nowrap; opacity: .8;
    }
    .topnav-mobile-signin:hover, .topnav-mobile-user:hover { color: var(--amber); opacity: 1; }
    .topbar .container-wide { padding: 0 16px; }
}

