/* ==========================================================================
   JH Portfolio — styles
   Neutral palette + one accent. Change the accent in :root to restyle.
   ========================================================================== */

:root {
  /* Modern hardcover palette: neutral off-white paper, crisp ink, brown accent */
  --bg: #fdfcfb;            /* soft paper white */
  --surface: #fdfcfa;       /* cards */
  --heading: #252320;       /* primary text */
  --text: #252320;
  --text-muted: #49433d;    /* body text (9.3:1) */
  --text-faint: #6f6860;    /* secondary labels: dates, locations, footer (5.2:1) */
  --border: #ddd9d2;        /* subtle dividers */
  --rule: #e8e5df;          /* lighter hairline for rows inside a section */
  --tag-bg: #f1efeb;

  --accent: #765844;        /* brown accent */
  --accent-soft: #eee8e2;

  /* Paper texture: fine grain + faint large-scale colour variation (inline SVG, no image files) */
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.28 0 0 0 0 0.25 0.025 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  --paper-mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='640'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.48 0 0 0 0 0.44 0.012 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
  --paper: #fffefd;         /* base under the texture; averages to --bg once grain is applied */
  --desk: #f1f0ec;          /* outer background behind the book page (desktop) */
  --binding: #7a6352;       /* muted taupe-brown book cloth */

  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;

  --max-width: 960px;
  --radius: 8px;
  --header-height: 64px;
}

/* ---------- Base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image: var(--paper-grain), var(--paper-mottle);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { line-height: 1.25; margin: 0; color: var(--heading); }
h1, h2 { font-family: var(--font-serif); font-weight: 500; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.muted { color: var(--text-muted); font-weight: 400; }

/* ---------- Navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--paper);
  background-image: var(--paper-grain), var(--paper-mottle);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.nav-logo {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
  color: var(--heading);
}
.nav-logo:hover { text-decoration: none; color: var(--accent); }

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--accent); font-weight: 500; }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 8px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 4px 0;
  background: var(--text);
}

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

.hero {
  padding-top: 72px;
  padding-bottom: 40px;
  display: grid;
  grid-template-columns: 1fr 242px;
  grid-template-areas:
    "text        photo"
    "about-title about-title"
    "about       hobbies";
  column-gap: 56px;
}
.hero-text  { grid-area: text; align-self: center; }
.hero-photo { grid-area: photo; }
.about-title {
  grid-area: about-title;
  /* Bleed the divider across the container padding to match other sections */
  margin: 56px 0 28px;
  padding-top: 64px;
  border-top: 1px solid var(--border);
}
.hero .about-body { grid-area: about; }
.hero .hobbies { grid-area: hobbies; margin: 0; }

.hero-photo {
  width: 242px;
  justify-self: end;
  align-self: center;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 25%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 12px;
}

/* Hero location: Lucide map-pin in the accent colour, 8px from the text */
.eyebrow--location {
  display: flex;
  align-items: center;
  gap: 8px;
}
.eyebrow-icon { flex: none; }

.hero h1 {
  font-size: clamp(2.6rem, 6vw, 3.75rem);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.hero-role {
  font-size: 1.3rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  margin: 4px 0 16px;
}

.hero-intro {
  max-width: 620px;
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

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

.btn {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  transition: border-color 0.15s ease;
}
.btn:hover { border-color: var(--text-faint); text-decoration: none; }

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

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
}
.btn-icon svg { width: 20px; height: 20px; fill: currentColor; }

/* ---------- Sections ---------- */

/* Book-style chapter numbers before each section title (decorative, hidden from screen readers) */
main { counter-reset: chapter; }
.section-title::before {
  content: counter(chapter, decimal-leading-zero) " /";
  content: counter(chapter, decimal-leading-zero) " /" / "";
  margin-right: 14px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--accent);
  vertical-align: baseline;
}

.section {
  position: relative;
  padding-top: 64px;
  padding-bottom: 64px;
}
/* Editorial rule: a hairline across the text column, not the full box */
.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 1px;
  background: var(--border);
}

.section-title {
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  counter-increment: chapter;
  margin-bottom: 24px;
}

.section-lead {
  color: var(--text-muted);
  margin-top: -16px;
  margin-bottom: 32px;
}

.about-body { max-width: 620px; }
.about-body p { color: var(--text-muted); }

.hobbies { margin-top: 28px; }
.hobbies h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.hobby-rows { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Tags (shared) ---------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Editorial labels: light, quiet and clearly not buttons (Hobbies and project stacks) */
.tags li {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  padding: 5px 10px;
  border-radius: 3px;
  background: #f7f5f1;
  border: 1px solid #e5e0d9;
  color: #514a43;
}

/* ---------- Experience timeline ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  padding-bottom: 36px;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-dates {
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.timeline-location {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  color: var(--text-faint);
}

.timeline-content {
  border-left: 2px solid var(--border);
  padding-left: 28px;
  position: relative;
}
.timeline-content::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.timeline-content h3,
.edu-main h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.25rem;
}
.timeline-content h3 .muted {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}
.company {
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 500;
  margin: 4px 0 12px;
}
.timeline-content > p:not(.company) { color: var(--text-muted); }

.contributions {
  margin: 0 0 16px;
  padding-left: 20px;
}
.contributions li { margin-bottom: 6px; }

/* Expandable entries: native <details>, header visible, description on demand */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.section-head .section-title { margin-bottom: 0; }

.exp-toggle-all {
  border: 0;
  background: none;
  padding: 4px 0;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}
.exp-toggle-all:hover { text-decoration: underline; }

.timeline-item:has(.exp-details) { padding-bottom: 28px; }
.timeline-item:has(.exp-details):last-child { padding-bottom: 0; }

.exp-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  list-style: none;
  cursor: pointer;
}
.exp-summary::-webkit-details-marker { display: none; }
.exp-summary .company { display: block; margin-bottom: 0; }

.exp-chevron {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease, stroke 0.15s ease;
}
.exp-summary:hover .exp-chevron { stroke: var(--accent); }
.exp-details[open] .exp-chevron { transform: rotate(180deg); }

.exp-body p { color: var(--text-muted); margin: 12px 0 0; }

/* Smooth open/close where supported; other browsers simply open instantly */
@supports (interpolate-size: allow-keywords) {
  .exp-details { interpolate-size: allow-keywords; }
  .exp-details::details-content {
    block-size: 0;
    overflow: hidden;
    transition: block-size 0.25s ease, content-visibility 0.25s allow-discrete;
  }
  .exp-details[open]::details-content { block-size: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .exp-chevron { transition: none; }
  .exp-details::details-content { transition: none; }
}

/* ---------- Education ---------- */

.edu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.edu-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: start;
  column-gap: 24px;
  padding: 24px 0;
}
.edu-item:first-child { padding-top: 0; }
.edu-item:last-child { padding-bottom: 0; }
.edu-item + .edu-item { border-top: 1px solid var(--rule); }

/* Fixed square slot; contain keeps each logo's own proportions */
.edu-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
}
.edu-main .company { margin: 4px 0 0; font-size: 0.85rem; }
.edu-meta { text-align: right; padding-top: 4px; }

/* ---------- Project cards ---------- */

.subsection-title {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.projects + .subsection-title { margin-top: 44px; }

.projects {
  display: grid;
  gap: 24px;
}

/* Printed on the page: same paper colour, defined only by a thin rule */
.project-card {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  background: #fdfcfb;
  border: 1px solid #e5e0d9;
  border-radius: var(--radius);
  overflow: hidden;
}

.project-media {
  background: var(--tag-bg);   /* warm-grey panel behind the diagrams; text side stays paper */
  border-right: 1px solid #e5e0d9;
  min-height: 240px;
  display: flex;
}
.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.project-media--diagram a {
  display: flex;
  align-items: center;
  flex: 1;
  padding: 22px;
  cursor: zoom-in;
}
.project-media--diagram img {
  height: auto;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.media-placeholder {
  flex: 1;
  margin: 16px;
  border: 1.5px dashed var(--text-faint);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.media-placeholder code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  word-break: break-all;
}

.project-body { padding: 28px; }
/* Quiet text serif for project titles */
.project-body h3 {
  font-family: "Lora", Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: 1.3rem;
  line-height: 1.35;
  margin-bottom: 10px;
}

.project-body > p { color: var(--text-muted); }

/* Title with a status pill beside it; the pill wraps under the title on narrow screens */
.project-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 10px;
}
.project-body .project-title h3 { margin-bottom: 0; }
/* Same shape as the tech tags (.tags li), in sage green and a touch bolder */
.status-pill {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  padding: 5px 10px;
  border-radius: 3px;
  background: #edf2e9;            /* sage green */
  border: 1px solid #d3dfca;
  color: #4f6b45;                 /* deeper sage for text + dot, ~5:1 contrast */
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
/* Muted blue variant (Agensi) */
.status-pill--blue {
  background: #eaf0f7;
  border-color: #cfdbe9;
  color: #3f5f82;                 /* deeper muted blue for text + dot, ~5.5:1 contrast */
}
/* Small "live" dot before the pill text */
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.project-body .tags { margin-bottom: 20px; }

.pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
}
.pipeline span {
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 16px;
}

/* Links that haven't been set yet */
.is-placeholder {
  color: var(--text-faint);
  cursor: not-allowed;
}
.is-placeholder:hover { text-decoration: none; }

.details-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--border);
  background: none;
  padding: 14px 0 0;
  font: inherit;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}
.details-btn::after { content: " →"; }
.details-btn:hover { text-decoration: underline; }
/* ---------- Project details dialog ---------- */

.project-dialog {
  width: min(640px, calc(100% - 32px));
  max-height: calc(100vh - 64px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 32px rgba(41, 37, 34, 0.12);
}
.project-dialog::backdrop { background: rgba(41, 37, 34, 0.45); }

.dialog-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.dialog-header h3 { font-size: 1.2rem; }

.dialog-close {
  border: 0;
  background: none;
  font-size: 1.6rem;
  line-height: 1;
  padding: 4px 8px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
}
.dialog-close:hover { color: var(--text); background: var(--tag-bg); }

.project-dialog dl { margin: 0; padding: 8px 28px 28px; }
.project-dialog dt {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-top: 20px;
}
.project-dialog dd { margin: 6px 0 0; color: var(--text-muted); }
.project-dialog dd ul { margin: 0; padding-left: 20px; }
.project-dialog dd li { margin-bottom: 4px; }
.project-dialog dd .layer-list { margin: 6px 0 8px; list-style: circle; }
.project-dialog dd .layer-list li { margin-bottom: 2px; }
.project-dialog dd.dialog-diagram { margin: 10px 0 12px; }
.project-dialog dd > p { margin: 0 0 0.6em; }
.project-dialog dd > p:last-child { margin-bottom: 0; }
.pipeline--spaced { gap: 6px 9px; }
/* Small text glyph after a dialog heading (U+FE0E keeps it from rendering as emoji) */
.dt-mark { color: var(--accent); font-size: inherit; font-variant-emoji: text; }  /* roomier arrows, still one line in the 640px dialog */
.dialog-diagram a {
  display: block;
  cursor: zoom-in;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.dialog-diagram img { display: block; width: 100%; height: auto; }
.placeholder-text { color: var(--text-faint) !important; font-style: italic; }

/* Diagram lightbox: full-viewport, image centred, dark backdrop */
.lightbox {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 64px 24px 24px;
  border: 0;
  background: transparent;
  cursor: zoom-out;
}
.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox::backdrop { background: rgba(41, 37, 34, 0.85); }
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 8px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  cursor: default;
}
.lightbox-close {
  position: fixed;
  top: 12px;
  right: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}
.lightbox-close:hover { color: #fff; background: rgba(255, 255, 255, 0.25); }

/* Stop the page scrolling behind an open dialog */
body:has(dialog[open]) { overflow: hidden; }

/* ---------- Skills ---------- */

.skills-list { margin: 0; }

.skill-row {
  display: grid;
  grid-template-columns: 22% 1fr;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
}
.skill-row:first-child { border-top: 1px solid var(--rule); }

.skill-row dt {
  font-size: 0.95rem;
  font-weight: 500;
}
.skill-row dd { margin: 0; }

/* Plain-text skills: no pill, just spaced words */
.skills-list .tags { gap: 4px 18px; }
.skills-list .tags li {
  font-family: var(--font-mono);   /* Skills keep their existing code-style words */
  padding: 0;
  background: none;
  border: 0;
  font-size: 0.85rem;
  color: var(--text);
}

.skill-arrow { color: var(--text-faint); font-weight: 400; }

.certs-title { margin-top: 56px; }

.certs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.certs li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
.certs strong { font-size: 0.95rem; font-weight: 600; }
.certs span { font-size: 0.85rem; color: var(--text-muted); }
.cert-verify {
  align-self: flex-start;
  margin-top: 6px;
  font-size: 0.85rem;
  font-weight: 500;
}

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

.contact { padding-top: 56px; }
.contact-intro { max-width: 62ch; color: var(--text-muted); margin-top: -8px; margin-bottom: 24px; }

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 40px;
}
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.15s ease;
}
.contact-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}
.contact-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  color: var(--text-faint);
  transition: color 0.15s ease;
}
.contact-icon.is-stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.contact-link:hover .contact-icon { color: var(--accent); }

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

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 32px 0;
  font-size: 0.85rem;
  color: var(--text-faint);
}
.site-footer p { margin: 0; }

/* ---------- Paper & book ---------- */

/* Cards share the paper grain so they read as paper, not white boxes */
.certs li,
.project-dialog { background-image: var(--paper-grain); }

/* Wide screens: the content becomes one hardcover book page resting on parchment */
@media (min-width: 1100px) {
  body,
  .site-header { background-color: var(--desk); }
  .site-header { border-bottom-color: #dcd9d2; }

  main {
    position: relative;
    max-width: 1040px;
    margin: 40px auto 48px;
    padding: 8px 16px 24px;
    background-color: var(--paper);
    background-image: var(--paper-grain), var(--paper-mottle);
    border-radius: 0 4px 4px 0;
    box-shadow:
      /* hinge: a crisp line where the page meets the binding */
      inset 1px 0 0 rgba(52, 46, 40, 0.18),
      /* the page curving down into the spine */
      inset 26px 0 28px -24px rgba(52, 46, 40, 0.22),
      /* layered page edges on the fore-edge */
      1px 0 0 #e6e3dd,
      2px 1px 0 #f7f6f2,
      3px 1px 0 #dfdbd4,
      4px 2px 0 #f3f1ec,
      5px 2px 0 #d9d5ce,
      /* the book resting on the desk */
      0 14px 34px rgba(52, 46, 40, 0.12);
  }
  /* Cloth-bound spine: a slim taupe strip just outside the page, so content width is unchanged.
     It runs slightly past the page top and bottom, like a hardcover board. */
  main::before {
    content: "";
    position: absolute;
    top: -4px;
    bottom: -4px;
    left: -12px;
    width: 12px;
    background-color: var(--binding);
    background-image: var(--paper-grain);
    border-radius: 4px 0 0 4px;
    box-shadow:
      inset -1px 0 0 rgba(255, 248, 238, 0.22),   /* hinge highlight */
      inset 2px 0 0 rgba(40, 28, 18, 0.18),       /* rounded outer edge */
      -2px 8px 16px rgba(52, 46, 40, 0.16);       /* spine resting on the desk */
    pointer-events: none;
  }
}

/* Narrower screens: a simplified binding line and fold shadow, no frame */
@media (max-width: 1099px) {
  main {
    box-shadow:
      inset 3px 0 0 var(--binding),
      inset 16px 0 16px -14px rgba(52, 46, 40, 0.12);
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 800px) {
  /* Keep all nav items on one line until the mobile menu takes over */
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 0.9rem; }

  .hero {
    grid-template-columns: 1fr;
    grid-template-areas: "photo" "text" "about-title" "about" "hobbies";
    row-gap: 32px;
  }
  .hero-photo { width: 176px; justify-self: center; }
  /* Tighter gap between portrait and "Sydney, NSW" (row-gap is 32px) */
  .hero-text { margin-top: -12px; text-align: center; }
  /* Centre the hero block under the portrait */
  .eyebrow--location,
  .hero-actions { justify-content: center; }
  .hero-intro { margin-left: auto; margin-right: auto; }
  /* Single flowing row on small screens */
  .hobby-rows { flex-direction: row; flex-wrap: wrap; }
  .hobby-rows .tags { display: contents; }
  .about-title { margin: 16px 0 0; padding-top: 48px; }

  .project-card { grid-template-columns: 1fr; }
  .project-media {
    border-right: 0;
    border-bottom: 1px solid #e5e0d9;
    min-height: 200px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .timeline-meta { padding-left: 30px; }

  .edu-item { grid-template-columns: 44px 1fr; column-gap: 16px; align-items: start; }
  .edu-logo { width: 44px; height: 44px; }
  .edu-meta { grid-column: 2; text-align: left; margin-top: 8px; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }

  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { display: block; padding: 10px 0; }

  .hero { padding-top: 56px; padding-bottom: 32px; }
  .section { padding-top: 48px; padding-bottom: 48px; }
  .section::before { left: 16px; right: 16px; }
  .project-body { padding: 20px; }
  .skill-row { grid-template-columns: 1fr; gap: 10px; }
}
