/* ---------- Tokens ---------- */
:root {
  --bg: #fff;
  --ink: #111;
  --muted: #767676;
  --hair: #e6e6e6;
  --font: "Schibsted Grotesk", -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --margin: 24px;
  --gutter: 16px;
  --max: 1680px;
}

@media (min-width: 800px) {
  :root {
    --margin: 40px;
    --gutter: 24px;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

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

/* ---------- Grid: 12 columns, label rail (1-3) + content (5-12) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  padding-left: var(--margin);
  padding-right: var(--margin);
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
}
.rail { grid-column: 1 / -1; }
.content { grid-column: 1 / -1; }

@media (min-width: 800px) {
  .rail { grid-column: 1 / span 3; }
  .content { grid-column: 5 / -1; }
}

.section {
  padding-top: 72px;
  padding-bottom: 72px;
  border-top: 1px solid var(--hair);
}
@media (min-width: 800px) {
  .section { padding-top: 96px; padding-bottom: 96px; }
}
.section .rail { margin-bottom: 24px; }

/* ---------- Type ---------- */
.label {
  display: block;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted);
}
.label + .value { margin-top: 2px; }
.value { display: block; font-size: 0.9rem; }

.display {
  font-weight: 500;
  font-size: clamp(2.4rem, 6.2vw, 6.25rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}
.display .muted { color: var(--muted); }

h2.title {
  font-weight: 500;
  font-size: clamp(1.9rem, 3.6vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.lead {
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.3;
  letter-spacing: -0.015em;
}
.prose p + p { margin-top: 1em; }
.prose { max-width: 62ch; }

.link-arrow {
  display: inline-block;
  border-bottom: 1px solid currentColor;
  line-height: 1.2;
}

/* ---------- Header / nav ---------- */
.site-header {
  padding-top: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--hair);
  align-items: baseline;
  position: relative;
  z-index: 5;
}
.logo {
  grid-column: 1 / span 6;
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.site-nav {
  display: flex;
  gap: 18px;
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 12px;
  font-size: 0.9rem;
}
.site-nav a { color: var(--muted); transition: color 0.2s ease; }
.site-nav a:hover,
.site-nav a[aria-current="true"] { color: var(--ink); }
.clock {
  grid-column: 7 / -1;
  justify-self: end;
  font-size: 0.8rem;
  color: var(--muted);
}
.clock:empty { display: none; }

@media (min-width: 800px) {
  /* Logo, nav and clock share one row; the nav spans every column and is centered on the page */
  .logo { grid-column: 1 / span 4; grid-row: 1; }
  .site-nav {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
    margin-top: 0;
    gap: 20px;
  }
  .clock { grid-column: 9 / -1; grid-row: 1; }
}

/* ---------- Hero ---------- */
.hero-copy {
  padding-top: 64px;
  padding-bottom: 56px;
}
.hero-copy .display { grid-column: 1 / -1; max-width: 21ch; }
.hero-sub { color: var(--muted); margin-top: 28px; }
@media (min-width: 800px) {
  .hero-copy { padding-top: 96px; padding-bottom: 80px; }
  .hero-sub { margin-top: 40px; }
}
.hero-image {
  padding-bottom: 12px;
}
.hero-image img {
  grid-column: 1 / -1;
  width: 100%;
  height: 56vh;
  min-height: 280px;
  object-fit: cover;
}

/* ---------- Intro ---------- */
.intro .prose p { font-size: clamp(1.1rem, 1.5vw, 1.35rem); line-height: 1.45; letter-spacing: -0.01em; }
.intro-status { margin-top: 2em; color: var(--muted); }

/* ---------- Work list: one row per project ----------
   Wide:   1. number, company, year   2. title, blurb, link   3. thumbnail
   Medium: text (meta on top) | thumbnail
   Small:  thumbnail on top, then text
   The thumbnail width is continuous across all sizes (312px at 800px wide,
   about 400px at 1100px, about 520px at 1440px) so it never jumps. */
.work-grid {
  grid-column: 1 / -1;
  display: block;
  border-top: 1px solid var(--ink);
}
.work-card {
  display: block;
  max-width: 360px;
  padding: 32px 0;
  border-bottom: 1px solid var(--hair);
  transition: opacity 0.25s ease;
}
.work-card:last-child { border-bottom: 0; }
.wc-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f2f2f2;
}
.wc-meta {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--muted);
}
.wc-title {
  margin-top: 6px;
  font-weight: 500;
  font-size: clamp(1.4rem, 2.4vw, 2.3rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
}
.wc-blurb {
  margin-top: 10px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #595959;
}
.wc-cta { display: inline-block; margin-top: 14px; font-size: 0.85rem; }
.work-card.is-muted .wc-cta { color: var(--muted); }

/* Medium: text on the left, thumbnail on the right */
@media (min-width: 700px) {
  .work-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 312px;
    grid-template-rows: auto auto auto 1fr;
    column-gap: var(--gutter);
    align-items: start;
    max-width: none;
  }
  .wc-meta { grid-column: 1; grid-row: 1; margin-top: 0; }
  .wc-title { grid-column: 1; grid-row: 2; }
  .wc-blurb { grid-column: 1; grid-row: 3; }
  .wc-cta { grid-column: 1; grid-row: 4; align-self: end; justify-self: start; }
  .wc-thumb { grid-column: 2; grid-row: 1 / -1; }
}

/* Wide: company and year get their own column */
@media (min-width: 800px) {
  .work-card {
    grid-template-columns:
      minmax(96px, min(calc((100vw - 80px) / 3 - 16px), calc(100vw - 428px - clamp(312px, 36vw, 624px)), 517px))
      minmax(260px, 1fr)
      clamp(312px, 36vw, 624px);
    grid-template-rows: auto auto 1fr;
    column-gap: 24px;
    row-gap: 12px;
  }
  .wc-meta { grid-column: 1; grid-row: 1; flex-direction: column; gap: 4px; margin-top: 6px; }
  .wc-title { grid-column: 2; grid-row: 1; margin-top: 0; }
  .wc-blurb { grid-column: 2; grid-row: 2; margin-top: 0; }
  .wc-cta { grid-column: 2; grid-row: 3; margin-top: 0; }
  .wc-thumb { grid-column: 3; grid-row: 1 / -1; }
}

/* Mouse users: fade the other rows so the one under the cursor stands out */
@media (hover: hover) {
  .work-grid:hover .work-card { opacity: 0.5; }
  .work-grid .work-card:hover,
  .work-grid .work-card:focus-visible { opacity: 1; }
}

/* ---------- Experience ---------- */
.exp-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hair);
}
.exp-row:first-child { padding-top: 0; }
.exp-years { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.exp-co { font-weight: 500; font-size: 1.15rem; letter-spacing: -0.015em; }
.exp-role { font-size: 0.9rem; color: var(--muted); }
@media (min-width: 800px) {
  .exp-row { grid-template-columns: 1.1fr 1.4fr 1fr; align-items: baseline; }
}

.other-works .lead { margin-bottom: 0.4em; }

/* ---------- About ---------- */
.about-photo { grid-column: 1 / -1; margin-bottom: 32px; }
.about-photo img { width: 100%; max-width: 360px; aspect-ratio: 4 / 5; object-fit: cover; }
.about-copy { grid-column: 1 / -1; }
.about-copy h2.title { margin-bottom: 28px; max-width: 18ch; }
.about-skills { grid-column: 1 / -1; margin-top: 40px; }
.about-skills li { font-size: 0.95rem; padding: 6px 0; border-bottom: 1px solid var(--hair); }
.about-skills li:first-child { border-top: 1px solid var(--hair); }
.about-skills .label { margin-bottom: 8px; }
@media (min-width: 800px) {
  .about-photo { grid-column: 1 / span 3; margin-bottom: 0; }
  .about-copy { grid-column: 5 / span 5; }
  .about-skills { grid-column: 10 / -1; margin-top: 0; }
}

/* ---------- Contact / footer ---------- */
.contact-links a {
  display: block;
  font-weight: 500;
  font-size: clamp(1.6rem, 4vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  word-break: break-word;
}
.contact-links a + a { margin-top: 6px; }
.contact-links a:hover { color: var(--muted); }

.site-footer { border-top: 1px solid var(--hair); padding-top: 28px; padding-bottom: 28px; }
.footer-col { grid-column: span 6; margin-bottom: 20px; }
.copyright { grid-column: 1 / -1; font-size: 0.8rem; color: var(--muted); }
@media (min-width: 800px) {
  .footer-col { grid-column: span 3; margin-bottom: 0; }
  .footer-col:first-child { grid-column: 1 / span 3; }
  .footer-col:nth-child(2) { grid-column: 5 / span 3; }
  .copyright { grid-column: 10 / -1; text-align: right; }
}

/* ---------- Scroll reveal (only when JS is on) ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .work-card, .site-nav a { transition: none; }
}
