/* ==========================================================
   Ainhoa Lasheras — portfolio
   One stylesheet for every page. Edit the tokens first.
   ========================================================== */

:root {
  /* Colour */
  --paper: #E4E7E1;      /* sage-grey page */
  --surface: #F1F3EF;    /* raised panels */
  --ink: #17231E;        /* green-black text */
  --muted: #56635B;      /* secondary text */
  --line: #C2C9C0;       /* rules */
  --lilac: #B9A6F5;      /* the one accent */
  --on-lilac: #17231E;

  /* Type */
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;

  /* Layout */
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --max: 90rem;
  --ease: cubic-bezier(.2, .7, .1, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111915;
    --surface: #19231E;
    --ink: #E2E6DF;
    --muted: #9BA79F;
    --line: #2D3A33;
    --lilac: #A893F0;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 2px; }
::selection { background: var(--lilac); color: var(--on-lilac); }

.skip {
  position: absolute; left: -9999px; top: 1rem; z-index: 100;
  background: var(--ink); color: var(--paper); padding: .6rem 1rem; text-decoration: none;
}
.skip:focus { left: 1rem; }

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
}

/* ---------- Header ---------- */
.site-header {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-block: 1.5rem;
}
.mark {
  font-family: var(--serif); font-style: italic; font-size: 1.5rem;
  text-decoration: none; letter-spacing: -.01em;
}
.nav { display: flex; gap: clamp(1rem, 3vw, 2rem); }
.nav a { text-decoration: none; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .35em;
}

/* ---------- Hero ---------- */
.hero { padding-block: clamp(3rem, 9vw, 7.5rem) clamp(3rem, 8vw, 6rem); }
.hero h1 {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3rem, 10vw, 10rem);
  line-height: .92;
  letter-spacing: -.035em;
  font-variation-settings: "opsz" 72;
}
.hero h1 .line { display: block; overflow: hidden; padding-block: .1em .06em; margin-block: -.1em 0; }
.hero h1 .line > span { display: block; }
.hero h1 .indent { padding-left: 1.2em; }

.hero-intro {
  grid-column: 1 / span 5;
  margin-top: clamp(2rem, 5vw, 4rem);
  max-width: 36ch;
  font-size: 1.125rem;
}
.hero-intro p { color: var(--muted); }
.hero-intro p:first-child { color: var(--ink); }

/* The one orchestrated moment: headline rises, then a notification lands.
   It's a nod to the CRM work — a message arriving at the right time. */
.notif {
  grid-column: 8 / -1;
  align-self: end;
  justify-self: end;
  width: min(100%, 23rem);
  margin-top: clamp(2rem, 5vw, 4rem);
  background: var(--surface);
  border-radius: 1.1rem;
  padding: 1rem 1.1rem 1.05rem;
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -22px rgba(23, 35, 30, .45);
  text-decoration: none;
  display: block;
  transition: transform .3s var(--ease);
}
.notif:hover { transform: translateY(-3px); }
.notif-head {
  display: flex; align-items: center; gap: .55rem;
  font-size: .8rem; color: var(--muted); margin-bottom: .35rem;
}
.notif-icon {
  width: 1.4rem; height: 1.4rem; border-radius: .4rem;
  background: var(--lilac); color: var(--on-lilac);
  display: grid; place-items: center;
  font-family: var(--serif); font-style: italic; font-size: .9rem;
}
.notif-time { margin-left: auto; }
.notif strong { display: block; font-weight: 600; font-size: 1rem; }
.notif span.notif-body { color: var(--muted); font-size: .95rem; }

@media (prefers-reduced-motion: no-preference) {
  .hero h1 .line > span { transform: translateY(108%); animation: rise 1s var(--ease) forwards; }
  .hero h1 .line:nth-child(2) > span { animation-delay: .1s; }
  .hero h1 .line:nth-child(3) > span { animation-delay: .2s; }
  .hero-intro { opacity: 0; animation: fade .8s ease .55s forwards; }
  .notif { opacity: 0; transform: translateY(-14px) scale(.98); animation: land .7s var(--ease) 1.3s forwards; }
}
@keyframes rise { to { transform: translateY(0); } }
@keyframes fade { to { opacity: 1; } }
@keyframes land { to { opacity: 1; transform: none; } }

/* ---------- Section titles ---------- */
.section { padding-block: clamp(3rem, 8vw, 6rem); }
.section-title {
  font-family: var(--sans); font-weight: 500; font-size: 1rem;
  margin: 0 0 1.5rem; color: var(--muted);
}

/* ---------- Work index ---------- */
.index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.index li { border-bottom: 1px solid var(--line); }
.index a {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr) 5rem;
  gap: var(--gutter);
  align-items: baseline;
  padding-block: clamp(1.25rem, 3vw, 2.25rem);
  text-decoration: none;
  transition: opacity .25s ease;
}
.index-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.75rem, 4.2vw, 3.6rem);
  line-height: 1.02; letter-spacing: -.02em;
}
.index-meta { color: var(--muted); font-size: .95rem; }
.index-year { color: var(--muted); font-size: .95rem; font-variant-numeric: tabular-nums; text-align: right; }
@media (hover: hover) {
  .index:hover a:not(:hover) { opacity: .32; }
  .index a:focus-visible { outline-offset: -2px; }
}

/* Cursor-following preview (desktop only, set up in main.js) */
.preview {
  position: fixed; top: 0; left: 0; z-index: 50;
  width: clamp(16rem, 24vw, 24rem); aspect-ratio: 4 / 3;
  pointer-events: none;
  border-radius: .5rem; overflow: hidden;
  opacity: 0; transform: translate(-50%, -50%) scale(.92);
  transition: opacity .25s ease;
}
.preview.is-on { opacity: 1; }
.preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Placeholders (delete once real images are in) ---------- */
.ph {
  background: var(--ph, var(--surface));
  color: var(--ink);
  display: grid; place-items: end start;
  padding: 1rem;
  font-size: .85rem;
  aspect-ratio: var(--ratio, 4 / 3);
  border-radius: .5rem;
}
.preview .ph { height: 100%; border-radius: 0; color: var(--on-lilac); }

/* ---------- Visual work ---------- */
.visual-grid {
  display: grid; gap: var(--gutter);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
}
.visual-grid figure { margin: 0; }
.visual-grid figcaption { margin-top: .6rem; font-size: .9rem; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--ink); padding-block: clamp(3rem, 8vw, 6rem) 2rem; }
.say-hello {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(1.6rem, 7vw, 6.5rem);
  line-height: 1; letter-spacing: -.03em;
  text-decoration: none; display: inline-block;
  background-image: linear-gradient(var(--lilac), var(--lilac));
  background-size: 0% .12em; background-position: 0 92%; background-repeat: no-repeat;
  transition: background-size .5s var(--ease);
  overflow-wrap: anywhere;
}
.say-hello:hover, .say-hello:focus-visible { background-size: 100% .12em; }
.footer-meta {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
  margin-top: clamp(3rem, 6vw, 5rem); font-size: .9rem; color: var(--muted);
}
.footer-meta ul { list-style: none; display: flex; gap: 1.5rem; margin: 0; padding: 0; }

/* ==========================================================
   Case study
   ========================================================== */
.cs-head { padding-block: clamp(3rem, 8vw, 6rem) clamp(2rem, 5vw, 3.5rem); }
.cs-head h1 {
  grid-column: 1 / span 10;
  margin: 0 0 1.5rem;
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.5rem, 6.5vw, 6rem);
  line-height: .98; letter-spacing: -.03em;
}
.cs-summary { grid-column: 1 / span 6; font-size: 1.25rem; max-width: 40ch; }
.cs-facts {
  grid-column: 8 / -1; margin: 0;
  display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.5rem;
  align-self: end; font-size: .95rem;
}
.cs-facts dt { color: var(--muted); }
.cs-facts dd { margin: 0; }

.cs-hero-img { margin-block: 0 clamp(3rem, 7vw, 5rem); }

.cs-body { align-items: start; padding-bottom: clamp(3rem, 8vw, 6rem); }
.toc {
  grid-column: 1 / span 3;
  position: sticky; top: 2rem;
  font-size: .95rem;
}
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a {
  display: block; padding: .3rem 0 .3rem 1rem; margin-left: -1px;
  text-decoration: none; color: var(--muted);
  border-left: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.toc a:hover { color: var(--ink); }
.toc a.is-active { color: var(--ink); border-left-color: var(--ink); }

.cs-content { grid-column: 4 / span 8; }
.cs-content section { padding-bottom: clamp(2.5rem, 6vw, 4.5rem); scroll-margin-top: 2rem; }
.cs-content h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  letter-spacing: -.015em; line-height: 1.1;
  margin: 0 0 1.25rem;
}
.cs-content p, .cs-content ul { max-width: 64ch; }
.cs-content ul { padding-left: 1.1rem; }
.cs-content li { margin-bottom: .4rem; }
.cs-content figure { margin: 2rem 0; }
.cs-content figcaption { margin-top: .6rem; font-size: .9rem; color: var(--muted); max-width: 60ch; }
.figure-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.pull {
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: clamp(1.6rem, 3.2vw, 2.6rem); line-height: 1.15; letter-spacing: -.01em;
  margin: 2.5rem 0; max-width: 26ch;
}

.results { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; margin: 2rem 0; }
.result { border-top: 1px solid var(--ink); padding-top: .9rem; }
.result-figure {
  display: block; font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.25rem, 4vw, 3.25rem); line-height: 1; margin-bottom: .4rem;
}
.result-label { color: var(--muted); font-size: .95rem; }

.note {
  background: var(--surface); border-radius: .6rem;
  padding: 1.1rem 1.25rem; font-size: .95rem; max-width: 64ch;
}
.note strong { font-weight: 600; }

.next {
  display: block; text-decoration: none; border-top: 1px solid var(--ink);
  padding-block: clamp(2rem, 5vw, 3.5rem);
}
.next span { color: var(--muted); font-size: .95rem; }
.next strong {
  display: block; font-family: var(--serif); font-weight: 300;
  font-size: clamp(2rem, 5vw, 4.5rem); letter-spacing: -.025em; line-height: 1;
  margin-top: .4rem;
}

/* ==========================================================
   About
   ========================================================== */
.about { padding-block: clamp(3rem, 8vw, 6rem); align-items: start; }
.about h1 {
  grid-column: 1 / span 8;
  margin: 0 0 clamp(2rem, 5vw, 3.5rem);
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.5rem, 6vw, 5.5rem); line-height: 1; letter-spacing: -.03em;
}
.about-portrait { grid-column: 1 / span 4; }
.about-text { grid-column: 6 / span 6; font-size: 1.125rem; }
.about-text h2 { font-family: var(--sans); font-weight: 500; font-size: 1rem; color: var(--muted); margin: 2.5rem 0 .75rem; }
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); font-size: 1rem; }
.timeline li {
  display: grid; grid-template-columns: 7rem 1fr; gap: 1rem;
  padding-block: .8rem; border-bottom: 1px solid var(--line);
}
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; }
.button {
  display: inline-block; margin-top: 2rem;
  background: var(--ink); color: var(--paper);
  padding: .8rem 1.3rem; border-radius: 999px; text-decoration: none; font-size: .95rem;
  transition: background .2s ease, color .2s ease;
}
.button:hover { background: var(--lilac); color: var(--on-lilac); }

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 900px) {
  .hero-intro, .notif { grid-column: 1 / -1; justify-self: start; }
  .cs-head h1, .cs-summary, .cs-facts { grid-column: 1 / -1; }
  .cs-facts { margin-top: 2rem; }
  .toc { display: none; }
  .cs-content { grid-column: 1 / -1; }
  .about h1, .about-portrait, .about-text { grid-column: 1 / -1; }
  .about-portrait { max-width: 22rem; margin-bottom: 2rem; }
}
@media (max-width: 640px) {
  .index a { grid-template-columns: 1fr auto; row-gap: .5rem; }
  .index-title { grid-column: 1 / -1; }
  .hero h1 .indent { padding-left: 0; }
  .figure-pair { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: .2rem; }
}
