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

:root {
  /* Latte neutrals + coffee accent, matched to the profile photo */
  --bg: #fbf9f7;
  --surface: #ffffff;
  --text: #2e2420;
  --text-muted: #63554d;
  --text-faint: #a89a91;
  --border: #ebe4de;
  --tag-bg: #f4efeb;

  --accent: #6f4e37;        /* coffee brown */
  --accent-soft: #ede2d9;

  --font-sans: -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:
    radial-gradient(ellipse 80% 520px at 85% 0, rgba(236, 224, 214, 0.3), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0; }
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: rgba(251, 249, 247, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

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

.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  color: var(--text);
}
.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.95rem;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }

.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: 48px -24px 28px;
  padding: 48px 24px 0;
  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-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-role {
  font-size: 1.35rem;
  font-weight: 500;
  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 ---------- */

.section {
  padding-top: 52px;
  padding-bottom: 52px;
  border-top: 1px solid var(--border);
}

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  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;
}

.tags li {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ---------- 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-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.timeline-location {
  display: block;
  margin-top: 2px;
  font-size: 0.85rem;
  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 { font-size: 1.15rem; }
.company {
  color: var(--accent);
  font-weight: 500;
  margin: 2px 0 12px;
}
.timeline-content > p:not(.company) { color: var(--text-muted); }

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

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

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

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

.project-card {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.project-media {
  background: var(--tag-bg);
  border-right: 1px solid var(--border);
  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;
  box-shadow: 0 1px 3px rgba(46, 36, 32, 0.06);
}

.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; }
.project-body h3 { font-size: 1.3rem; margin-bottom: 10px; }

.project-body > p { color: var(--text-muted); }
.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 20px 50px rgba(0, 0, 0, 0.15);
}
.project-dialog::backdrop { background: rgba(46, 36, 32, 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; }
.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; }

/* 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(--border);
}
.skill-row:first-child { border-top: 1px solid var(--border); }

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

/* Plain-text skills: no pill, just spaced words */
.skills-list .tags { gap: 4px 18px; }
.skills-list .tags li {
  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-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 520px;
}
.contact-list li {
  display: flex;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.contact-list li:first-child { border-top: 1px solid var(--border); }
.contact-label {
  width: 80px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 2px;
}
.contact-list a { word-break: break-word; }

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

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

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

@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
    grid-template-areas: "photo" "text" "about-title" "about" "hobbies";
    row-gap: 32px;
  }
  .hero-photo { width: 176px; justify-self: start; }
  /* Single flowing row on small screens */
  .hobby-rows { flex-direction: row; flex-wrap: wrap; }
  .hobby-rows .tags { display: contents; }
  .about-title { margin: 16px -24px 0; padding: 40px 24px 0; }

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

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

@media (max-width: 640px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }
  .about-title { margin-inline: -16px; padding-inline: 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: 44px; padding-bottom: 44px; }
  .project-body { padding: 20px; }
  .skill-row { grid-template-columns: 1fr; gap: 10px; }
  .contact-list li { flex-direction: column; gap: 2px; }
}
