/* ==========================================================================
   Portfolio — design tokens + layout
   Palette: Color Field / Josef Albers.
   Contrast rules enforced by the tokens below:
     - yellow-on-blue is used ONLY for display type 32px+ (--display)
     - body copy is always plum-on-blue, plum-on-yellow, or yellow-on-plum
   ========================================================================== */

:root {
  /* Raw palette — do not use these directly in rules, use the roles below. */
  --blue:   #52A9CE;
  --yellow: #FFF08C;
  --plum:   #4D0F2D;

  /* Roles (light) */
  --bg:        var(--blue);
  --fg:        var(--plum);    /* body copy on --bg */
  --display:   var(--yellow);  /* 32px+ headings on --bg only */
  --plate-bg:  var(--yellow);  /* avatar backdrop / cards */
  --plate-fg:  var(--plum);
  --block-bg:  var(--plum);    /* deep accent blocks: nav, footer */
  --block-fg:  var(--yellow);
  --block-dim: #c89aae;        /* muted text inside a plum block */
  --rule:      rgba(77, 15, 45, 0.28);
  --focus:     var(--plum);

  /* Scale */
  --measure: 38rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --step: clamp(1.5rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        var(--plum);
    --fg:        var(--yellow);
    --display:   var(--yellow);
    --plate-bg:  var(--yellow);
    --plate-fg:  var(--plum);
    --block-bg:  var(--blue);  /* blue becomes the accent block */
    --block-fg:  var(--plum);
    --block-dim: #1f4a5c;
    --rule:      rgba(255, 240, 140, 0.3);
    --focus:     var(--yellow);
  }
}

/* --------------------------------------------------------------- reset-ish */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter Tight", "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; }
img { height: auto; display: block; }

h1, h2, h3 { margin: 0; font-weight: 300; line-height: 1.05; letter-spacing: 0.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 0; left: 50%;
  transform: translate(-50%, -110%);
  z-index: 50;
  padding: 0.6rem 1.1rem;
  background: var(--block-bg);
  color: var(--block-fg);
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.skip-link:focus-visible { transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ type */

.display {
  color: var(--display);
  font-size: clamp(2rem, 8vw, 4.25rem);   /* floor is 32px — contrast rule */
  text-transform: uppercase;
  font-weight: 200;
  letter-spacing: 0.02em;
}

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 500;
}

.lede { font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem); }

/* ------------------------------------------------------------- homepage */

/* The homepage is one centered composition: title, yellow plate, and the
   accent block that carries both the nav and the footer. Centering the whole
   stack (rather than growing the hero) is what keeps the plate and the block
   touching at every viewport height. */
.home { justify-content: center; }

.hero {
  display: grid;
  place-items: center;
  width: 100%;
  padding: clamp(2rem, 7vh, 4.5rem) var(--gutter) 0;
}

.hero__inner {
  width: min(100%, 48rem);
  text-align: center;
}

/* Full-bleed row so the block can be wider than the plate above it. */
.hero__block-row {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 0 var(--gutter) clamp(2rem, 7vh, 4.5rem);
}

.hero__block-row .block { width: min(100%, 48rem); }

.hero__name { margin-bottom: 0.15em; }

.hero__role {
  color: var(--fg);
  margin-bottom: var(--step);
}

/* The yellow plate: avatar backdrop. Overlaps the plum block below it. */
.plate {
  position: relative;
  z-index: 2;
  width: min(100%, 21rem);
  margin-inline: auto;
  padding: clamp(1.25rem, 4vw, 2rem) clamp(1rem, 4vw, 1.75rem) clamp(1.1rem, 3vw, 1.5rem);
  background: var(--plate-bg);
  color: var(--plate-fg);
}

/* Captions stack in a single grid cell: the container is as tall as the
   longest line, so swapping between them never nudges the layout. */
.plate__caption {
  display: grid;
  margin-top: 0.9rem;
  font-size: 0.9375rem;
  font-style: italic;
  text-wrap: balance;
}

.plate__caption .caption {
  grid-area: 1 / 1;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.plate__caption .caption.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .plate__caption .caption {
    transform: none;
    transition: opacity 120ms ease;
  }
}

/* The plum block, pulled up so the yellow plate sits over its top edge. */
.block {
  position: relative;
  z-index: 1;
  margin-top: clamp(-3.25rem, -8vw, -2rem);
  padding: clamp(4.5rem, 12vw, 6rem) clamp(1.25rem, 4vw, 2.5rem) clamp(2rem, 5vw, 2.75rem);
  background: var(--block-bg);
  color: var(--block-fg);
}

.hero-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  /* Column gap sets the space between tabs. With three items there's plenty
     of room inside the 48rem block; bringing Journal back makes four, and
     past roughly 4rem the last one drops to a second line. */
  gap: clamp(0.75rem, 2.5vw, 2.5rem) clamp(2rem, 6vw, 5.5rem);
}

/* With three items, centring the row as a block still leaves the middle one
   off-axis, because the outer two differ in width — "About" is much shorter
   than "Projects". Equal 1fr columns either side put the middle item on the
   container's centre line, under the avatar. The :has() means this applies
   only at exactly three items and quietly stops when that changes. */
/* 34rem, not narrower: a 1fr column can't shrink below its content, so on a
   tighter viewport the two sides stop being equal and the centring drifts.
   Below this the row simply centres as a block, which is right once it wraps. */
@media (min-width: 34rem) {
  .hero-nav ul:has(> li:nth-child(3):last-child) {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: baseline;
  }
  .hero-nav ul:has(> li:nth-child(3):last-child) > li:first-child { justify-self: end; }
  .hero-nav ul:has(> li:nth-child(3):last-child) > li:last-child  { justify-self: start; }
}

.hero-nav a {
  display: inline-block;
  padding: 0.25rem 0;
  font-size: clamp(1rem, 0.9rem + 0.8vw, 1.375rem);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 300;
  border-bottom: 2px solid transparent;
  transition: border-color 140ms ease;
}
.hero-nav a:hover,
.hero-nav a:focus-visible { border-bottom-color: currentColor; }

@media (prefers-reduced-motion: reduce) {
  /* With three items, centring the row as a block still leaves the middle one
   off-axis, because the outer two differ in width — "About" is much shorter
   than "Projects". Equal 1fr columns either side put the middle item on the
   container's centre line, under the avatar. The :has() means this applies
   only at exactly three items and quietly stops when that changes. */
/* 34rem, not narrower: a 1fr column can't shrink below its content, so on a
   tighter viewport the two sides stop being equal and the centring drifts.
   Below this the row simply centres as a block, which is right once it wraps. */
@media (min-width: 34rem) {
  .hero-nav ul:has(> li:nth-child(3):last-child) {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: baseline;
  }
  .hero-nav ul:has(> li:nth-child(3):last-child) > li:first-child { justify-self: end; }
  .hero-nav ul:has(> li:nth-child(3):last-child) > li:last-child  { justify-self: start; }
}

.hero-nav a { transition: none; }
}

/* Footer content, sharing the block with the nav. */
.hero-meta {
  margin-top: clamp(2rem, 6vw, 3rem);
  padding-top: clamp(1.4rem, 3.5vw, 1.9rem);
  border-top: 1px solid currentColor;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.hero-meta ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.4rem;
}

.hero-meta a {
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
}
.hero-meta a:hover,
.hero-meta a:focus-visible { border-bottom-color: currentColor; }

.hero-meta small {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.75;
}

@media (max-width: 34rem) {
  .hero-meta { justify-content: center; }
}

/* ------------------------------------------------- inner page chrome */

.site-header {
  background: var(--block-bg);
  color: var(--block-fg);
}

.site-header__inner {
  width: min(100%, 64rem);
  margin-inline: auto;
  padding: 1rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.site-header__home {
  font-size: 0.875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
}
.site-header__home:hover,
.site-header__home:focus-visible { border-bottom-color: currentColor; }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 2.5rem;
}

.site-nav a {
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover,
.site-nav a:focus-visible { border-bottom-color: currentColor; }
.site-nav a[aria-current="page"] { border-bottom-color: currentColor; }

.page {
  flex: 1;
  width: min(100%, 64rem);
  margin-inline: auto;
  padding: clamp(2.5rem, 8vh, 5rem) var(--gutter) clamp(3rem, 10vh, 6rem);
}

.page__head { margin-bottom: clamp(2rem, 6vw, 3.5rem); }

/* The gap under a page title is sized for the lede that usually follows it.
   Where the title stands alone, close it up so the heading still belongs to
   the text underneath. */
.page__head--tight { margin-bottom: clamp(1.25rem, 3vw, 1.75rem); }
.page__head .lede {
  max-width: var(--measure);
  margin-top: 1.1rem;
}

/* -------------------------------------------------------- experience */

.roles > li {
  padding: clamp(1.25rem, 4vw, 1.9rem) 0;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 0.35rem 2rem;
  grid-template-columns: 1fr;
}
.roles > li:last-child { border-bottom: 1px solid var(--rule); }

@media (min-width: 46rem) {
  /* Wide enough for the longest range, e.g. "Apr 2026 — Sept 2026". */
  .roles > li { grid-template-columns: 12.5rem 1fr; }
  .role__dates { text-align: right; order: 2; grid-column: 1; grid-row: 1; }
  .role__body { grid-column: 2; grid-row: 1; }
}

.role__company {
  font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.6rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.role__company a {
  border-bottom: 2px solid transparent;
  transition: border-color 140ms ease;
}
.role__company a:hover,
.role__company a:focus-visible { border-bottom-color: currentColor; }

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

.role__title { font-weight: 500; margin-top: 0.1rem; }
.role__dates {
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
  padding-top: 0.4rem;
}
.role__desc { margin-top: 0.5rem; max-width: var(--measure); }

/* ----------------------------------------------------------- projects */

.cards {
  display: grid;
  gap: clamp(1rem, 3vw, 1.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.card {
  background: var(--plate-bg);
  color: var(--plate-fg);
  padding: clamp(1.25rem, 3.5vw, 1.75rem);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.card h3 {
  font-size: clamp(1.1875rem, 1.1rem + 0.5vw, 1.5rem);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Understated line under the title: year, company, or category. */
.card__meta {
  margin-top: -0.3rem;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* The description takes the slack, so a card's link sits at its foot and
   cards in a row stay the same height whether or not they have one. */
.card p { font-size: 0.9375rem; }
.card p:not(.card__meta) { flex: 1; }

.card__link {
  align-self: start;
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 2px solid currentColor;
  padding-bottom: 1px;
}
.card__link:hover, .card__link:focus-visible { border-bottom-color: transparent; }

/* ------------------------------------------------------------- about */

.prose { max-width: var(--measure); display: grid; gap: 1.15rem; }
.prose h2 {
  font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.6rem);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1.25rem;
}

/* A short page needs its sections set further apart than a long one, or the
   whole thing reads as a single block of text. */
.prose--intro { gap: 1.35rem; }
.prose--intro h2 { margin-top: 1.75rem; }
.prose h3, .prose h4 {
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 1rem;
}
.prose a { border-bottom: 1px solid currentColor; }
.prose ul { display: grid; gap: 0.5rem; padding-left: 1.2rem; list-style: disc; }
.prose li { padding-left: 0.2rem; }
.prose blockquote {
  margin: 0;
  padding-left: 1.1rem;
  border-left: 3px solid var(--rule);
  font-style: italic;
}
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 1rem 0; }
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--plate-bg);
  color: var(--plate-fg);
  padding: 0.1em 0.35em;
}
.prose pre {
  background: var(--block-bg);
  color: var(--block-fg);
  padding: 1rem 1.1rem;
  overflow-x: auto;
}
.prose pre code { background: none; color: inherit; padding: 0; }

/* ----------------------------------------------------------- journal */

.posts > li { border-top: 1px solid var(--rule); }
.posts > li:last-child { border-bottom: 1px solid var(--rule); }

.post-link {
  display: grid;
  gap: 0.4rem;
  padding: clamp(1.25rem, 4vw, 1.9rem) 0;
}
.post-link:hover .post-link__title,
.post-link:focus-visible .post-link__title { border-bottom-color: currentColor; }

.post-link__date {
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
}

.post-link__title {
  font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.75rem);
  font-weight: 300;
  letter-spacing: 0.01em;
  border-bottom: 2px solid transparent;
  justify-self: start;
}

.post-link__excerpt { max-width: var(--measure); font-size: 0.9375rem; }

.post__meta {
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 0.9rem;
}

.post__back {
  display: inline-block;
  margin-top: clamp(2.5rem, 7vw, 3.5rem);
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 2px solid currentColor;
}
.post__back:hover, .post__back:focus-visible { border-bottom-color: transparent; }

.empty { opacity: 0.8; font-style: italic; }

/* ------------------------------------------------------------ footer */

.site-footer {
  background: var(--block-bg);
  color: var(--block-fg);
}

.site-footer__inner {
  width: min(100%, 64rem);
  margin-inline: auto;
  padding: clamp(1.5rem, 5vw, 2.25rem) var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.site-footer a {
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
}
.site-footer a:hover,
.site-footer a:focus-visible { border-bottom-color: currentColor; }

.site-footer small {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--block-dim);
}
