:root {
  --bg: #3a4536;
  --text: #ffffff;
  --gold: #e2a64b;
  --gold-soft: #e8c07d;
  --ink: #1d2219;
  --muted: rgba(255, 255, 255, 0.72);

  --serif: "Cormorant Garamond", "EB Garamond", Garamond, "Times New Roman", serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;

  --gutter: clamp(16px, 2.1vw, 30px);
  --header-h: 76px;
  --section-pad: clamp(24px, 5svh, 48px);
  --card-gap: 20px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.25rem;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

a { color: inherit; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--gold);
  color: var(--ink);
  padding: 8px 14px;
  z-index: 10;
}
.skip-link:focus { top: 12px; }

/* Header ------------------------------------------------------------ */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 24px;
  min-height: var(--header-h);
  padding: 0 var(--gutter);
}

.site-title {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.site-nav { display: flex; gap: 20px; flex-wrap: wrap; }

.site-nav a {
  font-size: 1.5rem;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.2s ease;
}
.site-nav a:hover { text-decoration-color: currentColor; }

/* Full-screen sections ---------------------------------------------- */
/* Each section is exactly one screen tall, so a nav jump shows all of it. */

.screen {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--section-pad) 0;
}

/* Hero -------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px 5vw;
  min-height: max(520px, calc(100svh - var(--header-h)));
  padding: 8px var(--gutter) var(--section-pad);
}

.hero-text {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
}

.hero-email {
  align-self: flex-start;
  font-family: var(--serif);
  font-size: clamp(1.5rem, min(2.8vw, 5svh), 2.4rem);
  line-height: 1.2;
  text-decoration: none;
}
.hero-email:hover { color: var(--gold); }

.hero-heading {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--gold);
  font-size: clamp(3.5rem, min(12.5vw, 19svh), 12.5rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0;
}

.hero-intro { max-width: 36rem; font-size: clamp(1.1rem, min(1.9vw, 2.8svh), 1.75rem); }
.hero-intro p { margin: 0.75em 0 0; }

.hero-photo {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: #908f9c;
}
.hero-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 56% 20%;
  transition: transform 0.8s ease;
}
.hero-photo:hover img { transform: scale(1.015); }

.hero-line { display: inline-block; }

/* Motion ------------------------------------------------------------ */

@keyframes rise {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}

.js .hero-line {
  opacity: 0;
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.js .hero-line:nth-child(2) { animation-delay: 0.15s; }

.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--delay, 0s);
}
.js .reveal.is-visible { opacity: 1; transform: none; }
.hero-photo { --delay: 0.15s; }
.hero-intro { --delay: 0.35s; }

@media (prefers-reduced-motion: reduce) {
  .js .hero-line,
  .js .reveal { opacity: 1; transform: none; animation: none; transition: none; }
}

/* Section headings -------------------------------------------------- */

.section-heading {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.25rem, min(3.4vw, 6.5svh), 3rem);
  line-height: 1.1;
  margin: 0 0 clamp(18px, 4svh, 48px);
  padding: 0 var(--gutter);
}

/* Projects ---------------------------------------------------------- */

.projects {
  --card-w: clamp(260px, 30vw, 430px);
  /* Image height gives way to the text below it so the whole card fits on screen. */
  --img-h: clamp(170px, min(var(--card-w), calc(100svh - 430px)), 430px);
}

.carousel { position: relative; }

.carousel-track {
  list-style: none;
  margin: 0;
  padding: 6px var(--gutter) 8px;
  display: flex;
  gap: var(--card-gap);
  overflow-x: auto;
  overflow-y: hidden; /* sideways only, so the mouse wheel scrolls the page */
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--gutter);
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }

.project-card {
  flex: 0 0 var(--card-w);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
}

.project-image {
  display: block;
  height: var(--img-h);
  overflow: hidden;
  background: #fbfaf7;
}
.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.4s ease;
}
.project-image--center img { object-position: center; }
.project-image:hover img { transform: scale(1.02); }

.project-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.6rem;
  line-height: 1.15;
  margin: clamp(14px, 2.6svh, 28px) 0 clamp(8px, 1.6svh, 16px);
}

.project-desc { font-size: 1.05rem; margin: 0 0 10px; max-width: 24rem; }

.project-tags {
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin: 0 0 clamp(14px, 2.6svh, 28px);
}

.project-links {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 22px;
}

.button {
  display: inline-block;
  background: var(--gold);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.05rem;
  padding: 12px 25px;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.button:hover { background: var(--gold-soft); transform: translateY(-2px); }

.text-link {
  font-size: 1rem;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.text-link:hover { color: var(--gold); }

.carousel-arrow {
  position: absolute;
  top: calc(6px + var(--img-h) / 2);
  transform: translateY(-50%);
  z-index: 2;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 0;
  background: var(--gold-soft);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}
.carousel-arrow:hover { background: var(--gold); }
.carousel-arrow--prev:hover svg { transform: translateX(-3px); }
.carousel-arrow--next:hover svg { transform: translateX(3px); }
.carousel-arrow svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  transition: transform 0.2s ease;
}
.carousel-arrow--prev { left: calc(var(--gutter) + 42px); }
.carousel-arrow--next { right: calc(var(--gutter) + 42px); }
.carousel-arrow[disabled] { opacity: 0; pointer-events: none; }

/* Hobbies ----------------------------------------------------------- */

.hobby-grid {
  /* Portrait 3:4 photos. Height is the smaller of what the column allows and
     what the screen allows (leaving room for the heading and text). */
  --hobby-gap: clamp(20px, 4vw, 64px);
  --hobby-h: clamp(220px, min((100vw - 2 * var(--gutter) - 2 * var(--hobby-gap)) * 4 / 9, calc(100svh - 390px)), 600px);
  --hobby-w: calc(var(--hobby-h) * 0.75);
  display: grid;
  grid-template-columns: repeat(3, var(--hobby-w));
  justify-content: space-between;
  gap: var(--hobby-gap);
  padding: 0 var(--gutter);
}

.hobby-image {
  width: var(--hobby-w);
  height: var(--hobby-h);
  display: block;
  overflow: hidden;
  background: #4a5646;
}
.hobby-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.hobby-image:hover img { transform: scale(1.02); }

.hobby-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.6rem;
  line-height: 1.15;
  margin: clamp(14px, 2.6svh, 24px) 0 clamp(8px, 1.4svh, 14px);
}

.hobby-desc { font-size: 1.05rem; margin: 0; max-width: 26rem; }

.hobby-link { display: inline-block; margin-top: 12px; }

/* Footer ------------------------------------------------------------ */

.site-footer { padding: clamp(48px, 10svh, 120px) var(--gutter) 40px; }

.footer-name { font-size: clamp(2.25rem, 3.4vw, 3rem); margin: 0 0 20px; }

.footer-links { font-size: 1.6rem; margin: 0 0 48px; }
.footer-links a {
  color: var(--gold);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}
.footer-links a:hover { color: var(--gold-soft); }

.footer-note { font-size: 1rem; margin: 0; color: var(--muted); }

/* Small screens ----------------------------------------------------- */

@media (max-width: 760px) {
  :root { --header-h: 88px; }
  .site-header { align-content: center; }
  .site-nav a { font-size: 1.15rem; }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 20px;
    height: auto;
    min-height: calc(100svh - var(--header-h));
    padding-top: 0;
  }
  .hero-photo { order: -1; min-height: 30svh; }
  .hero-text { justify-content: flex-start; }
  .hero-heading { font-size: clamp(3rem, min(16vw, 9svh), 5rem); margin: 10px 0 8px; }

  .projects { --card-w: 82vw; }
  .carousel-arrow { width: 48px; height: 48px; }
  .carousel-arrow--prev { left: calc(var(--gutter) + 12px); }
  .carousel-arrow--next { right: calc(var(--gutter) + 12px); }

  /* Hobbies become a swipeable row, like the projects. */
  .hobby-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: var(--hobby-w);
    justify-content: start;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-left: var(--gutter);
    scrollbar-width: none;
  }
  .hobby-grid::-webkit-scrollbar { display: none; }
  .hobby { scroll-snap-align: start; }
  .hobby-grid { --hobby-h: clamp(240px, min(82vw * 4 / 3, calc(100svh - 360px)), 480px); }
}
