/* ==========================================================================
   Personal site, shared stylesheet
   Light theme. Warm paper ground, deep copper accent, card grids.
   Every text/background pair in this file clears WCAG AA (4.5:1).
   ========================================================================== */

:root {
  --bg:          #fbfaf7;  /* warm off-white page */
  --bg-2:        #f6f4ef;  /* recessed band */
  --card:        #ffffff;
  --card-hi:     #fffdfa;
  --border:      #e7e2da;
  --border-hi:   #d6cfc3;
  --text:        #14181d;  /* 17.1:1 on page */
  --dim:         #4a535e;  /*  7.5:1 on page */
  --faint:       #5c6672;  /*  5.6:1 on page */
  --accent:      #99500f;  /*  5.7:1 on page, 6.0:1 white-on-it */
  --accent-hi:   #7d410c;
  --accent-soft: #fdf6ec;
  --accent-line: #eadcc6;
  --shadow-sm:   0 1px 2px rgba(28, 20, 10, 0.05);
  --shadow-md:   0 4px 14px rgba(28, 20, 10, 0.07), 0 1px 3px rgba(28, 20, 10, 0.05);
  --shadow-lg:   0 12px 30px rgba(28, 20, 10, 0.10), 0 2px 6px rgba(28, 20, 10, 0.05);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --wrap: 1080px;
  --r: 12px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Warm wash behind the hero. Decorative only. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 560px;
  background:
    radial-gradient(1100px 400px at 15% -10%, rgba(153, 80, 15, 0.055), transparent 64%),
    radial-gradient(860px 340px at 90% 2%, rgba(60, 100, 160, 0.035), transparent 62%);
  pointer-events: none;
  z-index: 0;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); text-decoration: underline; text-underline-offset: 3px; }

::selection { background: #f6e2c4; color: #14181d; }

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 22px;
  position: relative;
  z-index: 1;
}

/* ---------- Nav ---------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 250, 247, 0.86);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
  flex-wrap: wrap;
  padding-block: 10px;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 620;
  letter-spacing: -0.01em;
  color: var(--text);
  font-size: 1rem;
}

.mark:hover { color: var(--text); text-decoration: none; }

.mark-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  border: 1.5px solid var(--border-hi);
  background: var(--bg-2);
}

.nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.nav-links a {
  color: var(--dim);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 7px;
  transition: color 0.16s ease, background 0.16s ease;
}

.nav-links a:hover { color: var(--text); background: var(--bg-2); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--accent); }

/* ---------- Buttons ----------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 20px;
  border-radius: 9px;
  border: 1px solid var(--border-hi);
  background: var(--card);
  color: var(--text);
  font-size: 0.93rem;
  font-weight: 560;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 620;
}

.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: #fff; }

.btn svg { flex: none; }

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

.kicker {
  font-family: var(--mono);
  font-size: 0.735rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.kicker::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, var(--border-hi), transparent);
}

h1, h2, h3, h4 { letter-spacing: -0.022em; line-height: 1.18; margin: 0; font-weight: 640; }

section { padding-block: 74px; }
section + section { border-top: 1px solid var(--border); }

.section-title { font-size: clamp(1.5rem, 3.4vw, 2rem); margin-bottom: 12px; }
.section-lede { color: var(--dim); max-width: 62ch; margin: 0 0 38px; }

/* ---------- Hero -------------------------------------------------------- */

.hero { padding-block: clamp(64px, 12vw, 128px) 74px; }

.hero h1 { font-size: clamp(2.3rem, 7vw, 4rem); margin-bottom: 22px; }

.hero-lede {
  font-size: clamp(1.06rem, 2.3vw, 1.28rem);
  color: var(--dim);
  max-width: 60ch;
  margin: 0 0 16px;
  line-height: 1.6;
}

.hero-lede strong { color: var(--text); font-weight: 620; }

.hero-sub { color: var(--faint); max-width: 62ch; margin: 0 0 34px; font-size: 0.97rem; }

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 30px; }

.meta-row {
  display: flex;
  gap: 10px 22px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--faint);
  font-family: var(--mono);
}

.meta-row span { display: inline-flex; align-items: center; gap: 8px; }

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.dot.live { box-shadow: 0 0 0 0 rgba(153, 80, 15, 0.5); animation: pulse 2.6s infinite; }

@keyframes pulse {
  70%  { box-shadow: 0 0 0 9px rgba(153, 80, 15, 0); }
  100% { box-shadow: 0 0 0 0 rgba(153, 80, 15, 0); }
}

/* ---------- Stat strip -------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.stat { background: var(--card); padding: 24px 22px; }
.stat b {
  display: block; font-size: 1.62rem; font-weight: 660;
  letter-spacing: -0.03em; margin-bottom: 4px; color: var(--accent);
}
.stat span { font-size: 0.83rem; color: var(--faint); line-height: 1.45; display: block; }

/* ---------- Card grids -------------------------------------------------- */

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 26px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover { transform: translateY(-3px); border-color: var(--border-hi); box-shadow: var(--shadow-lg); }

.card-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.09em;
  display: block;
  margin-bottom: 13px;
}

.card h3 { font-size: 1.06rem; margin-bottom: 10px; }
.card p { color: var(--dim); font-size: 0.925rem; margin: 0; line-height: 1.6; }

.tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 16px; }

.tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  padding: 4px 9px;
  border-radius: 5px;
  white-space: nowrap;
}

/* ---------- Contact ----------------------------------------------------- */

.contact-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: clamp(28px, 5vw, 44px);
  box-shadow: var(--shadow-md);
}

.contact-list { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 14px; }
.contact-list li { display: flex; gap: 13px; align-items: baseline; font-size: 0.95rem; flex-wrap: wrap; }
.contact-list dfn {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-style: normal;
  min-width: 86px;
  flex: none;
}

/* ---------- Footer ------------------------------------------------------ */

.foot {
  border-top: 1px solid var(--border);
  padding-block: 34px;
  color: var(--faint);
  font-size: 0.86rem;
  background: var(--bg-2);
}

.foot-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.foot a { color: var(--dim); }
.foot a:hover { color: var(--accent); }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------- Document pages (resume / CV) -------------------------------- */

.doc { padding-block: 54px 74px; }
.doc-head { margin-bottom: 44px; }
.doc-head h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); margin-bottom: 10px; }

.doc-contact {
  color: var(--dim);
  font-size: 0.94rem;
  font-family: var(--mono);
  display: flex;
  gap: 8px 18px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.doc-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.doc-note {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 15px 19px;
  border-radius: 0 8px 8px 0;
  color: var(--dim);
  font-size: 0.89rem;
  margin: 26px 0 0;
}

.doc-note b { color: var(--text); }

.doc-section { padding-block: 38px 0; border-top: 1px solid var(--border); margin-top: 38px; }

.doc-section > h2 {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 26px;
}

.entry { margin-bottom: 30px; }
.entry:last-child { margin-bottom: 0; }

.entry-top {
  display: flex;
  justify-content: space-between;
  gap: 8px 24px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.entry-top h3 { font-size: 1.04rem; font-weight: 620; }

.when {
  font-family: var(--mono);
  font-size: 0.79rem;
  color: var(--faint);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.where { color: var(--accent); font-size: 0.93rem; margin: 0 0 11px; }
.where em { color: var(--faint); font-style: normal; }

.entry ul { margin: 0; padding-left: 19px; }
.entry ul li { color: var(--dim); font-size: 0.94rem; margin-bottom: 7px; line-height: 1.62; }
.entry ul li::marker { color: var(--accent); }
.entry ul li:last-child { margin-bottom: 0; }

.skillset { display: grid; gap: 20px; }
.skillset > div { display: grid; grid-template-columns: 190px 1fr; gap: 8px 26px; align-items: baseline; }
.skillset h3 { font-size: 0.88rem; font-weight: 620; color: var(--text); }
.skillset p { margin: 0; color: var(--dim); font-size: 0.93rem; }

.pubs { margin: 0; padding-left: 22px; display: grid; gap: 15px; }
.pubs li { color: var(--dim); font-size: 0.94rem; line-height: 1.62; }
.pubs li::marker { color: var(--accent); font-family: var(--mono); font-size: 0.85rem; }
.pubs b { color: var(--text); font-weight: 620; }
.pubs cite { color: var(--text); font-style: italic; }
.venue { color: var(--faint); font-family: var(--mono); font-size: 0.83rem; }

/* ---------- Motion ------------------------------------------------------ */

.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Narrow screens ---------------------------------------------- */

@media (max-width: 620px) {
  body { font-size: 16px; }
  section { padding-block: 54px; }
  .nav-inner { min-height: 56px; }
  .nav-links a { padding: 6px 9px; font-size: 0.86rem; }
  .skillset > div { grid-template-columns: 1fr; gap: 5px; }
  .btn { width: 100%; justify-content: center; }
  .cta-row, .doc-actions { flex-direction: column; align-items: stretch; }
  .contact-list dfn { min-width: 0; }
}

/* ---------- Print: the resume page has to come out clean ---------------- */

@media print {
  :root { --text: #000; --dim: #1c1c1c; --faint: #4a4a4a; --accent: #000; --border: #bbb; }
  @page { margin: 14mm 13mm; }
  body { background: #fff; color: #000; font-size: 10.2pt; line-height: 1.42; }
  body::before, .nav, .foot, .doc-actions, .doc-note, .no-print { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .doc { padding: 0; }
  .doc-head { margin-bottom: 16pt; }
  .doc-head h1 { font-size: 20pt; }
  .doc-contact { color: #000; margin-bottom: 0; font-size: 9pt; }
  .doc-section { margin-top: 14pt; padding-top: 10pt; border-top: 0.6pt solid #999; break-inside: auto; }
  .doc-section > h2 { font-size: 9pt; color: #000; margin-bottom: 9pt; letter-spacing: 0.13em; }
  .entry { margin-bottom: 11pt; break-inside: avoid; }
  .entry-top h3 { font-size: 10.5pt; }
  .where { color: #000; margin-bottom: 4pt; font-size: 9.5pt; }
  .entry ul li, .pubs li, .skillset p { color: #111; font-size: 9.6pt; margin-bottom: 2.5pt; }
  .tag { border-color: #999; background: none; color: #000; }
  .card, .contact-card, .stats { box-shadow: none; border-color: #bbb; }
  a { color: #000; text-decoration: none; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- Authorship marquee ------------------------------------------ */

.authorship {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  overflow: hidden;
}

.author-stats {
  display: flex;
  gap: 14px 46px;
  flex-wrap: wrap;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}

.author-stats li { display: flex; flex-direction: column; gap: 2px; }

.author-stats b {
  font-size: 1.5rem;
  font-weight: 660;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1.1;
}

.author-stats span {
  font-family: var(--mono);
  font-size: 0.73rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
}

/* full-bleed track, deliberately escaping the .wrap gutter */
.shelf {
  margin-top: 44px;
  position: relative;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  padding-block: 6px 10px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

.shelf-track {
  display: flex;
  gap: 20px;
  width: max-content;
  animation: shelf-scroll 78s linear infinite;
}

.shelf:hover .shelf-track,
.shelf:focus-within .shelf-track { animation-play-state: paused; }

@keyframes shelf-scroll {
  from { transform: translateX(0); }
  /* half the track is a duplicate, so -50% loops seamlessly */
  to   { transform: translateX(-50%); }
}

.shelf figure {
  margin: 0;
  flex: none;
  width: 168px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--card);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.shelf figure:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }

.shelf img {
  display: block;
  width: 100%;
  height: 252px;
  object-fit: cover;
  object-position: top center;
}

@media (max-width: 620px) {
  .shelf figure { width: 132px; }
  .shelf img { height: 198px; }
  .shelf-track { gap: 14px; animation-duration: 60s; }
  .author-stats { gap: 14px 30px; }
  .author-stats b { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .shelf-track { animation: none; }
  .shelf {
    overflow-x: auto;
    -webkit-mask-image: none;
            mask-image: none;
    scrollbar-width: thin;
  }
  .shelf-track { width: auto; }
}

@media print { .authorship { display: none !important; } }


/* ---------- Hero with circular portrait --------------------------------- */

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(190px, 22vw, 290px);
  gap: clamp(26px, 5vw, 56px);
  align-items: center;
}

.hero-photo {
  margin: 0;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 4px solid var(--card);
  outline: 1px solid var(--border);
  outline-offset: -5px;
}

.hero-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-width: 780px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero-photo { width: 180px; justify-self: start; }
}

/* ---------- Authorship cover banner ------------------------------------- */

.author-cover {
  margin: 0 0 40px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  aspect-ratio: 2.9;
  background: var(--bg-2);
}

.author-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 45%;
  display: block;
}

@media (max-width: 780px) {
  /* a 3:1 strip is too thin on a phone, so crop in rather than shrink */
  .author-cover { aspect-ratio: 2.1; margin-bottom: 30px; }
}
