:root {
    --ink: #17312d;
    --muted: #64716d;
    --paper: #f7f6f1;
    --surface: #ffffff;
    --line: #dde3df;
    --accent: #8b5e3c;
    --accent-dark: #6f472b;
    --soft: #eef3ef;
    --success: #2f6e57;
    --danger: #9b3d3d;
    --shadow: 0 18px 50px rgba(32, 51, 46, .08);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
body { margin: 0; min-height: 100vh; background: linear-gradient(180deg, #fbfaf6 0%, var(--paper) 100%); }
a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input { font: inherit; }
.shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.site-header { background: rgba(251, 250, 246, .94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(10px); }
.header-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -.02em; }
.brand-logo { height: 42px; width: auto; max-width: 120px; display: block; object-fit: contain; }
.nav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.nav a { color: var(--ink); text-decoration: none; }
.nav-cta { padding: 10px 14px; border: 1px solid var(--ink); border-radius: 999px; }
.link-button { border: 0; padding: 0; background: transparent; color: var(--accent-dark); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.hero { padding: 90px 0 84px; }
.hero-grid { display: grid; grid-template-columns: 1.35fr .85fr; gap: 64px; align-items: center; }
.eyebrow { margin: 0 0 14px; color: var(--accent-dark); font-size: 13px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(42px, 7vw, 74px); line-height: .98; letter-spacing: -.045em; font-weight: 500; }
.lead { margin: 26px 0 0; max-width: 700px; color: var(--muted); font-size: 20px; line-height: 1.65; }
.lead.compact { max-width: 650px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.button { min-height: 48px; border-radius: 12px; padding: 13px 19px; border: 1px solid transparent; display: inline-flex; justify-content: center; align-items: center; text-decoration: none; font-weight: 700; cursor: pointer; }
.button.primary { background: var(--ink); color: white; }
.button.primary:hover { background: #22423d; }
.button.secondary { color: var(--ink); background: transparent; border-color: var(--line); }
.button.full { width: 100%; }
.trust-panel, .form-card, .prose-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.trust-panel { padding: 34px; }
.trust-panel h2, .status-card h2 { margin: 0 0 12px; font-size: 19px; }
.trust-panel p, .trust-panel li, .status-card p { color: var(--muted); line-height: 1.65; }
.trust-panel ul { margin: 22px 0 0; padding-left: 20px; }
.trust-panel li + li { margin-top: 10px; }
.page-section { min-height: calc(100vh - 150px); padding: 58px 20px 78px; display: grid; place-items: start center; }
.dashboard-section { display: block; }
.form-card { width: min(500px, 100%); padding: 34px; }
.form-card.wide { width: min(600px, 100%); }
.form-card h1, .prose-card h1 { font-size: clamp(36px, 6vw, 52px); margin-bottom: 16px; }
.muted, .form-foot, .form-card small { color: var(--muted); line-height: 1.6; }
.form-stack { display: grid; gap: 18px; margin-top: 28px; }
.form-stack label:not(.check-row) { display: grid; gap: 8px; font-weight: 700; font-size: 14px; }
input[type="text"], input[type="email"], input[type="password"] { width: 100%; min-height: 48px; padding: 11px 13px; background: #fff; color: var(--ink); border: 1px solid #cfd8d3; border-radius: 10px; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 94, 60, .12); }
.check-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; color: var(--muted); line-height: 1.5; font-size: 14px; }
.check-row input { margin-top: 4px; }
.form-links { margin-top: 22px; display: flex; justify-content: space-between; gap: 16px; font-size: 14px; }
.form-foot { margin: 22px 0 0; text-align: center; font-size: 14px; }
.error-box, .success-box, .flash, .notice-box { border-radius: 12px; padding: 14px 16px; line-height: 1.5; }
.error-box { background: #fff2f2; border: 1px solid #eccaca; color: var(--danger); margin-top: 20px; }
.success-box, .flash { background: #edf7f2; border: 1px solid #cde4d9; color: var(--success); }
.flash { margin-top: 20px; }
.notice-box { background: var(--soft); border: 1px solid var(--line); margin-top: 26px; }
.notice-box p { margin-bottom: 0; color: var(--muted); }
.account-email { padding: 14px 16px; border-radius: 10px; background: var(--soft); font-weight: 700; margin: 24px 0; overflow-wrap: anywhere; }
.secondary-form { margin-top: 20px; text-align: center; }
.status-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 18px; margin-top: 34px; }
.status-card { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 24px; display: flex; gap: 14px; box-shadow: var(--shadow); }
.status-card.soft { background: var(--soft); box-shadow: none; }
.status-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--success); flex: 0 0 auto; margin-top: 6px; }
.status-card p { margin: 0; }
.foundation-note { margin-top: 24px; border-left: 3px solid var(--accent); padding: 6px 0 6px 18px; color: var(--muted); }
.foundation-note strong { color: var(--ink); }
.foundation-note p { margin: 7px 0 0; }
.prose-card { width: min(760px, 100%); padding: 38px; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.footer-inner { min-height: 76px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.footer-links { display: flex; gap: 18px; }

@media (max-width: 760px) {
    .shell { width: min(100% - 28px, 1120px); }
    .header-inner { min-height: 68px; }
    .brand-logo { height: 36px; max-width: 100px; }
    .nav { gap: 10px; }
    .nav > a:not(.nav-cta) { display: none; }
    .hero { padding: 58px 0; }
    .hero-grid { grid-template-columns: 1fr; gap: 30px; }
    .trust-panel { padding: 26px; }
    .form-card, .prose-card { padding: 26px 22px; border-radius: 18px; }
    .page-section { padding: 36px 14px 58px; }
    .form-links, .footer-inner { flex-direction: column; align-items: flex-start; }
    .status-grid { grid-template-columns: 1fr; }
}

/* W5-B localisation foundation */
.header-actions { display: flex; align-items: center; gap: 16px; min-width: 0; }
.locale-switcher { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; margin: 0; font-size: 12px; }
.locale-option { border: 0; background: transparent; color: var(--muted); padding: 5px 2px; cursor: pointer; font: inherit; font-weight: 700; line-height: 1; letter-spacing: .04em; }
.locale-option:hover, .locale-option:focus-visible { color: var(--ink); }
.locale-option:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.locale-option.is-active { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.locale-divider { color: var(--line); }

@media (max-width: 760px) {
    .header-inner { gap: 12px; }
    .header-actions { gap: 10px; margin-left: auto; }
    .nav { gap: 8px; }
    .locale-switcher { font-size: 11px; }
}


/* W5-E.1 branded error pages */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 36px 20px; background: linear-gradient(180deg, #fbfaf6 0%, var(--paper) 100%); }
.error-shell { width: min(680px, 100%); text-align: center; }
.error-brand { display: inline-flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 34px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -.02em; }
.error-brand-logo { height: 52px; width: auto; max-width: 160px; display: block; object-fit: contain; }
.error-card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 46px 42px; }
.error-code { margin: 0 0 12px; color: var(--accent-dark); font-size: 13px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.error-title { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(36px, 7vw, 58px); line-height: 1.02; letter-spacing: -.035em; font-weight: 500; }
.error-message { max-width: 540px; margin: 22px auto 0; color: var(--muted); font-size: 17px; line-height: 1.7; }
.error-actions { margin-top: 30px; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.error-foot { margin: 24px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

@media (max-width: 760px) {
    .error-page { padding: 24px 14px; }
    .error-brand { margin-bottom: 24px; }
    .error-brand-logo { height: 44px; max-width: 130px; }
    .error-card { padding: 34px 22px; border-radius: 20px; }
    .error-message { font-size: 16px; }
    .error-actions { display: grid; }
    .error-actions .button { width: 100%; }
}

/* W5-K.1 mobile navigation */
.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;
}
.mobile-nav { display: none; position: relative; }
.mobile-nav-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    display: grid;
    place-items: center;
    cursor: pointer;
    list-style: none;
}
.mobile-nav-toggle::-webkit-details-marker { display: none; }
.mobile-nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.hamburger { width: 20px; display: grid; gap: 4px; }
.hamburger span { display: block; height: 2px; border-radius: 999px; background: var(--ink); transition: transform .15s ease, opacity .15s ease; }
.mobile-nav[open] .hamburger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.mobile-nav[open] .hamburger span:nth-child(2) { opacity: 0; }
.mobile-nav[open] .hamburger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.mobile-nav-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 30;
    width: min(290px, calc(100vw - 28px));
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 2px;
}
.mobile-nav-panel a,
.mobile-nav-link {
    width: 100%;
    min-height: 44px;
    padding: 11px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ink);
    text-decoration: none;
    text-align: left;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.mobile-nav-panel a:hover,
.mobile-nav-panel a:focus-visible,
.mobile-nav-link:hover,
.mobile-nav-link:focus-visible,
.mobile-nav-panel a[aria-current="page"] {
    background: var(--soft);
}
.mobile-nav-panel form { margin: 0; }

@media (max-width: 760px) {
    .desktop-nav { display: none; }
    .mobile-nav { display: block; }
    .header-actions { gap: 8px; }
    .brand { min-width: 0; }
    .brand span { white-space: nowrap; }
}


/* W6-A My Activity */
.activity-shell { padding-top: 16px; }
.activity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 34px; }
.activity-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); min-width: 0; }
.activity-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.activity-card h2 { margin: 3px 0 0; font-size: 22px; }
.activity-kicker { margin: 0; color: var(--accent-dark); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.activity-count { flex: 0 0 auto; min-width: 34px; height: 34px; padding: 0 9px; border-radius: 999px; background: var(--soft); display: inline-grid; place-items: center; font-weight: 800; }
.activity-empty { margin: 24px 0 0; color: var(--muted); line-height: 1.65; }
.activity-list { display: grid; gap: 12px; margin-top: 20px; }
.activity-row { padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 5px; min-width: 0; }
.activity-row strong { overflow-wrap: anywhere; }
.activity-row span { color: var(--muted); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
@media (max-width: 760px) { .activity-grid { grid-template-columns: 1fr; } .activity-card { padding: 20px; } }

/* W6-B: My Courses */
.activity-card-action { margin: 20px 0 0; }
.course-shell { max-width: 1060px; }
.course-empty-state { margin-top: 28px; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.course-empty-state h2 { margin: 0 0 8px; font-size: 22px; }
.course-empty-state p { margin: 0; color: var(--muted); line-height: 1.65; }
.course-list-grid { display: grid; gap: 16px; margin-top: 30px; }
.course-summary-card { display: flex; justify-content: space-between; gap: 24px; align-items: center; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.course-summary-main { min-width: 0; }
.course-summary-card h2 { margin: 5px 0 16px; font-size: 23px; overflow-wrap: anywhere; }
.course-summary-facts, .course-detail-facts, .course-session-card dl { display: flex; flex-wrap: wrap; gap: 14px 28px; margin: 0; }
.course-summary-facts div, .course-detail-facts div, .course-session-card dl div { display: grid; gap: 3px; }
.course-summary-facts dt, .course-detail-facts dt, .course-session-card dt { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.course-summary-facts dd, .course-detail-facts dd, .course-session-card dd { margin: 0; overflow-wrap: anywhere; }
.course-detail-link { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; padding: 10px 14px; border-radius: 10px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 800; line-height: 1.2; }
.course-detail-card, .course-schedule-panel { margin-top: 24px; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.course-detail-card h1 { margin: 5px 0 22px; overflow-wrap: anywhere; }
.course-detail-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.course-schedule-panel h2 { margin: 0 0 18px; }
.course-session-list { display: grid; gap: 14px; }
.course-session-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); min-width: 0; }
.course-session-card h3 { margin: 0 0 14px; font-size: 17px; }
@media (max-width: 760px) {
    .course-summary-card { align-items: stretch; flex-direction: column; padding: 20px; }
    .course-detail-link { align-self: flex-start; }
    .course-detail-card, .course-schedule-panel, .course-empty-state { padding: 20px; }
    .course-detail-facts { grid-template-columns: 1fr; }
    .course-summary-facts, .course-session-card dl { display: grid; grid-template-columns: 1fr; gap: 12px; }
}
