/* ============================================================
 * EDITORIAL — the shared layer of konukcan.github.io, trimmed to
 * what the course site uses: base text, sticky masthead, the
 * .page grid with its "On this page" rail, section heads with
 * § numbers, numbered thread heads, the two-column .threads grid,
 * editorial figures, the portrait frame and the colophon.
 * Source: personal site css/editorial.css (2026-10-11). Rules the
 * course does not need (hero, publications, model cards, deep
 * dives, teaching rows, dark theme) were left out; nothing here
 * was restyled. Course-specific rules live in course.css.
 * ============================================================ */

/* Colour and typeface tokens live in site-tokens.css (linked before this file). */

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

html, body {
  margin: 0;
  background: var(--paper);
  background-image: var(--laid-lines);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color 120ms ease;
}
a:hover { border-bottom-color: var(--accent); }

em  { font-style: italic; }
strong { font-weight: 600; color: var(--ink); }

/* ============================================================
 * MASTHEAD (sticky)
 * ============================================================ */
.masthead {
  position: sticky; top: 0; z-index: 20;
  background: var(--paper);
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px max(80px, calc((100% - 1120px) / 2));   /* edges line up with the 1120px content column */
  font-family: var(--ui); font-size: 13px;
  border-bottom: 1px solid var(--ink-soft);
}
.masthead .brand {
  font-family: var(--f-brand); font-weight: 500;
  font-size: 15px; letter-spacing: 0.1px;
  color: var(--ink); border: none;
}
.masthead nav {
  display: flex; gap: 32px; align-items: center;
  color: var(--ink-soft);
}
.masthead nav a {
  color: var(--ink-soft); border: none; text-decoration: none;
  cursor: pointer; font-family: var(--f-nav); font-size: 13px;
}
.masthead nav a:hover { color: var(--accent); }
.masthead a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.masthead nav .sep { width: 1px; height: 16px; background: var(--ink-soft); }
.masthead nav a[aria-current] { color: var(--ink); box-shadow: inset 0 -1px 0 var(--accent); }

/* ============================================================
 * PAGE LAYOUT
 * ============================================================ */
.page {
  max-width: 1280px; margin: 0 auto;
  padding: 0 80px 160px;
}
.page main {
  max-width: 1120px; margin: 0 auto;
  min-width: 0;
}
@media (min-width: 1100px) { .page main { grid-column: 1; grid-row: 1; margin: 0; } }

/* ============================================================
 * ON THIS PAGE — in-page navigation (after USWDS usa-in-page-navigation)
 * Labels always visible; current section marked by a bar and aria-current.
 * ============================================================ */
.on-this-page { display: none; }
@media (min-width: 1100px) {
  .page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 200px;
    gap: 64px;
    align-items: start;
  }
  .on-this-page {
    display: block; grid-column: 2; grid-row: 1;
    position: sticky; top: 96px;
    margin-top: 24px;                /* label cap height level with the first section head */
    max-height: calc(100vh - 120px); overflow-y: auto;
  }
}
.otp-heading {
  font-family: var(--ui); font-size: 11px; font-weight: 500;
  letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--muted); margin: 0 0 12px;
}
.otp-list, .otp-sublist { list-style: none; margin: 0; padding: 0; }
.otp-list { border-left: 1px solid var(--rule); }
.otp-sublist .otp-link { padding-left: 30px; font-size: 14px; }
.otp-link {
  display: block;
  padding: 6px 0 6px 16px; margin-left: -1px;
  border-left: 3px solid transparent;
  font-family: var(--f-toc); font-size: 15px; line-height: 1.35;
  color: var(--ink-soft); text-decoration: none;
  border-bottom: 0;
}
.otp-link:hover { color: var(--accent-deep); border-left-color: var(--rule); }
.otp-link.active { color: var(--ink); font-weight: 600; border-left-color: var(--accent); }
.otp-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Text only screen readers hear */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ============================================================
 * PORTRAIT FRAME (hero)
 * ============================================================ */
.portrait-frame {
  width: 200px; height: 250px;
  border-radius: 0; overflow: hidden;
  background: transparent;
  box-shadow: var(--panel-shadow);
}
.portrait-frame img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

/* ============================================================
 * SECTION HEADS
 * ============================================================ */
.section-head {
  margin-bottom: 32px;
}
.section-head h2 {
  font-family: var(--f-h2);
  font-weight: 400;
  font-size: 36px;
  letter-spacing: -0.5px;
  margin: 0;
  color: var(--ink);
}
.section-head .num {
  font-family: var(--ui);
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 10px;
}
/* The personal site hides the § numbers (editorial.css: "hidden per user
   preference"). The course keeps them, as asked in the redesign brief;
   uncomment the next line to match the personal site exactly. */
/* .section-head .num { display: none; } .section-head { margin-bottom: 16px; } */

/* ============================================================
 * THREAD HEADS — numeral, cap rule, title (research threads, notebook sections)
 * ============================================================ */
.threads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 72px;
  align-items: start;
}
.thread {
  display: flex; flex-direction: column;
}
.thread-head {
  position: relative;
  padding-left: 56px;
  margin-bottom: 28px;
}
.thread-head .numeral {
  position: absolute; left: 0; top: 4px;
  font-family: var(--f-h2);
  font-style: normal;
  font-weight: 400;
  font-size: 44px;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -1px;
}
.thread-head .rule-and-title {
  border-top: 1px solid var(--ink-soft);
  padding-top: 14px;
}
.thread-head h3 {
  font-family: var(--f-h2);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.3px;
  color: var(--ink);
  text-wrap: balance;
}
.thread .body { flex: 1; }
.thread .body p { margin: 0 0 20px; }
.thread .body p {
  font-family: var(--f-body);
  letter-spacing: var(--body-tracking);
}

/* ============================================================
 * EDITORIAL FIGURE (plate with cap rule above the caption)
 * ============================================================ */
.ed-figure {
  margin: 32px 0 0;
  padding: 0;
}
.ed-figure .plate {
  background: transparent;
  border: 1px solid var(--rule-light);
  border-radius: 0;
  box-shadow: var(--panel-shadow);
  display: flex; align-items: center; justify-content: center;
  padding: 12px; overflow: hidden;
}
.ed-figure .plate img, .ed-figure .plate svg {
  max-width: 100%; max-height: 100%;
  display: block;
}
.ed-figure figcaption {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--ink-soft);
  font-family: var(--ui);
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.ed-figure figcaption .tag {
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-size: 10.5px;
  color: var(--accent);
  margin-right: 8px;
}

/* ============================================================
 * COLOPHON
 * ============================================================ */
.colophon {
  margin-top: 100px;
  padding-top: 20px;
  border-top: 1px solid var(--ink-soft);
  font-family: var(--f-footer);
  font-size: 12px;
  color: var(--muted-light);
  display: flex;
  justify-content: space-between;
}

/* ============================================================
 * RESPONSIVE
 * ============================================================ */
@media (max-width: 900px) {
  .masthead { padding: 16px 24px; }
  .masthead { flex-wrap: wrap; row-gap: 8px; }
  .masthead nav { gap: 6px 18px; font-size: 12px; flex-wrap: wrap; }
  .masthead nav .sep { display: none; }
  .portrait-frame { width: 160px; height: 200px; }
  .page { padding: 0 24px 80px; }
  .threads { grid-template-columns: 1fr; gap: 56px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
