/* The page shell every headered page shares: the reset, the body, the header and nav,
   the page title and its rule, and the centred content column.

   Ported from the corrected mockup pages in plan/pages/, which are the design reference.
   Values that hold sitewide are in plan/component-library.md; the breakpoints are its
   "Layout at narrow widths". Nothing page-specific belongs in this file.

   The palette is tokens.css. The font stack below is the mockup's own: design-tokens.css
   names Komet, a commercial font whose files the project does not have, and every mockup
   page falls back to system fonts, which is what they were designed and audited against. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding: 0 60px 80px;
}

/* ---- header and nav ---- */

header.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 0 22px;
  border-bottom: 1px solid rgba(241,231,219,0.12);
  margin-bottom: 40px;
}
header.site-header .logo img {
  display: block;
  height: 26px;
  width: auto;
}
header.site-header nav {
  display: flex;
  gap: 30px;
}
header.site-header nav a {
  font-variant: small-caps;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  text-decoration: none;
}
header.site-header nav a.current { color: var(--color-text); }

header.site-header nav .nav-item { position: relative; }
header.site-header nav .nav-item .nav-chevron {
  font-size: 10px;
  margin-left: 3px;
  display: inline-block;
}

/* The dropdown sits flush against its trigger. Any gap creates a dead zone that
   closes the menu on the way down to it. */
header.site-header nav .dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0;
  background: var(--color-modal-background);
  border-radius: 3px;
  padding: 24px 0 10px;
  min-width: 150px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  z-index: 10;
}
header.site-header nav .nav-item:hover .dropdown { display: block; }
header.site-header nav .nav-item.open > .dropdown { display: block; }
header.site-header nav .dropdown a {
  display: block;
  padding: 8px 18px;
}
header.site-header nav .dropdown a:hover,
header.site-header nav .dropdown a.current {
  background: rgba(241,231,219,0.08);
  color: var(--color-text);
}

/* Admin has no dropdown, so its link is a real target rather than a hover trigger.
   The accent border marks it as Milan's rather than part of a student's own nav.
   Hiding it from a student is presentation; the admin screen itself has to refuse
   anyone who is not him. */
header.site-header nav .nav-item-admin a.admin-link {
  border: 1px solid rgba(255,128,88,0.5);
  border-radius: 2px;
  padding: 4px 12px;
}
header.site-header nav .nav-item-admin a.admin-link:hover { background: rgba(255,128,88,0.12); }

header.site-header .nav-toggle {
  display: none;
  box-sizing: border-box;
  height: 26px;
  padding: 0 9px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: 1px solid rgba(255,128,88,0.5);
  border-radius: 3px;
  cursor: pointer;
}
header.site-header .nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--color-accent);
}

/* ---- page title and rule ---- */
/* Flush left at full page width, outside the content column. */

.page-title h1 {
  font-variant: small-caps;
  font-weight: 400;
  font-size: 34px;
  margin: 0 0 14px;
}
.page-title .rule {
  height: 1px;
  background: rgba(241,231,219,0.25);
  width: 100%;
  margin-bottom: 32px;
}
.page-title p {
  max-width: 780px;
  margin: 0 auto 34px;
  text-align: center;
  font-size: 14px;
  line-height: 1.65;
  font-weight: 400;
  opacity: 0.75;
}

/* ---- the centred content column ---- */

.content-column {
  width: 75%;
  margin: 0 auto;
}

/* ---- narrow widths ----
   Two sitewide breakpoints. At 1040px the nav collapses behind a menu button; at
   880px the content column goes full width and the page padding drops. The supported
   range is 768px and up. See plan/component-library.md. */

@media (max-width: 1040px) {
  header.site-header { position: relative; }
  header.site-header .nav-toggle { display: flex; }
  header.site-header nav { display: none; }
  header.site-header.nav-open nav {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    background: var(--color-modal-background);
    border-radius: 0 0 3px 3px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    padding: 6px 0;
  }
  header.site-header.nav-open nav .nav-item { position: static; }
  header.site-header.nav-open nav .nav-item > a { display: block; padding: 12px 20px; }
  header.site-header.nav-open nav .dropdown {
    position: static;
    box-shadow: none;
    background: rgba(241,231,219,0.04);
    border-radius: 0;
    padding: 4px 0 8px;
    min-width: 0;
  }
  header.site-header.nav-open nav .dropdown a { padding: 9px 36px; }
  header.site-header.nav-open nav .nav-item:hover > .dropdown { display: none; }
  header.site-header.nav-open nav .nav-item.open > .dropdown { display: block; }
}

@media (max-width: 880px) {
  body { padding-left: 24px; padding-right: 24px; }
  .content-column { width: 100%; }
}

/* ---- the bare layout ----
   layouts.bare has no header and no page title, and its pages fill the window
   themselves: the login screen centres one card, and the test-taking interface is its
   own visual system. The headered page's side and bottom padding would only push
   them into a scroll. */

body.bare { padding: 0; }

/* ---- the log in / log out item ----
   Last in the nav, after Admin. Log out is a POST, so it is a form and its control is a
   button; it takes the same treatment as a nav link so the two states look alike. Milan's
   decision, 2026-08-21: nothing in plan/pages/ had a way in or out. */

header.site-header nav .nav-item-auth form { margin: 0; }

header.site-header nav .nav-item-auth button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-variant: small-caps;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--color-accent);
}
header.site-header nav .nav-item-auth button:hover { color: var(--color-text); }
header.site-header nav .nav-item-auth a:hover { color: var(--color-text); }

@media (max-width: 1040px) {
  header.site-header.nav-open nav .nav-item-auth button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 20px;
  }
}

/* The shell a page shows before its own stage builds it. Removed with the last
   placeholder. */
.page-placeholder { opacity: 0.7; }
.page-placeholder p { margin: 0; font-size: 14px; }
.interface-placeholder { padding: 60px; }
