/* --------------------------------------------------------------------------
   Minimal portfolio — CSS variables, layout, cards
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;
  --bg: #f7f6f3;
  --bg-elevated: #fffefb;
  --fg: #1c1b19;
  --muted: #5c5a55;
  --border: rgba(28, 27, 25, 0.12);
  --accent: #6b7f39;
  --accent-muted: rgba(107, 127, 57, 0.14);
  --focus: #3d4f6b;
  --shadow: rgba(28, 27, 25, 0.06);
  --radius: 12px;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
  --container: 68rem;
  --header-h: 4rem;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141312;
  --bg-elevated: #1c1b19;
  --fg: #f2f0eb;
  --muted: #a3a095;
  --border: rgba(242, 240, 235, 0.12);
  --accent: #a9b06a;
  --accent-muted: rgba(169, 176, 106, 0.16);
  --focus: #8ab4e6;
  --shadow: rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 4vw, 2.75rem);
}

h2 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
}

h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

p {
  margin: 0 0 0.75rem;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--fg);
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--bg-elevated);
  color: var(--fg);
  border-radius: 6px;
  border: 1px solid var(--border);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

/* Header ------------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}

.logo {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--fg);
  text-decoration: none;
}

.logo:hover {
  color: var(--accent);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  justify-content: flex-end;
}

.site-nav a {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="true"] {
  color: var(--fg);
}

.theme-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--fg);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.theme-toggle__icon--moon {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--sun {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--moon {
  display: inline;
}

@media (max-width: 52rem) {
  .header-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 1rem;
    row-gap: 0.65rem;
    padding-block: 0.65rem;
  }

  .logo {
    grid-column: 1;
  }

  .theme-toggle {
    grid-column: 2;
    justify-self: end;
  }

  .site-nav {
    grid-column: 1 / -1;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav ul {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0.75rem 1rem;
    padding-bottom: 0.15rem;
  }

  .site-nav a {
    white-space: nowrap;
    font-size: 0.85rem;
  }
}

/* Main sections ----------------------------------------------------------- */
main {
  padding-block: 2.5rem 3rem;
}

.section {
  margin-bottom: 3rem;
}

.section-title {
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.hero {
  margin-bottom: 2.5rem;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.75rem 2rem;
  align-items: center;
}

.hero-main {
  min-width: 0;
}

.hero-portrait {
  flex-shrink: 0;
}

.hero-portrait__img {
  display: block;
  width: min(15rem, 72vw);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 20%;
  border: 3px solid var(--border);
  box-shadow: 0 12px 36px var(--shadow);
}

@media (max-width: 40rem) {
  .hero-layout {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .hero-main .contact-chips,
  .hero-main .link-row {
    justify-content: center;
  }

  .hero-main .lede {
    margin-inline: auto;
  }

  .hero-portrait__img {
    width: min(10rem, 55vw);
  }
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  font-size: 1.1rem;
  max-width: 42rem;
  color: var(--muted);
}

.lede strong {
  color: var(--fg);
  font-weight: 600;
}

.lede--tight {
  font-size: 1rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.9rem;
}

.strong {
  margin: 0;
  font-weight: 600;
  font-size: 1.05rem;
}

/* Cards ------------------------------------------------------------------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: 0 8px 28px var(--shadow);
}

.card-title {
  font-size: 1.2rem;
}

.card-meta {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.section-intro {
  margin: -0.5rem 0 1.25rem;
  max-width: 40rem;
}

.section--personal .personal-banner {
  margin: 0 calc(50% - 50vw) 1rem;
  width: 100vw;
  max-width: 100vw;
}

.personal-banner {
  padding: 0;
}

.personal-banner__img {
  display: block;
  width: 100%;
  height: min(42vh, 22rem);
  object-fit: cover;
  border-radius: 0;
}

.personal-banner__cap {
  padding: 0.65rem min(1.5rem, 5vw) 0;
  max-width: var(--container);
  margin-inline: auto;
}

.personal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.card--personal-photo {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card--personal-photo:hover {
  box-shadow: 0 10px 32px var(--shadow);
}

.card--personal-photo figcaption {
  padding: 0.85rem 1.1rem 1rem;
}

.personal-photo-frame {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg);
}

.personal-photo-frame--tall {
  aspect-ratio: 3 / 4;
  max-height: 28rem;
}

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

.experience-media {
  display: grid;
  grid-template-columns: 1fr min(12rem, 34%);
  gap: 1.25rem 1.5rem;
  align-items: start;
}

.experience-media__fig {
  margin: 0;
}

.experience-media__fig img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid var(--border);
}

.experience-media__fig figcaption {
  margin-top: 0.5rem;
}

.experience-media--logo {
  grid-template-columns: 1fr min(10rem, 30%);
}

.experience-media__fig--logo {
  align-self: center;
  justify-self: end;
}

.experience-media__fig--logo img {
  width: auto;
  max-width: 100%;
  max-height: 3.75rem;
  height: auto;
  object-fit: contain;
  border: none;
  border-radius: 0;
}

@media (max-width: 36rem) {
  .experience-media {
    grid-template-columns: 1fr;
  }

  .experience-media__fig {
    order: -1;
    max-width: 16rem;
  }

  .experience-media__fig--logo {
    justify-self: start;
    max-width: 9rem;
  }
}

.card--experience-media:hover {
  box-shadow: 0 10px 32px var(--shadow);
}

.card--hero {
  padding: 2rem 1.75rem;
}

.card--hero:hover {
  box-shadow: 0 12px 40px var(--shadow);
}

.contact-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  margin: 1.25rem 0 1rem;
  padding: 0;
  font-size: 0.95rem;
}

.contact-chips a {
  font-weight: 500;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.link-row a {
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid var(--accent-muted);
}

.link-row a:hover {
  border-bottom-color: var(--accent);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.card--skill {
  min-height: 100%;
}

.card--skill-accent {
  background: linear-gradient(
    135deg,
    var(--accent-muted),
    color-mix(in srgb, var(--bg-elevated) 88%, var(--accent-muted))
  );
}

.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card--project {
  display: flex;
  flex-direction: column;
}

.card--project:hover {
  box-shadow: 0 10px 32px var(--shadow);
}

.card--project-shot {
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 5fr);
  align-items: stretch;
  cursor: zoom-in;
}

.card--project-shot a {
  cursor: pointer;
}

.card--project-shot .project-shot {
  margin: 0;
  border-bottom: none;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--fg) 5%, var(--bg));
  display: flex;
  flex-direction: column;
  min-height: 13rem;
}

.card--project-shot .project-shot img {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 13rem;
  object-fit: cover;
  object-position: top center;
}

.card--project-shot .project-shot__body {
  padding: 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

@media (max-width: 42rem) {
  .card--project-shot {
    grid-template-columns: 1fr;
  }

  .card--project-shot .project-shot {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: unset;
  }

  .card--project-shot .project-shot img {
    flex: none;
    height: 11.5rem;
    min-height: 11.5rem;
    width: 100%;
  }
}

.tags {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.bullet-list {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  color: var(--muted);
  flex: 1;
}

.bullet-list li {
  margin-bottom: 0.45rem;
}

.bullet-list li:last-child {
  margin-bottom: 0;
}

.bullet-list strong {
  color: var(--fg);
  font-weight: 600;
}

.card-links {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.card-links a {
  font-weight: 600;
  text-decoration: none;
}

.card-links a:hover {
  text-decoration: underline;
}

.experience-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section--contact .card--contact {
  max-width: 40rem;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  background: var(--accent);
  color: var(--bg-elevated);
  border: 1px solid transparent;
}

.button:hover {
  filter: brightness(1.05);
  color: var(--bg-elevated);
}

.button--ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
}

.button--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  filter: none;
}

/* Reveal on scroll (only when JS enabled — avoids blank page without JS) */
html.js .reveal {
  opacity: 0;
  transform: translateY(12px);
}

html.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
}

@media (prefers-reduced-motion: reduce) {
  html.js .reveal {
    opacity: 1;
    transform: none;
  }

  html.js .reveal.is-visible {
    transition: none;
  }
}

/* Project screenshot lightbox -------------------------------------------- */
.project-lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: min(1.5rem, 4vw);
}

.project-lightbox[hidden] {
  display: none !important;
}

.project-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 14, 13, 0.88);
  cursor: pointer;
}

.project-lightbox__figure {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: min(96vw, 90rem);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.project-lightbox__close {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--fg);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.project-lightbox__close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.project-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: min(88vh, 100%);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  background: var(--bg-elevated);
}

/* Footer ------------------------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 1rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9rem;
}

.site-footer a {
  font-weight: 500;
}
