/*
  Luis Magalhães website. Design tokens, base and components.
  Source of truth for the web build. See SPEC.md.
  One typeface (Schibsted Grotesk, SIL OFL 1.1, self hosted), ink on white, no accent colour.
*/

/* 1. Font, self hosted. Take the variable TTFs from github.com/schibsted/schibsted-grotesk,
      convert them to woff2, subset to Latin plus Latin Extended A, and save them in /public/fonts
      under the names below. */
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("../fonts/schibsted-grotesk.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("../fonts/schibsted-grotesk-italic.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}

/* 2. Tokens */
:root {
  /* Colour. Contrast on paper in brackets. */
  --paper: #ffffff;
  --ink: #161616;          /* 18.1:1 */
  --quiet: #5b5b57;        /* 6.8:1, secondary text only */
  --photo-wait: #c9cec6;   /* shown only until an image loads */
  --hairline: #e4e4e1;     /* image edges on white, never used as a divider between sections */

  /* Type */
  --font: "Schibsted Grotesk", "Helvetica Neue", Arial, system-ui, sans-serif;
  --w-regular: 400;
  --w-medium: 500;
  --w-bold: 700;

  --text-xs: 0.9375rem;                                  /* 15px. Credits, file sizes */
  --text-s: 1.0625rem;                                   /* 17px. Strip, captions. Minimum on phones */
  --text-m: 1.125rem;                                    /* 18px. Body, navigation */
  --text-l: clamp(1.375rem, 1.1rem + 1vw, 1.75rem);      /* 22 to 28px. Lead paragraphs, item titles */
  --text-name: clamp(1.75rem, 1.45rem + 0.9vw, 1.875rem);/* 28 to 30px. The name in the strip */
  --text-xl: clamp(2rem, 1.4rem + 2.4vw, 3rem);          /* 32 to 48px. Page headings */

  --lh-tight: 1.1;
  --lh-ui: 1.35;
  --lh-text: 1.55;
  --tracking-name: -0.01em;

  /* Space, 4px base */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;
  --s-7: 1.75rem;
  --s-8: 2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;
  --s-16: 4rem;
  --s-24: 6rem;

  --gutter: var(--s-5);          /* 20px on phones */
  --strip-pad-y: var(--s-5);
  --measure: 40rem;              /* about 68 characters at body size */
  --band-h: 44svh;               /* inner page photo band on phones */
  --tap: 44px;                   /* minimum touch target */

  /* Focus */
  --focus: 2px solid var(--ink);
  --focus-offset: 3px;

  /* Motion */
  --t-fast: 150ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

@media (min-width: 48rem) {
  :root {
    --gutter: var(--s-8);        /* 32px from tablet up */
    --strip-pad-y: 1.375rem;     /* 22px */
    --band-h: 56svh;
  }
}

/* 3. Base */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-m);
  font-weight: var(--w-regular);
  line-height: var(--lh-text);
  font-kerning: normal;
  font-variant-numeric: proportional-nums;
  -webkit-font-smoothing: antialiased;
}

img, svg, video { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

a {
  color: inherit;
  text-decoration: none;
}
a:hover { text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:focus-visible {
  outline: var(--focus);
  outline-offset: var(--focus-offset);
}

em, cite { font-style: italic; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: var(--s-3);
  z-index: 10;
  padding: var(--s-2) var(--s-3);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--text-s);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* 4. Photograph. Used on home (fills) and inner pages (band) */
.photo {
  position: relative;
  overflow: hidden;
  background: var(--photo-wait);
}
.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Focal point comes from the CMS: style="object-position: 52% 30%" */
}
.photo__credit {
  position: absolute;
  right: var(--gutter);
  bottom: var(--s-3);
  font-size: var(--text-xs);
  line-height: var(--lh-ui);
  color: #fff;
  text-shadow: 0 0 6px rgb(0 0 0 / 0.45);
}

/* 5. Home. Exactly one screen, never scrolls */
.home {
  height: 100svh;
  min-height: 34rem;
  display: grid;
  grid-template-rows: 1fr auto;
}
.home .photo { min-height: 0; }

/* 6. Caption strip. Identical on every page */
.strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4) var(--s-12);
  padding: var(--strip-pad-y) var(--gutter);
  background: var(--paper);
  max-height: 20svh;            /* never more than a fifth of the screen on desktop */
}

.strip__id {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  margin-right: auto;
}
.strip__name {
  font-size: var(--text-name);
  font-weight: var(--w-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-name);
}
.strip__role {
  font-size: var(--text-s);
  color: var(--quiet);
}

/* Navigation */
.nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-7);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-m);
  line-height: var(--lh-ui);
}
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}
.nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

/* Player */
.player {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--text-s);
  line-height: var(--lh-ui);
  min-height: var(--tap);
}
.player__btn {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
}
.player__btn svg { width: 14px; height: 14px; fill: currentColor; }
.player__btn .icon-pause { display: none; }
.player__btn[aria-pressed="true"] .icon-play { display: none; }
.player__btn[aria-pressed="true"] .icon-pause { display: block; }
.player__btn svg { transition: opacity var(--t-fast) var(--ease); }
.player__label { white-space: nowrap; }
.player__time { font-variant-numeric: tabular-nums; }

/* Language switch */
.lang ul {
  display: flex;
  gap: var(--s-2);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--text-xs);
  color: var(--quiet);
}
.lang li + li::before {
  content: "·";
  margin-right: var(--s-2);
}
.lang a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}
.lang a[aria-current="true"] { color: var(--ink); }

/* Phones. The strip stacks in three rows: name, navigation, player with language */
@media (max-width: 47.99rem) {
  .strip {
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-3);
    max-height: none;
    padding-bottom: var(--s-6);
  }
  .strip__id { margin-right: 0; }
  .nav ul { gap: 0 var(--s-5); }
  .strip__row { display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); }
}
@media (min-width: 48rem) {
  .strip__row { display: contents; }
}

/* 7. Inner pages */
.band {
  height: var(--band-h);
  min-height: 16rem;
}

.content {
  padding: var(--s-12) var(--gutter) var(--s-24);
}
.content > * { max-width: var(--measure); }
.content > .wide { max-width: none; }

.page-title {
  font-size: var(--text-xl);
  font-weight: var(--w-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-name);
  margin-bottom: var(--s-10);
}

.lead {
  font-size: var(--text-l);
  line-height: 1.4;
  margin-bottom: var(--s-8);
}

.prose > * + * { margin-top: var(--s-5); }
.prose h2 {
  font-size: var(--text-l);
  font-weight: var(--w-bold);
  line-height: var(--lh-ui);
  margin-top: var(--s-12);
}

.section + .section { margin-top: var(--s-16); }
.section__title {
  font-size: var(--text-l);
  font-weight: var(--w-bold);
  line-height: var(--lh-ui);
  margin-bottom: var(--s-5);
}

/* Programmes */
.programme-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-12);
}
.programme__title {
  font-size: var(--text-l);
  font-weight: var(--w-bold);
  line-height: var(--lh-ui);
}
.programme__occasion {
  font-size: var(--text-s);
  color: var(--quiet);
  margin-top: var(--s-1);
}
.works {
  list-style: none;
  margin: var(--s-4) 0 0;
  padding: 0;
  display: grid;
  gap: var(--s-1);
}
.works li {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) 1fr auto;
  gap: var(--s-4);
}
.works__composer { font-weight: var(--w-medium); }
.works__duration { color: var(--quiet); font-variant-numeric: tabular-nums; }
@media (max-width: 30rem) {
  .works li { grid-template-columns: 1fr auto; }
  .works__composer { grid-column: 1 / -1; }
}
.ask-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  margin-top: var(--s-4);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

/* Recordings */
.album-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-8) var(--s-5);
}
@media (min-width: 64rem) {
  .album-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-10) var(--s-8); }
}
.album__cover {
  aspect-ratio: 1;
  background: var(--photo-wait);
  outline: 1px solid var(--hairline);
  outline-offset: -1px;
}
.album__cover img { width: 100%; height: 100%; object-fit: cover; }
.album__year { font-size: var(--text-s); color: var(--quiet); margin-top: var(--s-3); }
.album__title { font-weight: var(--w-medium); line-height: var(--lh-ui); }
.album__label { font-size: var(--text-s); color: var(--quiet); }

.excerpt {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--tap);
}

/* Video, click to load */
.video {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--photo-wait);
}
.video img { width: 100%; height: 100%; object-fit: cover; }
.video__load {
  position: absolute;
  left: var(--s-4);
  bottom: var(--s-4);
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-4) var(--s-2) var(--s-2);
  background: var(--paper);
  font-size: var(--text-s);
}

/* Writing */
.essay-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-6);
}
.essay-list a { font-size: var(--text-l); font-weight: var(--w-medium); line-height: var(--lh-ui); }
.essay-list .meta { font-size: var(--text-s); color: var(--quiet); margin-top: var(--s-1); }

/* Contact */
.contact-block { display: grid; gap: var(--s-1); font-size: var(--text-l); line-height: 1.4; }
.contact-block a { text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }

.downloads {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-2);
}
.downloads a {
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: var(--tap);
  align-items: center;
}
.downloads .meta { font-size: var(--text-xs); color: var(--quiet); white-space: nowrap; }

/* Footer */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-3) var(--s-8);
  padding: var(--s-8) var(--gutter) var(--s-10);
  font-size: var(--text-xs);
  color: var(--quiet);
}
.footer a { color: var(--ink); }

/* 8. Motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
}

/* ===== Additions for luismagalhaes.com (built from SPEC.md, 2026-11-23) ===== */
.photo picture { display: block; width: 100%; height: 100%; }
.strip__name a { color: inherit; }
.strip__name a:hover { text-decoration: none; }

/* Excerpt buttons on inner pages load into the strip's player */
.play {
  display: inline-flex; align-items: center; gap: var(--s-3);
  min-height: var(--tap); font-size: var(--text-s); line-height: var(--lh-ui); text-align: left;
}
.play__dot {
  flex: none; width: var(--tap); height: var(--tap); border-radius: 50%;
  background: var(--ink); color: var(--paper); display: grid; place-items: center;
}
.play__dot svg { width: 14px; height: 14px; fill: currentColor; }
.play .icon-pause, .play[aria-pressed="true"] .icon-play { display: none; }
.play[aria-pressed="true"] .icon-pause { display: block; }
.works .play { min-height: 0; }
.works .play__dot { width: 32px; height: 32px; }
.works .play__dot svg { width: 11px; height: 11px; }
.works li { align-items: center; }
.works__work small { color: var(--quiet); font-size: var(--text-s); }
.works a { text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }

.programme__note { margin-top: var(--s-4); }
.quiet { color: var(--quiet); }
.back { display: inline-flex; align-items: center; min-height: var(--tap); font-size: var(--text-s); color: var(--quiet); margin-bottom: var(--s-4); }

/* Album page */
.album-head { display: grid; gap: var(--s-8); margin-bottom: var(--s-12); }
@media (min-width: 48rem) { .album-head { grid-template-columns: 16rem 1fr; align-items: start; } }
.album-head .album__cover { max-width: 16rem; }
.stores { display: flex; flex-wrap: wrap; gap: 0 var(--s-6); margin-top: var(--s-5); }
.stores a { display: inline-flex; align-items: center; min-height: var(--tap); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
.disc { font-size: var(--text-s); color: var(--quiet); font-weight: var(--w-regular); margin: var(--s-8) 0 var(--s-2); }
.tracks li { padding: var(--s-1) 0; }
.quote + .quote { margin-top: var(--s-8); }
.quote p { font-size: var(--text-m); }
.quote cite { display: block; margin-top: var(--s-2); font-style: normal; font-size: var(--text-s); color: var(--quiet); }
.review + .review { margin-top: var(--s-10); }
.review cite { display: block; margin-top: var(--s-3); font-style: normal; font-size: var(--text-s); color: var(--quiet); }
.review-text > * + * { margin-top: var(--s-4); }

/* Videos */
.video-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-10) var(--s-8); }
@media (min-width: 64rem) { .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video img.lb { position: absolute; inset: auto 0; top: -16.67%; height: 133.34%; width: 100%; object-fit: cover; }
.video-title { margin-top: var(--s-3); font-size: var(--text-s); }

/* Essays and about */
.prose { line-height: 1.65; }
.prose a { text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
.prose ul, .prose ol { padding-left: 1.2em; }
.essay-meta { font-size: var(--text-s); color: var(--quiet); margin: calc(-1 * var(--s-8)) 0 var(--s-10); }
.portrait { margin-top: var(--s-12); max-width: 26rem; }
.portrait img { width: 100%; height: auto; }
.portrait figcaption { margin-top: var(--s-2); font-size: var(--text-xs); color: var(--quiet); }
.plain-line { margin-top: var(--s-8); }

/* Footer social links */
.footer nav { display: flex; flex-wrap: wrap; gap: 0 var(--s-5); }
.footer a { display: inline-flex; align-items: center; min-height: var(--tap); }

/* Links page */
.linkpage { max-width: 30rem; margin: 0 auto; padding: var(--s-12) var(--gutter) var(--s-16); }
.linkpage .lp-name { font-size: var(--text-name); font-weight: var(--w-bold); line-height: var(--lh-tight); letter-spacing: var(--tracking-name); }
.linkpage .lp-role { color: var(--quiet); margin-bottom: var(--s-8); }
.linkpage .lp-cover { max-width: 16rem; margin: var(--s-6) 0 var(--s-3); }
.linkpage ul { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: grid; gap: var(--s-1); }
.linkpage li a { display: inline-flex; align-items: center; min-height: var(--tap); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
.linkpage h2 { font-size: var(--text-l); font-weight: var(--w-bold); line-height: var(--lh-ui); margin-top: var(--s-10); }
.linkpage .lp-row { display: grid; grid-template-columns: 56px 1fr; gap: var(--s-4); align-items: center; margin-top: var(--s-4); }
.linkpage .lp-row img { width: 56px; height: 56px; object-fit: cover; outline: 1px solid var(--hairline); outline-offset: -1px; }
.linkpage .lp-row .meta { font-size: var(--text-s); color: var(--quiet); }
.linkpage .lp-row .lp-stores a { margin-right: var(--s-4); min-height: 32px; font-size: var(--text-s); }
@media (min-width: 48rem) { .strip { gap: var(--s-4) var(--s-8); flex-wrap: nowrap; } .nav ul { flex-wrap: nowrap; } .strip__id { white-space: nowrap; } }
@media (min-width: 48rem) and (max-width: 74rem) { .strip { flex-wrap: wrap; } }
.lang { flex: none; } .lang ul { flex-wrap: nowrap; white-space: nowrap; }
.player { min-width: 0; } .player__label { overflow: hidden; text-overflow: ellipsis; }
.player__label { min-width: 0; } .player { flex: 0 1 auto; }
@media (min-width: 48rem) { .nav ul { gap: var(--s-1) var(--s-6); } }
abbr[title] { text-decoration: none; }
.home { grid-template-columns: minmax(0, 1fr); } .strip { min-width: 0; }
@media (max-width: 47.99rem) { .strip__row { min-width: 0; } .strip__row .player { flex: 1 1 auto; min-width: 0; } .player__label { display: block; } }
@media (max-width: 47.99rem) { .strip { flex-wrap: nowrap; } }
.photo__credit { color: rgb(255 255 255 / 0.62); text-shadow: 0 0 4px rgb(0 0 0 / 0.25); }
/* About: biography left, programs right (2026-11-23) */
.about-grid { display: grid; gap: var(--s-16); }
@media (min-width: 64rem) { .about-grid { grid-template-columns: minmax(0, var(--measure)) minmax(15rem, 22rem); column-gap: var(--s-24); align-items: start; } }
.about-aside .aside-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-8); }
.about-aside .programme__title { font-size: var(--text-m); }
.about-aside .programme__title a:hover { text-decoration: underline; }
.aside-works { list-style: none; margin: var(--s-2) 0 0; padding: 0; font-size: var(--text-s); line-height: var(--lh-ui); color: var(--ink); }
.aside-works li + li { margin-top: var(--s-1); }
.aside-works small { color: var(--quiet); }
.player__c { font-weight: var(--w-medium); }
.player__text i { font-style: italic; font-weight: var(--w-regular); }
/* Smaller player (Luis, 23 Nov 2026): 32px visible circle inside the 44px touch target, label at 15px */
.player { gap: var(--s-1); font-size: var(--text-xs); }
.player__btn { background: radial-gradient(circle, var(--ink) 0 15.5px, transparent 16px); }
.player__btn svg { width: 11px; height: 11px; }
.player__time { color: var(--quiet); }
/* About: programs as a row under the lead (replaces the sidebar, 2026-11-23) */
.about-programs { margin: var(--s-12) 0 var(--s-16); }
.programme-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-10) var(--s-6); }
@media (min-width: 64rem) { .programme-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-8); } }
@media (max-width: 26rem) { .programme-row { grid-template-columns: minmax(0, 1fr); } }
.programme-row .programme__title { font-size: var(--text-m); }
.programme-row .programme__title a:hover { text-decoration: underline; }
.row-works { list-style: none; margin: var(--s-3) 0 0; padding: 0; font-size: var(--text-xs); line-height: var(--lh-ui); }
.row-works li + li { margin-top: var(--s-1); }
.row-works small { color: var(--quiet); }
