/* ==========================================================================
   lwagman.org — paper-white editorial theme
   The hero is the one saturated moment; everything after it reads like a
   finely typeset economics manuscript: white paper, black ink, steel blue
   reserved for accents (kickers, links, year folios).
   Type: Source Serif 4 (display, venue italics) + Inter (text), self-hosted.
   ========================================================================== */

@import url('../fonts/fonts.css');

:root {
  --accent: #34618e;         /* steel blue — the accent ink */
  --accent-deep: #29527a;    /* link ink */
  --ink: #14181c;
  --body-c: #333a41;
  --muted: #68707a;
  --faint: #9aa1a9;
  --paper: #ffffff;
  --hairline: #e7e7e4;
  --hairline-dark: #d5d5d1;
  --gold: #8a6d1f;
  --wash: #fafaf8;           /* barely-there section wash */
  --blue: #34618e;           /* steel blue — the drawing ink */
  --blue-soft: #7ba3c4;
  --ice: #eef4f9;            /* light blue wash */
  --ice-border: #d9e6f0;
  --serif: 'Source Serif 4', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --col: 780px;
  --wide: 1060px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--body-c);
  background: transparent; /* html carries the paper; lets .bg-3d sit behind */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  /* sticky footer: the page always fills the window, footer flush at the bottom */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-deep); text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--serif); color: var(--ink); line-height: 1.2; margin: 0 0 .5em; font-weight: 700; }
.container { max-width: var(--wide); margin: 0 auto; padding: 0 24px; }
.col { max-width: var(--col); margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: 10px 18px;
}
.skip-link:focus { left: 0; color: #fff; }

/* owner-authored inline sizing (nestable: <big><big> compounds) */
big { font-size: 1.28em; line-height: 1.25; }
small { font-size: .8em; }

.kicker {
  font-size: .74rem; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 1em;
}

/* ------------------------------------------------------------- header --- */

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.nav { display: flex; align-items: center; justify-content: center; min-height: 54px; }
.nav-menu { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 6px; list-style: none; margin: 0; padding: 8px 0; }
.nav-menu a {
  display: block; padding: 6px 13px;
  font-size: .9rem; font-weight: 500; color: var(--body-c); position: relative;
}
.nav-menu a::after {
  content: ''; position: absolute; left: 13px; right: 13px; bottom: 0; height: 2px;
  background: var(--blue-soft);
  transform: scaleX(0); transform-origin: left; transition: transform .2s ease;
}
.nav-menu a.active::after { background: var(--accent); }
.nav-menu a:hover { color: var(--ink); }
.nav-menu a:hover::after, .nav-menu a.active::after { transform: scaleX(1); }
.nav-menu a.active { color: var(--ink); font-weight: 600; }

@media (max-width: 480px) {
  .nav-menu { gap: 0; }
  .nav-menu a { padding: 6px 9px; font-size: .85rem; }
  .nav-menu a::after { left: 9px; right: 9px; }
}

/* --------------------------------------------------------------- hero --- */
/* Kept from the first pass — the one saturated moment on the site. */

.hero { position: relative; color: #fff; overflow: hidden; background: #46688d; }
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center 30%;
  filter: saturate(.82) contrast(1.02) brightness(1.07);
  opacity: .6;
}
/* Keep the "Pittsburgh Building" inscription visible below the portrait:
   the cover-crop shifts with viewport width, so the framing adapts. */
@media (min-width: 861px) and (max-width: 1280px) { .hero-bg { background-position: center 27%; } }
@media (min-width: 1281px) and (max-width: 1600px) { .hero-bg { background-position: center 34%; } }
@media (min-width: 1601px) { .hero-bg { background-position: center 40%; } }
@media (min-width: 2001px) { .hero-bg { background-position: center 45%; } }
.hero-tint {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(26, 48, 72, .28) 0%, transparent 26%, transparent 72%, rgba(26, 48, 72, .36) 100%),
    linear-gradient(100deg, rgba(24, 46, 70, .86) 0%, rgba(31, 59, 88, .56) 38%, rgba(52, 97, 142, .18) 68%, rgba(90, 130, 168, .12) 100%);
}
.hero-inner { position: relative; z-index: 2; padding-top: 72px; padding-bottom: 72px; }
.hero .kicker { color: #eddcc9; }
.hero h1 {
  color: #fff; font-size: clamp(2.5rem, 6vw, 4.1rem); letter-spacing: -.015em;
  margin: .1em 0 .15em; text-wrap: balance;
}
.hero .hero-role {
  font-family: var(--serif); font-style: normal;
  font-size: clamp(1.1rem, 2.2vw, 1.4rem); color: #f4ede5; max-width: 40ch; line-height: 1.45;
  text-shadow: 0 1px 12px rgba(15, 9, 11, .45);
}
.hero-role--s { font-size: clamp(.95rem, 1.9vw, 1.15rem) !important; }
.hero-role--l { font-size: clamp(1.3rem, 2.8vw, 1.75rem) !important; }
.hero-role--sans { font-family: var(--sans) !important; letter-spacing: .01em; }
.hero h1 { text-shadow: 0 2px 18px rgba(15, 9, 11, .5); }
.hero-rule { width: 64px; height: 3px; background: var(--accent); border: 0; margin: 26px 0 0; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .8fr); gap: 48px; align-items: center; }
.hero-portrait { position: relative; justify-self: end; width: min(280px, 68vw); }
.hero-portrait img {
  border-radius: 10px; box-shadow: 0 22px 54px rgba(0, 0, 0, .45);
  outline: 1px solid rgba(255, 255, 255, .25); outline-offset: -1px;
}
.hero-portrait::before {
  content: ''; position: absolute; inset: -13px 13px 13px -13px;
  border: 1px solid rgba(255, 255, 255, .30); border-radius: 12px; pointer-events: none;
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .hero-portrait { justify-self: start; }
  .hero-inner { padding-top: 64px; padding-bottom: 72px; }
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 7px; font-weight: 600; font-size: .93rem;
  border: 1px solid transparent; cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2a5580; color: #fff; }
.btn-outline { border-color: var(--hairline-dark); color: var(--ink); background: #fff; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-deep); }

/* ------------------------------------------------------------ sections --- */

.section { padding: 76px 0; }
.section + .section { padding-top: 0; }
.page-head { padding: 60px 0 0; position: relative; }
.page-head h1 { margin-bottom: .25em; }
/* indifference curves (xy = k) — a watermark only an economist would name */
.page-head::before, .paper-head::before {
  content: ''; position: absolute; top: 30px; right: -160px; width: 300px; height: 300px;
  background: url(../img/contours.svg) no-repeat center / contain;
  opacity: .13; pointer-events: none; z-index: -1;
}
@media (max-width: 1140px) { .page-head::before, .paper-head::before { display: none; } }
/* full-page blueprint drawing behind the content (research + policy) */
.page-head.has-3d::before { display: none; }
.bg-3d {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  z-index: -1; pointer-events: none;
  /* keep the reading column clean; let the drawing live toward the edges */
  -webkit-mask-image: radial-gradient(ellipse 62% 60% at 50% 34%, transparent 32%, rgba(0,0,0,.5) 62%, #000 88%);
  mask-image: radial-gradient(ellipse 62% 60% at 50% 34%, transparent 32%, rgba(0,0,0,.5) 62%, #000 88%);
}
@media (max-width: 760px) { .bg-3d { display: none; } }
/* CV page: contours live low over the valley; only fade the title zone */
.cv-page .bg-3d {
  -webkit-mask-image: linear-gradient(180deg, transparent 4%, rgba(0,0,0,.55) 34%, #000 60%);
  mask-image: linear-gradient(180deg, transparent 4%, rgba(0,0,0,.55) 34%, #000 60%);
}
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -.01em; }
.page-head .lede { font-size: 1.08rem; color: var(--muted); max-width: 60ch; margin: 0; }
.section-title { font-size: 1.35rem; margin: 0 0 .4em; }

/* home: about + facts */
.bio p { margin: 0 0 1.25em; }
.bio p:last-child { margin-bottom: 0; }
::selection { background: var(--accent); color: #fff; }
.facts {
  display: grid; grid-template-columns: max-content max-content;
  justify-content: space-between; gap: 48px;
  border-top: 1px solid var(--hairline); margin-top: 44px; padding-top: 40px;
}
@media (max-width: 640px) { .facts { grid-template-columns: 1fr; } }
.facts h2 { font-size: 1.05rem; margin-bottom: 14px; }
.fact-lines { margin: 0; font-size: .97rem; line-height: 1.85; }
.fact-lines span { display: block; }
.fact-lines .quiet { color: var(--muted); }
.plain-list {
  margin: 0; padding: 0; list-style: none; font-size: .95rem; line-height: 1.8;
  display: grid; grid-template-columns: repeat(2, max-content); gap: 2px 28px;
}
.plain-list li { white-space: nowrap; }
.plain-list li::before { content: '—'; color: var(--accent); margin-right: 9px; }
@media (max-width: 900px) { .plain-list { grid-template-columns: 1fr; } }
.profile-links { margin-top: 18px; font-size: .92rem; }
.profile-links a { font-weight: 500; margin-right: 16px; }
@media (max-width: 640px) { .facts { grid-template-columns: 1fr; gap: 28px; } }

.news-strip { background: var(--ice); border: 1px solid var(--ice-border); border-left: 3px solid var(--blue); border-radius: 6px; padding: 16px 22px; margin: 0 0 44px; }
.news-strip .kicker { margin-bottom: 6px; }
.news-strip ul { margin: 0; padding-left: 18px; }
.news-strip li { margin: 4px 0; font-size: .97rem; }

/* ------------------------------------------------- publications list  --- */
/* Set like a reference list: hanging structure, hairline separations,
   year folios in the left margin on wide screens. */

.pub-groups { margin-top: 24px; }
.year-group { position: relative; }
.year-label {
  font-family: var(--serif); font-weight: 600; font-size: 1rem; color: var(--accent);
  padding: 26px 0 0; line-height: 1;
}
.year-label-text {
  font-family: var(--sans); font-size: .7rem; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase; line-height: 1.5;
}
.pub { border-top: 1px solid var(--hairline); padding: 24px 0; }
.year-group .pub:first-of-type { border-top: none; }
.year-group + .year-group .year-label { border-top: 1px solid var(--hairline-dark); }
.pub-title { font-size: 1.12rem; font-weight: 600; line-height: 1.4; margin: 0 0 4px; }
.pub-title a { color: var(--ink); text-decoration: none; }
.pub-title a:hover { color: var(--accent-deep); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.pub-meta { margin: 0; font-size: .95rem; color: var(--muted); line-height: 1.6; }
.pub-meta .venue { font-family: var(--serif); font-style: italic; font-size: 1.04em; color: var(--body-c); }
.pub-meta .dot { margin: 0 4px; color: var(--faint); }
.pub-award { margin: 6px 0 0; font-size: .86rem; color: var(--gold); font-weight: 500; }
.pub-award .sep { margin: 0 8px; color: var(--hairline-dark); }
.pub-links { margin: 8px 0 0; font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.pub-links a { color: var(--accent-deep); }
.pub-links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pub-links .sep { color: var(--hairline-dark); margin: 0 9px; font-weight: 400; }

@media (min-width: 1080px) {
  .year-label {
    position: absolute; left: -112px; top: 0; width: 84px; text-align: right;
    padding: 26px 0 0; font-size: 1.05rem;
  }
  .year-label-text { font-size: .68rem; padding-top: 31px; }
  .year-group + .year-group .year-label { border-top: none; }
  .year-group + .year-group { border-top: 1px solid var(--hairline-dark); }
  .year-group .pub:first-of-type { padding-top: 26px; }
}

/* filter bar — quiet */
.filterbar { margin: 14px 0 8px; }
.filterbar .search {
  width: 100%; max-width: 400px; padding: 9px 2px; font: inherit; font-size: .97rem;
  border: 0; border-bottom: 1px solid var(--hairline-dark); background: transparent; color: var(--ink);
}
.filterbar .search::placeholder { color: var(--faint); }
.filterbar .search:focus { outline: none; border-bottom-color: var(--blue); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 2px 18px; margin-top: 16px; }
.fchip {
  font-size: .82rem; font-weight: 500; padding: 4px 0; border: 0; background: none;
  color: var(--muted); cursor: pointer; font-family: var(--sans); position: relative;
}
.fchip:hover { color: var(--blue); box-shadow: inset 0 -2px 0 var(--blue-soft); }
.fchip.active { color: var(--accent-deep); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
/* the Working Papers chip stands out in the award gold */
.fchip[data-topic="type:working"] { color: var(--gold); font-weight: 600; }
.fchip[data-topic="type:working"]:hover { box-shadow: inset 0 -2px 0 rgba(138, 109, 31, .35); color: var(--gold); }
.fchip[data-topic="type:working"].active { color: var(--gold); box-shadow: inset 0 -2px 0 var(--gold); }
.filter-empty { display: none; padding: 40px 0; color: var(--muted); font-style: italic; border-top: 1px solid var(--hairline); margin-top: 26px; }
/* Select media coverage (Policy & Impact) */
.media-group { margin-top: 26px; }
.media-group-title { font-family: var(--sans); font-size: .76rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.media-list { list-style: none; margin: 0; padding: 0; }
.media-list li { padding: 8px 0; border-bottom: 1px solid var(--hairline); font-size: .94rem; line-height: 1.5; }
.media-list a { text-decoration: none; color: var(--accent-deep); }
.media-list a:hover { color: var(--accent); }
.media-note { color: var(--muted); }
.no-js .filterbar { display: none; }

.pub-section .section-title { margin-top: 64px; }
.pub-section .pub-note { color: var(--muted); font-size: .97rem; margin: 0 0 26px; }

/* --------------------------------------------------------- paper page --- */

.paper-head { padding: 56px 0 0; position: relative; }
.breadcrumb { font-size: .84rem; color: var(--faint); margin: 0 0 26px; }
.breadcrumb a { color: var(--faint); }
.breadcrumb a:hover { color: var(--accent-deep); }
.paper-head h1 { font-size: clamp(1.6rem, 3.6vw, 2.25rem); letter-spacing: -.01em; text-wrap: balance; }
.paper-head .authors { font-size: 1.02rem; color: var(--body-c); margin: 12px 0 4px; }
.paper-head .cite { font-size: .98rem; color: var(--muted); margin: 0; }
.paper-head .cite .venue { font-family: var(--serif); font-style: italic; color: var(--body-c); font-size: 1.04em; }
.paper-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 0; }
.paper-body { padding: 44px 0 84px; }
.paper-body h2 { font-size: 1.25rem; margin: 1.9em 0 .5em; }
.paper-body h2:first-child { margin-top: 0; }
.abstract { font-size: 1.03rem; line-height: 1.8; }
.topic-line { font-size: .84rem; color: var(--muted); margin-top: 22px; }
.bibtex {
  background: var(--ice); border: 1px solid var(--ice-border); color: var(--ink); border-radius: 6px;
  padding: 18px 20px; overflow-x: auto; font-size: .84rem; line-height: 1.6;
  font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
}
details.bibtex-wrap { margin-top: 40px; }
details.bibtex-wrap summary { cursor: pointer; font-weight: 600; color: var(--accent-deep); margin-bottom: 12px; }
.copy-btn {
  margin-top: 10px; font-size: .82rem; padding: 6px 14px; border-radius: 6px;
  border: 1px solid var(--hairline-dark); background: #fff; cursor: pointer; font-family: var(--sans); font-weight: 600;
  color: var(--body-c);
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent-deep); }
.related { border-top: 1px solid var(--hairline-dark); margin-top: 56px; padding-top: 8px; }
.related .kicker { margin: 24px 0 0; }

/* -------------------------------------------------------------- policy --- */

.feature-row { border-top: 1px solid var(--hairline); padding: 34px 0; }
.feature-row:first-of-type { border-top: none; padding-top: 8px; }
.feature-org { font-family: var(--serif); font-weight: 700; font-size: 1.25rem; color: var(--ink); margin: 0 0 4px; }
.feature-role { font-size: .76rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
.feature-text { margin: 0 0 12px; }
.feature-link { font-size: .9rem; font-weight: 600; }

/* ------------------------------------------------------------ cv page --- */

.cv-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 28px 0 8px; position: relative; }
.cv-updated { font-size: .88rem; color: var(--muted); }
/* wide breakout so the PDF renders large enough to read comfortably */
.cv-embed { width: min(1140px, calc(100vw - 48px)); margin: 44px auto 0; }
.cv-frame {
  width: 100%; height: min(90vh, 1250px); border: 1px solid var(--hairline);
  border-radius: 8px; background: #fff; box-shadow: var(--shadow-sm); display: block;
}
@media (max-width: 760px) { .cv-embed { display: none; } } /* phones: buttons open it full-screen */
/* the Troy valley rises softly through the lower half of the CV page */
.cv-page { position: relative; min-height: 66vh; padding-bottom: 120px; }
.cv-page::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url(../img/valley-troy.jpg) center 75% / cover no-repeat;
  opacity: .16; filter: grayscale(.2) sepia(.32) hue-rotate(158deg) saturate(.85) brightness(1.04);
  -webkit-mask-image: linear-gradient(180deg, transparent 6%, #000 62%);
  mask-image: linear-gradient(180deg, transparent 6%, #000 62%);
}
.cv-page + .site-footer { margin-top: 0; }
.cv-page + .site-footer::before { display: none; }

/* -------------------------------------------------------------- footer --- */

/* the Troy valley, washed nearly to paper — cyanotype-toned, like an old
   architectural print (the blue weave's anchor) */
.site-footer { position: relative; overflow: hidden; border-top: 1px solid var(--hairline); margin-top: 84px; }
.site-footer::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: url(../img/valley-troy.jpg) center 30% / cover no-repeat;
  opacity: .15; filter: grayscale(.2) sepia(.32) hue-rotate(158deg) saturate(.85) brightness(1.04);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 70%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 70%);
}
.footer-inner { position: relative; }
.footer-inner { padding: 34px 24px 40px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; font-size: .88rem; }
.footer-nav a { color: var(--muted); }
.footer-nav a:hover { color: var(--accent-deep); }
.footer-note-line { font-size: .8rem; color: var(--faint); margin: 0; max-width: 72ch; }

/* -------------------------------------------------------------- misc  --- */

/* compact homepage — fits a laptop screen without scrolling when About is empty */
body.home main { display: flex; flex-direction: column; }
body.home main > .hero { flex: 0 0 auto; }
body.home main > .section { flex: 1; display: flex; align-items: center; position: relative; }
body.home main > .section > .col { width: 100%; }
#home-ribbons {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, transparent 2%, #000 22%, #000 92%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 2%, #000 22%, #000 92%, transparent 100%);
}
@media (max-width: 760px) { #home-ribbons { display: none; } }
body.home .section { padding: 56px 0 60px; }
body.home .facts { margin-top: 54px; padding-top: 26px; }
body.home .facts h2 { margin-bottom: 8px; }
body.home .fact-lines, body.home .plain-list { line-height: 1.62; }
body.home .site-footer { margin-top: 0; }
body.home .footer-inner { padding-top: 22px; padding-bottom: 24px; gap: 8px; }

.reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

.err-page { text-align: center; padding: 110px 24px; }
.err-page h1 { font-size: 4.5rem; color: var(--accent); margin-bottom: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media print {
  .site-header, .site-footer, .filterbar, .hero-actions, .pub-links, .nav-toggle, .paper-actions { display: none !important; }
  body { background: #fff; font-size: 10.5pt; }
  .pub { page-break-inside: avoid; }
  .hero { background: none; color: #000; }
  .hero-bg, .hero-tint { display: none; }
  .hero h1, .hero .hero-role { color: #000; }
  .year-label { position: static; text-align: left; }
  a { color: #000; }
}
