/* ==========================================================================
   Alta Nel — portfolio template
   Design tokens & layout system
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Colour */
  --bg:            #fafcfd;
  --fg:            #32404f;
  --primary:       #e65f2e;

  --fg-muted:      rgba(50, 64, 79, 0.58);
  --fg-soft:       rgba(50, 64, 79, 0.40);
  --line:          rgba(50, 64, 79, 0.10);
  --veil:          rgba(250, 252, 253, 0.40); /* card hover wash */

  /* Type
     The reference site sets its display serif in Tiempos Text (Klim, commercial
     licence). Literata is the closest free match — same width, weight and line
     breaks at display sizes. Tiempos Text is listed first in the stack, so if
     you licence it, uncomment the @font-face block below, drop the files into
     assets/fonts/ and it takes over everywhere. Nothing else changes. */
  --serif: "Tiempos Text", "Literata", Georgia, "Times New Roman", serif;
  --sans:  "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono:  "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --step--1: 15px;                                        /* body / mono / meta */
  --step-0:  17px;                                        /* card + caption serif */
  --step-2:  clamp(1.5rem, 1.05rem + 1.4vw, 2rem);        /* 24 → 32  h2 */
  --step-4:  clamp(2.125rem, 1.15rem + 3vw, 3.5rem);      /* 34 → 56  h1 */

  /* Space */
  --gap:      24px;   /* grid gutter + page padding */
  --gap-lg:   48px;
  --nav-h:    64px;
  --shell:    1800px; /* max content width */
  --measure:  62ch;   /* body copy measure */

  /* Motion */
  --ease:     cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast:   200ms;
  --t-base:   300ms;
  --t-slow:   500ms;
}

/* Licensed-font drop-in. Uncomment once the files are in assets/fonts/.
@font-face {
  font-family: "Tiempos Text";
  src: url("fonts/tiempos-text-regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Tiempos Text";
  src: url("fonts/tiempos-text-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
*/

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--step--1);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ul { margin: 0; padding: 0; }

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

::selection { background: rgba(230, 95, 46, 0.18); }

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 400; }

h1, .display {
  font-family: var(--serif);
  font-size: var(--step-4);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 400;
  margin: 0;
}

h2, .h2 {
  font-size: var(--step-2);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.serif-sm {                       /* card titles, figure captions */
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.5;
  letter-spacing: -0.02em;
  font-weight: 400;
}

.mono {
  font-family: var(--mono);
  font-size: var(--step--1);
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-weight: 400;
}

.mono--strong { color: var(--fg); font-weight: 500; }

p { margin: 0; color: var(--fg-muted); }
.prose { max-width: var(--measure); display: flex; flex-direction: column; gap: 16px; }
.prose a { color: var(--primary); transition: opacity var(--t-base) var(--ease); }
.prose a:hover { opacity: 0.7; }
.prose ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.prose li { color: var(--fg-muted); padding-left: 26px; position: relative; }
.prose li::before {
  content: "";
  position: absolute; left: 8px; top: 10px;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--fg-soft);
}

.italic { font-style: italic; }
.text-fg { color: var(--fg); }

/* --------------------------------------------------------------------------
   4. Shell
   -------------------------------------------------------------------------- */
.shell { display: flex; flex-direction: column; min-height: 100vh; }
.page  { flex: 1; padding: var(--gap); display: flex; justify-content: center; }
.inner { width: 100%; max-width: var(--shell); display: flex; flex-direction: column; gap: var(--gap-lg); }

/* --------------------------------------------------------------------------
   5. Nav
   -------------------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 20px var(--gap);
  min-height: var(--nav-h);
  display: flex; justify-content: center; align-items: center;
}
.nav__inner {
  width: 100%; max-width: var(--shell);
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: var(--gap);
}
.nav__brand { display: flex; flex-direction: column; gap: 0; }
.nav__links { display: flex; align-items: center; justify-self: center; gap: 32px; }
.nav__links a { transition: color var(--t-base) var(--ease); }
.nav__links a:hover { color: var(--primary); }
.nav__links a[aria-current="page"] { color: var(--primary); }

.nav__toggle { display: none; justify-self: end; }
.nav__mobile { display: none; }

@media (min-width: 640px) {
  .nav__brand { flex-direction: row; gap: 16px; }
}

@media (max-width: 767px) {
  .nav__links { display: none; }
  .nav__toggle { display: block; }
  .nav__mobile {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--t-base) var(--ease);
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    position: sticky; top: var(--nav-h); z-index: 49;
  }
  .nav__mobile > div { overflow: hidden; }
  .nav__mobile[data-open="true"] { grid-template-rows: 1fr; }
  .nav__mobile ul { display: flex; flex-direction: column; }
  .nav__mobile a { display: block; padding: 12px var(--gap); }
  .nav__mobile a[aria-current="page"] { color: var(--primary); }
}

/* --------------------------------------------------------------------------
   6. Footer
   -------------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 20px var(--gap);
  display: flex; justify-content: center;
}
.footer__inner {
  width: 100%; max-width: var(--shell);
  display: flex; flex-wrap: wrap; gap: 16px 32px;
  align-items: center; justify-content: space-between;
}
.footer__links { display: flex; flex-wrap: wrap; gap: 32px; }
.footer__links a { transition: color var(--t-base) var(--ease); }
.footer__links a:hover { color: var(--primary); }
.heart { color: var(--primary); }

/* --------------------------------------------------------------------------
   7. Hero (Work / Fun / About)
   -------------------------------------------------------------------------- */
.hero {
  display: grid; grid-template-columns: 1fr;
  gap: var(--gap-lg);
  padding: 32px 0;
  width: 100%;
}
.hero h1 { max-width: 700px; }
.hero__aside { display: flex; flex-direction: column; justify-content: flex-end; }

@media (min-width: 1024px) {
  .hero { grid-template-columns: 1fr 1fr; gap: var(--gap); padding-top: 26vh; }
}

/* Experience list */
.exp { display: flex; flex-direction: column; gap: 12px; }
.exp__row { display: flex; gap: 8px; }
.exp__year { width: 104px; min-width: 104px; }
.exp__pair { display: flex; flex-direction: column; gap: 2px; }
.exp__org { width: 224px; min-width: 224px; color: var(--fg); }

@media (min-width: 1024px) {
  .exp { gap: 4px; }
  .exp__pair { flex-direction: row; }
}

/* --------------------------------------------------------------------------
   8. Project grid + cards
   -------------------------------------------------------------------------- */
.grid { display: grid; grid-template-columns: 1fr; gap: var(--gap); width: 100%; }
.grid__col { display: flex; flex-direction: column; gap: var(--gap); }

@media (min-width: 1024px) { .grid--2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 768px)  { .grid--3 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .grid--3 { grid-template-columns: 1fr 1fr 1fr; } }

.card { display: block; }
.card__media {
  position: relative; width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  overflow: hidden;
  background: rgba(50, 64, 79, 0.03);
}
.card__media > img,
.card__media > video {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease);
}
.card__media > img.is-loaded,
.card__media > video.is-loaded { opacity: 1; }

.card__veil {
  position: absolute; inset: 0;
  background: var(--veil);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base) var(--ease);
}
.card:hover .card__veil,
.card:focus-visible .card__veil { opacity: 1; }
.card:focus-visible { outline: 1px solid var(--primary); outline-offset: 4px; }

.card__text {
  display: flex; flex-direction: column; gap: 2px;
  margin-top: 4px;
}
.card__text--row { }

@media (min-width: 1024px) {
  .card__text--row { flex-direction: row; justify-content: space-between; align-items: baseline; gap: 16px; }
}

/* aspect-ratio helpers, matching the reference rhythm */
.ar-16-9  { aspect-ratio: 16 / 9; }
.ar-8-5   { aspect-ratio: 8 / 5; }
.ar-10-7  { aspect-ratio: 10 / 7; }
.ar-4-5   { aspect-ratio: 4 / 5; }
.ar-1-1   { aspect-ratio: 1 / 1; }
.ar-3-4   { aspect-ratio: 3 / 4; }

/* --------------------------------------------------------------------------
   9. About — numbered gallery sections
   -------------------------------------------------------------------------- */
.section-label { margin-bottom: 12px; }
.gallery { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 640px)  { .gallery { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .gallery { grid-template-columns: 1fr 1fr 1fr; } }
.gallery__col { display: flex; flex-direction: column; gap: var(--gap); }
.frame { border: 1px solid var(--line); overflow: hidden; background: rgba(50, 64, 79, 0.03); }
.frame > img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--t-slow) var(--ease); }
.frame--empty { display: flex; align-items: center; justify-content: center; background: rgba(50, 64, 79, 0.04); }
.frame > img.is-loaded { opacity: 1; }

.about-split { display: grid; grid-template-columns: 1fr; gap: var(--gap-lg); }
@media (min-width: 1024px) { .about-split { grid-template-columns: 1fr 1fr; gap: var(--gap); } }

/* --------------------------------------------------------------------------
   10. Case study
   -------------------------------------------------------------------------- */
.cs { display: grid; grid-template-columns: 1fr; gap: var(--gap-lg); width: 100%; }

@media (min-width: 1024px) {
  .cs { grid-template-columns: 300px minmax(0, 660px) 1fr; gap: 0 80px; }
}

.cs__side { display: flex; flex-direction: column; gap: 32px; }
.cs__back { display: inline-flex; align-items: center; gap: 10px; transition: color var(--t-base) var(--ease); }
.cs__back:hover { color: var(--primary); }
.cs__back svg { width: 15px; height: 15px; }
.cs__toc { display: flex; flex-direction: column; gap: 8px; }
.cs__toc a { color: var(--fg-muted); transition: color var(--t-base) var(--ease); }
.cs__toc a:hover { color: var(--primary); }
.cs__toc a.is-active { color: var(--fg); }

@media (min-width: 1024px) {
  .cs__side { position: sticky; top: calc(var(--nav-h) + var(--gap)); align-self: start; max-height: calc(100vh - var(--nav-h) - var(--gap) * 2); }
}

.cs__body { display: flex; flex-direction: column; gap: 64px; min-width: 0; }
.cs__head { display: flex; flex-direction: column; gap: 8px; }

/* fact row: ROLE / TIMELINE / TEAM / SKILLS */
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (min-width: 768px) { .facts { grid-template-columns: repeat(4, 1fr); } }
.facts__item { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 768px) { .facts__item--wide { grid-column: span 2; } }
.facts__item p { color: rgba(50, 64, 79, 0.72); }

.cs-section { display: flex; flex-direction: column; gap: 16px; scroll-margin-top: calc(var(--nav-h) + 32px); }
.cs-section h2 { margin-bottom: 4px; }

/* media + side caption */
.figure { display: flex; flex-direction: column; gap: 12px; }
.figure__cap { color: var(--fg); }
.figure--side { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: center; }
@media (min-width: 768px) { .figure--side { grid-template-columns: 1fr 1fr; gap: var(--gap); } }

/* stat lead-in: bold statement with an emphasised figure */
.stat-lead { max-width: var(--measure); color: var(--fg); font-weight: 600; line-height: 1.5; }
.stat-lead .stat-num { color: var(--primary); font-family: var(--serif); font-weight: 600; font-size: 1.3em; }

/* paired challenge callouts, each with an icon + heading */
.challenges { display: grid; grid-template-columns: 1fr; gap: 28px; max-width: var(--measure); }
@media (min-width: 640px) { .challenges { grid-template-columns: 1fr 1fr; max-width: none; gap: var(--gap-lg); } }
.challenge { display: flex; flex-direction: column; gap: 14px; padding-left: 20px; border-left: 1px solid var(--line); }
.challenge__icon {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--fg); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.challenge__icon svg { width: 16px; height: 16px; }
.challenge__head { display: flex; align-items: center; gap: 14px; }
.challenge__head h3 { font-family: var(--sans); font-weight: 600; color: var(--fg); font-size: var(--step-0); margin: 0; }
.challenge p { margin: 0; }

/* highlighted takeaway box */
.callout { background: rgba(50, 64, 79, 0.04); border: 1px solid var(--line); padding: 20px 24px; }
.callout p { color: var(--fg); font-weight: 600; margin: 0; }

.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* --------------------------------------------------------------------------
   11. Motion — page transition + scroll reveal
   -------------------------------------------------------------------------- */
body { opacity: 1; transition: opacity 260ms var(--ease); }
body.is-entering,
body.is-leaving { opacity: 0; }

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   12. Utilities
   -------------------------------------------------------------------------- */
.stack { display: flex; flex-direction: column; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: var(--gap); }
.gap-48 { gap: var(--gap-lg); }
.w-full { width: 100%; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
