/* =====================================================================
   Dr. Peter Jamieson — site.css
   Direction "A · Modernized Original" — orange identity kept & deepened,
   white surfaces, system sans, semantic content, responsive.
   ===================================================================== */

:root {
  --accent:        #c2410c;
  --accent-dark:   #9a3412;
  --accent-soft:   #fff8f3;
  --accent-border: #f0c9b3;
  --ink:           #1a1a1a;
  --text:          #2b2b2b;
  --muted:         #6b6b6b;
  --line:          #e4e4e4;
  --bg:            #ffffff;
  --max:           1040px;
  --sidebar-w:     258px;
  --radius:        6px;
  --font-sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-border); }
a:hover { color: var(--accent-dark); border-bottom-color: var(--accent); background: var(--accent-soft); }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; }
img { max-width: 100%; height: auto; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff;
  padding: 8px 14px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------------------------------------------------------------------
   MASTHEAD
   --------------------------------------------------------------------- */
.masthead { background: #fff; }
.masthead-inner {
  max-width: var(--max); margin: 0 auto; padding: 14px 24px 6px;
}
.masthead-imgwrap {
  position: relative; width: 400px; max-width: 82%; overflow: hidden;
}
.masthead-imgwrap img {
  display: block; width: 100%; height: auto;
  /* Crop the baked-in grey frame/shadow, measured pixel-exact from the 500x180
     source: 16px top, 14px bottom, 18px left, and a separate 14px on the
     right (there's a decorative vertical bar around x=488-495 sitting just
     inside the outer white margin — easy to miss by scanning in from the
     edge, since the edge itself is already white). Percentages: top/bottom
     are of the image's own height (180), left/right of its own width (500).
     Margins always resolve against the containing block's WIDTH regardless
     of axis, so top/bottom margin-% also uses /500 to pull the crop closed. */
  clip-path: inset(8.9% 2.8% 7.8% 3.6%);
  margin: -3.2% 0 -2.8% -3.6%;
}
.mario-zones { position: absolute; inset: 0; display: flex; }
.mario-zones .zone {
  flex: 1 1 12.5%; position: relative; cursor: pointer;
  display: block; border-bottom: none; text-decoration: none;
}
.mario-zones .zone:hover, .mario-zones .zone:focus-visible { border-bottom: none; background: none; }
.mario-zones .zone::after {
  content: ""; position: absolute; left: 14%; right: 14%; bottom: 5px; height: 3px;
  background: var(--accent); border-radius: 2px; opacity: 0; transform: scaleX(.3);
  transition: opacity .12s, transform .12s;
}
.mario-zones .zone.lit::after { opacity: 1; transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) { .mario-zones .zone::after { transition: none; } }

/* ---------------------------------------------------------------------
   SHELL — content + sidebar
   --------------------------------------------------------------------- */
/* Grid, not flex, so the Categories nav (.sitenav) can be an independent
   grid item from the rest of the sidebar (.sidebar = Featured + More) —
   that's what lets the mobile breakpoint move Categories up near the top
   without moving Featured/More with it. */
.shell {
  max-width: var(--max); margin: 0 auto; padding: 20px 24px 64px;
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  grid-template-areas:
    "content nav"
    "content rest";
  column-gap: 40px; row-gap: 20px;
  align-items: start;
}
.content { grid-area: content; min-width: 0; }
.sitenav { grid-area: nav; }
.sidebar { grid-area: rest; }

.content h1 { font-size: 26px; margin: 0 0 12px; }
.content h2 {
  font-size: 19px; margin: 20px 0 7px; padding-bottom: 5px;
  border-bottom: 2px solid var(--accent);
}
.content h2:first-child { margin-top: 0; }
.content h3 { font-size: 15px; margin: 14px 0 5px; color: var(--accent-dark); }
.content p { margin: 0 0 10px; }
.content ul, .content ol { margin: 0 0 10px; padding-left: 1.4em; }
.content li { margin: 3px 0; }
.content .articles { margin: 0 0 4px; }
.content .articles:last-child { margin-bottom: 0; }
.content .hatnote { font-size: 13px; color: var(--muted); font-style: italic; }

/* Marks a spot where a dead link (video removed, page gone, etc.) was
   deliberately un-linked but the surrounding text was kept. Visible on
   purpose — an audit trail, not a normal citation-style [link]/[pdf] tag. */
.dead-link-tag {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .03em;
  color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 3px;
  padding: 1px 4px; margin-left: 4px; vertical-align: 1px; white-space: nowrap;
}

/* ---------------------------------------------------------------------
   NUMBERED PUBLICATION LIST (Journal Papers / Refereed Conferences)
   --------------------------------------------------------------------- */
ul.pubs { list-style: none; padding-left: 0; margin: 0 0 14px; }
ul.pubs li {
  border-top: 1px solid var(--line);
  padding: 10px 0 12px;
}
ul.pubs li:first-child { border-top: none; }
.pubnum {
  display: inline-block; min-width: 2.4em; text-align: center;
  font-size: 11px; font-weight: 700; letter-spacing: .03em;
  color: #fff; background: var(--accent); border-radius: 3px;
  padding: 2px 5px; margin-right: 4px; vertical-align: middle;
}
.pubcite { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.pubcite .ext { color: var(--muted); border-bottom-color: transparent; }
.pubcite .ext:hover { color: var(--accent-dark); }
.bibtex-toggle {
  font: inherit; font-size: 12.5px; color: var(--muted); background: none;
  border: none; padding: 0; cursor: pointer; text-decoration: underline;
  text-decoration-color: var(--accent-border);
}
.bibtex-toggle:hover { color: var(--accent-dark); }
.bibtex-block {
  margin: 8px 0 0; padding: 10px 12px; background: #f8f9fa; border: 1px solid var(--line);
  border-radius: 4px; font-size: 12px; line-height: 1.5; white-space: pre-wrap;
  font-family: ui-monospace, Menlo, Consolas, monospace; color: #333;
}

/* Images inside legacy content: always their own line, with normal text
   (including a link right after, e.g. "[link]") flowing directly underneath
   instead of wrapping beside a tall inline image. */
.content .articles img,
.content li img,
.content .articles iframe,
.content li iframe,
.content .articles embed,
.content li embed {
  display: block;
  margin: 8px 0;
  max-width: 100%;
}
.content .articles a:has(> img),
.content li a:has(> img) {
  display: block;
  width: fit-content;
  border-bottom: none;
}

/* ---------------------------------------------------------------------
   SIDEBAR NAV
   --------------------------------------------------------------------- */
.sitenav h3, .sidebar h3 {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 8px;
}
.sitenav ul { list-style: none; margin: 0 0 20px; padding: 0; }
.sitenav li { margin: 0; }
.sitenav a {
  display: block; padding: 6px 8px; margin: 1px 0; border-radius: 4px;
  color: var(--accent-dark); border-bottom: none; font-size: 14.5px;
}
.sitenav a:hover, .sitenav a.on { background: var(--accent); color: #fff; }

.featured { margin-bottom: 22px; }
.featured .feat { display: flex; flex-direction: column; gap: 7px; }
.featured .f {
  display: block; border: 1px solid var(--accent-border); border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 4px; padding: 8px 10px;
  font-size: 13px; border-bottom: 1px solid var(--accent-border);
}
.featured .f:hover { background: #ffece0; border-bottom-color: var(--accent-border); }
.featured .f b { color: var(--accent-dark); font-weight: 600; }
.featured .f span { color: var(--muted); }
.featured .f-blog a { color: var(--accent-dark); font-weight: 600; border-bottom: none; }
.featured .f-posts { list-style: none; margin: 6px 0 0; padding: 0; }
.featured .f-posts li { margin: 2px 0; }
.featured .f-posts a { display: block; color: var(--muted); font-weight: 400; font-size: 12px; border-bottom: none; }
.featured .f-posts a:hover { color: var(--accent-dark); }

.more ul { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.more a { color: var(--muted); border-bottom: none; }
.more a:hover { color: var(--accent-dark); background: none; }

/* ---------------------------------------------------------------------
   FEATURED PROJECTS SECTION (home page)
   --------------------------------------------------------------------- */
.projects-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 14px 0 6px; }

/* .p — simple whole-card link (featured 3-up on the home page and the top of
   the Projects page). Kept anchor-based since it's a single destination. */
.projects-grid .p {
  display: block; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.projects-grid .p:hover { border-color: var(--accent); background: var(--accent-soft); }
.projects-grid .p h3 { margin: 0 0 4px; font-size: 15px; color: var(--accent-dark); }
.projects-grid .p p { margin: 0; font-size: 13px; color: var(--muted); }

/* .p-full — a div (not a link) so it can hold two separate links: the
   project itself and, where one exists, the paper behind it. */
.projects-grid .p-full {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.projects-grid .p-full:hover { border-color: var(--accent-border); }
.projects-grid .p-full h3 { margin: 0 0 4px; font-size: 15px; }
.projects-grid .p-full h3 a { color: var(--accent-dark); }
.projects-grid .p-full p { margin: 0; font-size: 13px; color: var(--muted); }
.projects-grid .p-full .p-note { display: block; margin-top: 8px; font-size: 12px; color: var(--muted); font-style: italic; }
.projects-grid .p-full .p-links { margin-top: 10px; display: flex; gap: 16px; flex-wrap: wrap; }
.projects-grid .p-full .p-paper {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--accent-dark); border-bottom: 1px solid var(--accent-border);
}

.projects-section { margin: 30px 0 4px; }

/* ---------------------------------------------------------------------
   BLOG
   --------------------------------------------------------------------- */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-row { border-top: 1px solid var(--line); padding: 14px 0; }
.post-row:first-child { border-top: none; }
.post-date { display: block; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.post-title { font-size: 18px; font-weight: 700; }
.post-row .post-excerpt { margin: 6px 0 0; color: var(--text); }
.post-meta { color: var(--muted); font-size: 13px; margin: -6px 0 18px; }

/* ---------------------------------------------------------------------
   FOOTER
   --------------------------------------------------------------------- */
.sitefoot {
  border-top: 1px solid var(--line); margin-top: 10px; padding: 18px 24px 30px;
  max-width: var(--max); margin-left: auto; margin-right: auto;
  font-size: 12.5px; color: var(--muted); text-align: center;
}
.sitefoot a { color: var(--muted); }

/* ---------------------------------------------------------------------
   RESPONSIVE
   --------------------------------------------------------------------- */
@media (max-width: 860px) {
  /* Categories moves up top (right under the masthead), ahead of the main
     content; Featured/More stay below the content, same as before. */
  .shell {
    grid-template-columns: 1fr;
    grid-template-areas: "nav" "content" "rest";
    row-gap: 24px; padding: 16px 18px 48px;
  }
  .masthead-inner { padding: 12px 18px 4px; }
  .masthead-imgwrap { width: 320px; }
  .projects-grid { grid-template-columns: 1fr; }
}
