/* ---------- Tokens ---------- */
:root {
  --green-50: #eef7ef;
  --green-100: #d6ecd8;
  --green-300: #8fd093;
  --green-500: #4caf50;
  --green-600: #43a047;
  --green-700: #2e7d32;
  --green-900: #1b5e20;

  --bg: #ffffff;
  --surface: #f7f9f7;
  --border: #e3e9e4;
  --text: #16201a;
  --muted: #5d6b61;
  --link: var(--green-700);
  --link-hover: var(--green-900);

  --radius: 12px;
  --max: 1160px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Barlow Semi Condensed', 'Arial Narrow', sans-serif;
  --shadow: 0 1px 2px rgba(16, 40, 20, .05), 0 4px 16px rgba(16, 40, 20, .06);
}


/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--green-500); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: .01em; line-height: 1.2; margin: 0; }
p { margin: 0; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .container { padding: 0 32px; } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--green-700); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip-link:focus { left: 8px; color: #fff; }

/* ---------- Header ---------- */
.site-header { background: var(--bg); border-bottom: 6px solid var(--green-500); }
.site-header__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 24px; padding-top: 16px; padding-bottom: 16px; }

/* Font settings live on .logo so the mark can size itself to the name's capital letters (cap unit). */
.logo { display: inline-flex; align-items: baseline; gap: .3em; color: var(--text); font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; line-height: 1; text-transform: uppercase; letter-spacing: .01em; }
.logo:hover { color: var(--text); }
.logo__mark { width: .7em; height: .7em; width: 1cap; height: 1cap; flex: none; }
@media (min-width: 640px) { .logo { font-size: 1.6rem; } }

.nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 10px; background: transparent; cursor: pointer; }
.nav-toggle__bar, .nav-toggle__bar::before, .nav-toggle__bar::after { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; position: relative; content: ''; }
.nav-toggle__bar::before { position: absolute; top: -6px; }
.nav-toggle__bar::after { position: absolute; top: 6px; }

/* Phones: the menu drops down as a full-width panel under the logo row. */
.site-nav { display: none; order: 3; flex-basis: 100%; margin-top: 12px; border-top: 1px solid var(--border); }
.site-nav.is-open { display: block; }
.site-nav__list { list-style: none; margin: 0; padding: 4px 0 0; display: flex; flex-direction: column; }
.site-nav__list a { display: block; padding: 10px 0; font-weight: 500; }

/* Wider screens: the menu sits on the right of the logo row. */
@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .site-nav { display: block; order: 0; flex-basis: auto; margin: 0; border: 0; }
  .site-nav__list { flex-direction: row; gap: 4px; padding: 0; }
  .site-nav__list a { padding: 8px 14px; border-radius: 6px; }
  .site-nav__list li:last-child a { margin-right: -14px; }
  .site-nav__list a:hover { background: var(--green-50); }
}

/* ---------- Layout ---------- */
.layout { display: grid; gap: 40px; padding-top: 40px; padding-bottom: 64px; }
@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 64px; padding-top: 56px; }
}
.content { display: flex; flex-direction: column; gap: 40px; min-width: 0; }

.notice { padding: 12px 16px; border-radius: 8px; background: var(--green-50); color: var(--text); }

/* ---------- Hero ---------- */
/* Phones: small photo beside the eyebrow and name, intro full width below.
   .hero__text uses display: contents so its children join the hero grid. */
.hero { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 18px; align-items: center; }
.hero__text { display: contents; }
.hero__photo { grid-row: 1 / span 2; width: 76px; height: 76px; margin: 7px; border-radius: 50%; object-fit: cover; background: #fff; box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--green-500); }
.hero .hero__eyebrow { grid-column: 2; align-self: end; margin-bottom: 4px; }
.hero .hero__title { grid-column: 2; align-self: start; }
.hero .hero__lede { grid-column: 1 / -1; }

/* Wider screens: larger photo to the left of the whole text block. */
@media (min-width: 640px) {
  .hero { display: flex; align-items: center; gap: 32px; }
  .hero__text { display: block; min-width: 0; }
  .hero__photo { flex: none; width: 150px; height: 150px; margin: 9px; box-shadow: 0 0 0 5px #fff, 0 0 0 9px var(--green-500); }
  .hero .hero__eyebrow { margin-bottom: 8px; }
}
.hero__eyebrow { font-size: .8rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--green-600); margin-bottom: 8px; }
.hero__title { font-size: clamp(1.75rem, 4vw, 2.6rem); letter-spacing: 0; max-width: 20ch; }
.hero__lede { margin-top: 14px; font-size: 1.1rem; color: var(--muted); max-width: 80ch; }

/* ---------- Skills ---------- */
.skills__list { list-style: none; margin: 0; padding: 0; }
.skill { display: flex; align-items: flex-start; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.skill:last-child { border-bottom: 0; }
.skill__badge { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--green-50); color: var(--green-700); }
.skill__icon { width: 18px; height: 18px; }
.skill__name { font-size: 1rem; line-height: 1.3; }
.skill__text { font-size: .9rem; line-height: 1.45; color: var(--muted); }

/* ---------- Experience ---------- */
.experience__grid { list-style: none; margin: 0; padding: 0; }
.job { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.job__logo { width: 36px; height: 36px; flex: none; border-radius: 8px; object-fit: contain; box-shadow: 0 0 0 1px var(--border); }
.job__body { flex: 1; min-width: 0; container-type: inline-size; }
.job__company { font-size: 1rem; line-height: 1.3; }
.job__company-note { font-family: var(--font); font-size: clamp(.625rem, 3.2cqi, .75rem); font-weight: 500; letter-spacing: 0; color: var(--muted); white-space: nowrap; }
.job__title { font-size: .9rem; line-height: 1.35; color: var(--text); }
.job__years { flex: none; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Earlier roles: ruled rows like the roles above, one column on phones and two on wider screens. */
.experience__more { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 24px; }
.job-mini { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.job-mini:last-child { border-bottom: 0; }
@media (min-width: 560px) {
  .experience__more { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .job-mini:nth-last-child(-n + 2) { border-bottom: 0; }
}
.job-mini__logo { width: 32px; height: 32px; flex: none; border-radius: 7px; object-fit: contain; box-shadow: 0 0 0 1px var(--border); }
.job-mini__company { min-width: 0; font-family: var(--font-display); font-size: 1rem; font-weight: 500; letter-spacing: .01em; line-height: 1.25; color: var(--text); }

/* ---------- Projects ---------- */
.projects__grid { list-style: none; margin: 0; padding: 16px 0 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 640px) { .projects__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.project { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 0 0 16px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); transition: box-shadow .2s, transform .2s; }
.project:hover { color: var(--text); box-shadow: var(--shadow); transform: translateY(-2px); }
.project__image { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.project__name, .project__text { padding: 0 16px; }
.project__name { font-size: 1.1rem; line-height: 1.25; color: var(--link); }
.project__text { font-size: .9rem; line-height: 1.45; color: var(--muted); }

/* ---------- Project detail pages ---------- */
.page { padding-top: 24px; padding-bottom: 64px; }
.breadcrumb__list { list-style: none; margin: 0 0 28px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: .875rem; color: var(--muted); }
.breadcrumb__item + .breadcrumb__item::before { content: '/'; margin: 0 10px; color: #b9c4bc; }
.breadcrumb__item a { font-weight: 500; }

/* Article plus a right-hand sidebar on wide screens; on smaller ones the sidebar sits above the About section. */
.project-layout { display: grid; gap: 20px; }
@media (min-width: 960px) { .project-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 64px; } }
@media (max-width: 959px) {
  /* Flatten the article into the grid so the related-links card sits between the intro and the "About" section. */
  .project-layout > .project-page { display: contents; }
  .project-layout > .sidebar { order: 1; }
  .project-page > .project-page__section, .project-page > .project-page__back { order: 2; }
}
.card--follow__title { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.card--follow__icon { width: 22px; height: 22px; flex: none; color: var(--green-700); }
.card--follow__handle { display: block; margin-top: 8px; font-size: .85rem; font-weight: 500; color: var(--link); word-break: break-word; }
.project-page { max-width: 800px; display: flex; flex-direction: column; gap: 40px; }
.project-page__title { font-size: clamp(1.9rem, 5vw, 2.6rem); }
.project-page__lede { margin-top: 10px; font-size: 1.15rem; color: var(--muted); }
.project-page__section { display: flex; flex-direction: column; gap: 16px; }
.project-page__back { font-weight: 500; }

.prose p + p, .prose p + ul { margin-top: 14px; }
.prose ul { margin: 0; padding-left: 1.25rem; }
.prose li + li { margin-top: 6px; }
.prose li::marker { color: var(--green-500); }

.figure { margin: 0; }
.figure__placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; aspect-ratio: 4 / 3; border: 1px dashed #b9c4bc; border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: .85rem; font-weight: 500; }
.figure__placeholder--wide { aspect-ratio: 16 / 9; }
.figure__placeholder svg { width: 32px; height: 32px; color: var(--green-600); }
.figure__caption { margin-top: 8px; font-size: .85rem; color: var(--muted); }
.figure-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 640px) { .figure-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Vertical images stay side by side at every width. */
.figure-pair--posters { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.figure__image { display: block; width: 100%; height: auto; border-radius: var(--radius); box-shadow: 0 0 0 1px var(--border); }
/* Framed images fill a 4:3 box without cropping (for diagrams and screenshots). */
.figure__image--framed { aspect-ratio: 4 / 3; object-fit: contain; padding: 8px; background: #fff; }

/* ---------- Image zoom ---------- */
.zoom { position: relative; display: block; border-radius: var(--radius); cursor: zoom-in; }
.zoom:hover .figure__image { box-shadow: 0 0 0 2px var(--green-500); }
.zoom__hint { position: absolute; right: 10px; bottom: 10px; padding: 3px 10px; border-radius: 999px; background: rgba(22, 32, 26, .78); color: #fff; font-size: .75rem; font-weight: 500; opacity: 0; transition: opacity .15s; }
.zoom:hover .zoom__hint, .zoom:focus-visible .zoom__hint { opacity: 1; }

.lightbox { width: min(1200px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px); padding: 16px; border: 0; border-radius: var(--radius); background: #fff; box-shadow: 0 12px 48px rgba(0, 0, 0, .35); }
.lightbox::backdrop { background: rgba(10, 20, 12, .78); }
.lightbox__image { display: block; width: 100%; height: auto; max-height: calc(100vh - 120px); object-fit: contain; }
.lightbox__caption { margin-top: 10px; padding-right: 48px; font-size: .9rem; color: var(--muted); }
.lightbox__close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .25); color: var(--text); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.lightbox__close:hover { background: var(--green-50); }

/* ---------- Contact modal ---------- */
.modal { width: min(640px, calc(100vw - 32px)); padding: 56px 56px 48px; border: 0; border-radius: var(--radius); background: #fff; color: var(--text); font-size: 1.1rem; box-shadow: 0 12px 48px rgba(0, 0, 0, .35); }
@media (max-width: 520px) { .modal { padding: 48px 24px 32px; } }
.modal::backdrop { background: rgba(10, 20, 12, .78); }
.modal__title { margin-bottom: 16px; padding-right: 40px; }
.modal .social { margin-top: 24px; }
.modal p + p { margin-top: 12px; }

.faq-list { border-top: 1px solid var(--border); }
.faq { padding: 14px 0 16px; border-bottom: 1px solid var(--border); }
.faq__question { font-family: var(--font); font-size: 1rem; font-weight: 600; letter-spacing: 0; line-height: 1.4; }
.faq__answer { margin-top: 4px; color: var(--muted); }

/* ---------- Feature ---------- */
.feature { display: flex; align-items: center; gap: 20px; padding: 20px; border: 1px solid var(--border); border-left: 4px solid var(--green-500); border-radius: var(--radius); background: var(--surface); color: var(--text); transition: box-shadow .2s, transform .2s; }
.feature:hover { color: var(--text); box-shadow: var(--shadow); transform: translateY(-2px); }
.feature__icon { width: 64px; height: 64px; flex: none; }
.feature__body { flex: 1; min-width: 0; }
.feature__title { font-size: 1.3rem; color: var(--link); }
.feature__text { margin-top: 4px; color: var(--muted); }
.feature__arrow { font-size: 1.4rem; color: var(--green-600); transition: transform .2s; }
.feature:hover .feature__arrow { transform: translateX(4px); }
@media (max-width: 520px) {
  .feature { flex-direction: column; align-items: flex-start; }
  .feature__arrow { display: none; }
}

/* ---------- Posts ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--green-500); }
.section-head h2 { font-size: 1.25rem; }
.section-head__link { font-size: .9rem; white-space: nowrap; }

.post-list { list-style: none; margin: 0; padding: 0; }
.post { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px; padding: 14px 12px; margin: 0 -12px; border-bottom: 1px solid var(--border); border-radius: 8px; transition: background .15s; }
.post-list li:last-child .post { border-bottom: 0; }
.post:hover { background: var(--green-50); }
.post__title { font-weight: 500; flex: 1 1 320px; }
.post__date { font-size: .875rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 960px) { .sidebar { position: sticky; top: 24px; align-self: start; } }
.card { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.card__title { font-size: 1.25rem; margin-bottom: 10px; }
.card p { color: var(--text); }
.social { list-style: none; padding: 0; margin: 14px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.social a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 12px; border: 1px solid var(--green-300); border-radius: 999px; font-size: .9rem; font-weight: 500; }
.social__icon { width: 16px; height: 16px; flex: none; }
.social a:hover { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.card--link { display: block; color: var(--muted); background: linear-gradient(135deg, var(--green-50), var(--surface)); }
.card--link strong { color: var(--link); }
.card--link:hover { color: var(--muted); box-shadow: var(--shadow); }
.card__label { display: block; font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--green-600); margin-bottom: 6px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 6px solid var(--green-500); background: var(--surface); color: var(--muted); font-size: .9rem; }
.site-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 20px; padding-bottom: 20px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
