/* CSE 340 site styles. No framework; self-hosted fonts; works without JavaScript. */

@font-face {
    font-family: "Bricolage Grotesque";
    src: url("fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
    font-weight: 200 800;
    font-display: swap;
}
@font-face {
    font-family: "Figtree";
    src: url("fonts/figtree-latin-wght-normal.woff2") format("woff2");
    font-weight: 300 900;
    font-display: swap;
}

:root {
    --purple: #4b2e83;
    --purple-deep: #2b1659;
    --purple-tint: #efeaf8;
    --gold: #b7a57a;
    --gold-bright: #e8c872;
    --ink: #1c1a26;
    --muted: #5d5a6b;
    --line: #dcd8e6;
    --paper: #f8f7fc;
    --white: #fff;
    --link: #4b2e83;
    --measure: 72ch;
    --wide: 1080px;
    --display: "Bricolage Grotesque", system-ui, sans-serif;
    --text: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
    margin: 0;
    font: 17px/1.6 var(--text);
    color: var(--ink);
    background: var(--paper);
}

img { max-width: 100%; vertical-align: middle; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
    position: absolute; left: -999px; top: 0; z-index: 20;
    background: var(--white); color: var(--ink); padding: 10px 14px;
}
.skip-link:focus { left: 0; }

a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--purple-deep); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 3px solid var(--gold-bright); outline-offset: 2px;
}

/* Header */
.site-header {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 28px;
    padding: 12px max(20px, calc((100% - var(--wide)) / 2));
    background: var(--white);
    border-bottom: 1px solid var(--line);
}
.brand {
    font: 700 1.25rem/1.1 var(--display); letter-spacing: -0.01em;
    color: var(--purple); text-decoration: none;
}
.brand:hover { color: var(--purple-deep); }
.site-header nav { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; }
.site-header ul {
    display: flex; flex-wrap: wrap; gap: 2px 4px;
    list-style: none; margin: 0; padding: 0;
}
.nav-external { margin-left: auto; padding-left: 16px; border-left: 1px solid var(--line); }
.nav-external a::after { content: "\2197"; font-size: 0.8em; margin-left: 4px; color: var(--muted); }
.site-header nav a {
    display: block; padding: 6px 10px; border-radius: 6px;
    color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.95rem;
}
.site-header nav a:hover { background: var(--purple-tint); color: var(--purple-deep); }
.site-header nav a[aria-current="page"] {
    background: var(--purple-tint); color: var(--purple-deep); font-weight: 700;
    box-shadow: inset 0 -2px 0 var(--gold);
}
.quarter {
    font-weight: 700; font-size: 0.85rem; color: var(--purple-deep);
    background: var(--gold-bright); padding: 3px 10px; border-radius: 99px;
}

/* Page banner: the one loud element */
.page-head {
    position: relative; overflow: hidden;
    background: var(--purple-deep) linear-gradient(115deg, var(--purple-deep) 40%, var(--purple) 140%);
    color: var(--white);
    padding: 44px 0 48px;
    border-bottom: 5px solid var(--gold);
}
.page-head .wrap {
    position: relative; z-index: 1;
    max-width: var(--wide); margin: 0 auto; padding: 0 20px;
}
.page-head h1 {
    margin: 0; max-width: 18ch; color: var(--white);
    font: 800 clamp(2.1rem, 6vw, 3.9rem)/1.02 var(--display);
    letter-spacing: -0.03em;
}
.page-head .lead {
    margin: 16px 0 0; max-width: 56ch;
    font-size: 1.2rem; line-height: 1.5; color: #e2daf3;
}
/* nested outlines, like a Flutter widget tree */
.page-head::before, .page-head::after {
    content: ""; position: absolute; pointer-events: none;
    border: 2px solid rgba(232, 200, 114, 0.35); border-radius: 18px;
}
.page-head::before {
    width: 300px; height: 300px; right: max(-60px, calc(50% - 560px)); top: -90px;
    transform: rotate(8deg);
    box-shadow: -34px 34px 0 -2px var(--purple-deep), -34px 34px 0 0 rgba(232, 200, 114, 0.28),
                -68px 68px 0 -2px var(--purple-deep), -68px 68px 0 0 rgba(232, 200, 114, 0.2);
}
.page-head::after { display: none; }

/* Content */
main { max-width: var(--wide); margin: 0 auto; padding: 36px 20px 24px; }
main > p, main > ul, main > ol, main > .callout, main > .last-updated { max-width: var(--measure); }

h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; letter-spacing: -0.015em; color: var(--purple-deep); }
h2 { font-size: 1.75rem; font-weight: 700; margin: 48px 0 14px; }
h3 { font-size: 1.3rem; font-weight: 700; margin: 30px 0 10px; }
h4 { font-size: 1.1rem; margin: 22px 0 8px; }
main > :first-child { margin-top: 0; }
p, ul, ol, table { margin: 0 0 16px; }
ul, ol { padding-left: 26px; }
li { margin-bottom: 3px; }
li > ul, li > ol { margin: 4px 0 0; }
li::marker { color: var(--gold); }

.last-updated { color: var(--muted); font-size: 0.9rem; }
.intro { font-size: 1.1rem; margin-top: 28px; }

/* Link cards: flat, left-ruled, not a shadowed grid of identical tiles */
.card-grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    margin: 0 0 20px;
}
.card {
    background: var(--white);
    border: 1px solid var(--line); border-left: 5px solid var(--purple);
    border-radius: 4px 12px 12px 4px;
    padding: 14px 18px;
}
.link-card {
    display: block; text-decoration: none; color: var(--ink);
    transition: background-color 0.15s, border-color 0.15s;
}
.link-card strong {
    display: block; font: 700 1.1rem/1.25 var(--display); color: var(--purple-deep);
}
.link-card span { display: block; margin-top: 4px; font-size: 0.93rem; color: var(--muted); line-height: 1.4; }
.link-card:hover { background: var(--purple-tint); border-left-color: var(--gold); color: var(--ink); }
.link-card:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.card-grid > .link-card:nth-child(n+5) { border-left-color: var(--gold); }
.card-grid > .link-card:nth-child(n+5):hover { border-left-color: var(--purple); }

/* Staff */
.staff-card { margin-bottom: 14px; max-width: var(--measure); }
.card-grid .staff-card { margin-bottom: 0; }
.staff-card p { margin: 0; }
.staff-card strong { font-family: var(--display); font-size: 1.1rem; }
.staff-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-bottom: 14px; }
.staff-list .staff-card { max-width: none; margin: 0; display: flex; gap: 14px; align-items: flex-start; }
.staff-list .staff-card img { width: 84px; height: 84px; object-fit: cover; border-radius: 50%; flex: none; }
.staff-lead { grid-template-columns: 1fr; }
.staff-lead .staff-card img { width: 110px; height: 110px; }
.staff-text p { margin: 0 0 4px; }

/* Deadlines */
.deadlines { list-style: none; padding: 0; margin: 0 0 14px; max-width: var(--measure); }
.deadlines li {
    margin: 0; padding: 10px 14px; background: var(--white);
    border: 1px solid var(--line); border-top-width: 0;
}
.deadlines li:first-child { border-top-width: 1px; border-radius: 10px 10px 0 0; }
.deadlines li:last-child { border-radius: 0 0 10px 10px; }
.deadlines li:only-child { border-radius: 10px; }

/* Tables */
.table-plain {
    border-collapse: separate; border-spacing: 0; background: var(--white);
    border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
    max-width: 100%;
}
.table-plain th, .table-plain td {
    padding: 9px 16px; text-align: left; vertical-align: top;
    border-bottom: 1px solid var(--line);
}
.table-plain tr:last-child td { border-bottom: 0; }
.table-plain th { background: var(--purple-tint); color: var(--purple-deep); font-weight: 700; }
.table-plain td + td, .table-plain th + th { border-left: 1px solid var(--line); }

@media (max-width: 640px) {
    .table-plain { display: block; overflow-x: auto; }
}

/* Callouts and TOC */
.callout {
    background: var(--purple-tint);
    border-left: 5px solid var(--gold);
    border-radius: 4px 12px 12px 4px;
    padding: 14px 20px 2px; margin-bottom: 26px;
}
.callout p { margin-bottom: 12px; }

.policy-toc {
    background: var(--white); border: 1px solid var(--line); border-radius: 12px;
    padding: 14px 22px 6px; margin-bottom: 30px; max-width: var(--measure);
}
.policy-toc p { font: 700 1.05rem var(--display); color: var(--purple-deep); margin-bottom: 6px; }
.policy-toc ul { margin: 0 0 10px; padding-left: 20px; columns: 2; column-gap: 28px; }
.policy-toc li { break-inside: avoid; }

/* Schedule: a timeline. Weeks are a real sequence. */
.weeks { position: relative; margin: 8px 0 0; padding-left: 28px; max-width: 860px; }
.weeks::before {
    content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 3px;
    background: linear-gradient(var(--purple), var(--gold)); border-radius: 3px;
}
.week {
    position: relative; background: var(--white);
    border: 1px solid var(--line); border-radius: 12px;
    padding: 16px 22px 4px; margin-bottom: 18px;
}
.week::before {
    content: ""; position: absolute; left: -28px; top: 22px;
    width: 17px; height: 17px; border-radius: 50%;
    background: var(--white); border: 4px solid var(--purple);
}
.week h3 { margin: 0 0 8px; font-size: 1.25rem; }
.week h3 small { font: 500 0.95rem var(--text); color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.week p { margin-bottom: 4px; }
.week ul { margin-bottom: 12px; }
@media (min-width: 760px) {
    .week { display: grid; grid-template-columns: 11rem 1fr; column-gap: 24px; }
    .week h3 { grid-row: span 6; }
    .week > :not(h3) { grid-column: 2; }
    .week h3 small { display: block; margin: 2px 0 0; }
}

/* Footer */
.site-footer {
    margin-top: 48px; padding: 28px max(20px, calc((100% - var(--wide)) / 2)) 48px;
    background: var(--white); border-top: 1px solid var(--line);
    font-size: 0.93rem; color: var(--muted);
}
.site-footer img { width: 250px; }
.site-footer p { margin: 8px 0 0; }

/* Calendar */
#calendar { margin: 18px 0; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
#calendar-status { font-style: italic; color: var(--muted); }
.cal-legend { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 8px 10px; }
.cal-legend li { margin: 0; }
.cal-legend label {
    cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 12px 4px 9px; border: 1px solid var(--line); border-radius: 99px;
    background: var(--white); font-size: 0.92rem;
}
.cal-legend label:has(input:focus-visible) { outline: 3px solid var(--gold-bright); outline-offset: 2px; }
.cal-legend input { accent-color: var(--purple); margin: 0; }
.cal-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--cat-color); }

/* Event categories. Keep in sync with CATEGORIES in assets/js/calendar.js */
.cat-lecture   { --cat-color: #4b2e83; }
.cat-section   { --cat-color: #1c67ca; }
.cat-oh        { --cat-color: #2e7d32; }
.cat-interview { --cat-color: #00838f; }
.cat-hw        { --cat-color: #c62828; }
.cat-audit     { --cat-color: #b65500; }
.cat-project   { --cat-color: #ad1457; }
.cat-other     { --cat-color: #616161; }

.fc { --fc-border-color: var(--line); --fc-today-bg-color: #fbf5e0; --fc-button-bg-color: var(--purple);
      --fc-button-border-color: var(--purple); --fc-button-hover-bg-color: var(--purple-deep);
      --fc-button-hover-border-color: var(--purple-deep); --fc-button-active-bg-color: var(--purple-deep);
      --fc-button-active-border-color: var(--purple-deep); font-size: 0.93rem; }
.fc .fc-toolbar-title { font: 700 1.5rem var(--display); color: var(--purple-deep); }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number, .fc a { color: var(--ink); text-decoration: none; }
.fc .fc-col-header-cell { background: var(--purple-tint); }
.fc .fc-button:focus-visible { box-shadow: none; outline: 3px solid var(--gold-bright); outline-offset: 2px; }
.fc .fc-event[class*="cat-"], .fc .fc-event[class*="cat-"] .fc-event-main {
    background-color: var(--cat-color); border-color: var(--cat-color); color: #fff;
}
.fc .fc-event[class*="cat-"] a, .fc .fc-event[class*="cat-"] .fc-event-title { color: #fff; }
.fc .fc-list-event[class*="cat-"] td { background-color: transparent; color: inherit; }
.fc .fc-list-event[class*="cat-"] .fc-list-event-dot { border-color: var(--cat-color); }

#calendar.hide-lecture .evt-lecture, #calendar.hide-section .evt-section, #calendar.hide-oh .evt-oh,
#calendar.hide-interview .evt-interview, #calendar.hide-hw .evt-hw, #calendar.hide-audit .evt-audit,
#calendar.hide-project .evt-project, #calendar.hide-other .evt-other { display: none; }

/* Small screens */
@media (max-width: 767px) {
    body { font-size: 16px; }
    .site-header { gap: 8px; padding-top: 10px; padding-bottom: 8px; }
    .site-header nav { flex-basis: 100%; order: 3; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
    .site-header ul { flex-wrap: nowrap; }
    .nav-external { margin-left: 8px; padding-left: 8px; }
    .site-header nav a { white-space: nowrap; }
    .quarter { margin-left: auto; }
    .page-head { padding: 34px 0 38px; }
    .page-head::before { opacity: 0.5; right: -170px; }
    main { padding-top: 26px; }
    h2 { font-size: 1.5rem; margin-top: 38px; }
    .policy-toc ul { columns: 1; }
    #calendar { padding: 8px; }
    .fc .fc-toolbar { flex-direction: column; gap: 8px; }
}

.resource-list { max-width: var(--measure); }
.resource-list li { margin-bottom: 6px; }
.doc-live img { max-width: 100%; height: auto; }
.doc-live > h2:first-child { margin-top: 0; }

.table-plain td p, .table-plain th p { margin: 0; }
.policy-toc ul ul { display: none; }
.policy-toc ul { columns: 3 14rem; }

/* Assignments */
.assignment-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; max-width: var(--measure); }
.assignment-link {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px;
    padding: 14px 18px; text-decoration: none; color: var(--ink);
    background: var(--white); border: 1px solid var(--line); border-left: 5px solid var(--purple);
    border-radius: 4px 12px 12px 4px; transition: background-color 0.15s, border-color 0.15s;
}
.assignment-link:hover { background: var(--purple-tint); border-left-color: var(--gold); color: var(--ink); }
.assignment-title { font: 700 1.2rem/1.25 var(--display); color: var(--purple-deep); }
.assignment-link:hover .assignment-title { text-decoration: underline; text-underline-offset: 3px; }
.assignment-due { color: var(--muted); font-size: 0.95rem; }
.assignment-due.past { font-style: italic; }
.assignment-list + h2 { margin-top: 36px; }
#assignments > h2:first-child { margin-top: 0; }
