/* Cabanyal direction: light lime-wash ground, Swiss 12-column grid,
   footnotes in the margin, and a band of rajoles after the tiled
   façades of El Cabanyal. Colour lives only in the tiles and the sea blue. */

:root {
  color-scheme: light;
  --ground: #F7F5EF;
  --tile: #FBF8F1;
  --ink: #131A1C;
  --muted: #585E60;
  --rule: #DAD6CC;
  --hover: #EFECE4;
  --sea: #1E5B8C;
  --sea-soft: rgba(30, 91, 140, 0.1);
  --green: #2E6E5A;
  --ochre: #D39A35;
  --sans: "Schibsted Grotesk", system-ui, -apple-system, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --gutter: clamp(20px, 4vw, 56px);
  --gap: 24px;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; background: var(--ground); }
body {
  font-family: var(--sans);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--sea); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--sea-soft); }

.wrap { max-width: 1440px; margin: 0 auto; padding: 0 var(--gutter); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }
.serif { font-family: var(--serif); font-style: italic; font-weight: 400; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Underline that draws in from the left */
.link { background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; padding-bottom: 2px; transition: background-size .35s var(--ease); }
.link:hover, .link:focus-visible { background-size: 100% 1px; }
.link-on { background-size: 100% 1px; }

/* ---------- Header ---------- */
.site-header { padding-top: 24px; }
.site-header .grid { align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--ink); }
.brand { grid-column: 1 / span 3; display: flex; gap: 10px; align-items: center; font-weight: 600; }
.brand-mark { display: block; width: 24px; height: 24px; }
.header-role { grid-column: 4 / span 3; }
.header-place { grid-column: 7 / span 2; }
.nav { grid-column: 9 / span 4; display: flex; justify-content: space-between; align-items: center; gap: 16px; }

/* Language switch: the current language in ink, the other one muted */
.lang { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.lang-sep { color: var(--rule); }
.lang-opt { font: inherit; font-weight: 500; letter-spacing: .04em; color: var(--muted); background: none; border: 0; padding: 2px 0; cursor: pointer; transition: color .25s; }
.lang-opt:hover { color: var(--ink); }
.lang-opt.is-on { color: var(--ink); cursor: default; box-shadow: inset 0 -1px 0 currentColor; }

/* Scroll progress: a thin line of sea along the top edge */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; background: var(--sea); transform-origin: 0 50%; transform: scaleX(0); z-index: 10; pointer-events: none; display: none; }
@supports (animation-timeline: scroll()) {
  .progress { display: block; animation: progress linear both; animation-timeline: scroll(root); }
  @keyframes progress { to { transform: scaleX(1); } }
}

/* ---------- Hero ---------- */
.hero { padding-top: 80px; }
.hero h1 { grid-column: 1 / span 11; margin: 0; font-size: clamp(38px, 4.9vw, 62px); line-height: 1.06; font-weight: 500; letter-spacing: -0.028em; }
.ln { display: block; overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; }
.ln > span { display: inline-block; }
.hero h1 .serif { font-size: 1.12em; letter-spacing: -0.01em; color: var(--sea); }
.hero-lede { grid-column: 1 / span 7; grid-row: 2; margin: 24px 0 0; font-size: 18px; line-height: 1.55; color: var(--muted); text-wrap: pretty; }
.hero-links { grid-column: 1 / span 7; grid-row: 3; align-self: start; margin-top: 24px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 32px; font-size: 15px; }
.hero-links a { font-weight: 500; }

/* Facts beside the lede: two by two, each under a hairline */
.hero-facts { grid-column: 9 / span 4; grid-row: 2 / span 2; margin: 30px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px var(--gap); align-content: start; }
.fact { padding-top: 10px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 4px; }
.fact dd { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.fact-v { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 500; line-height: 1.3; }
.fact-sub { font-size: 13px; }

/* ---------- Band of rajoles ---------- */
.bandbox { margin-top: 56px; padding: 12px 0; overflow: hidden; }
.track { display: flex; }
.laid { perspective: 600px; }
.cell { position: relative; width: 64px; height: 64px; flex: none; transform-style: preserve-3d; transition: transform 1s cubic-bezier(.65, 0, .25, 1); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face svg { display: block; }
.back { transform: rotateY(180deg); }

/* ---------- Sections ---------- */
.section { padding-top: 80px; }
.sec-head { position: relative; display: flex; gap: 16px; align-items: baseline; padding-bottom: 14px; }
.sec-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); transition: transform 1.2s var(--ease) .1s; }
.sec-head.is-in::after { transform: none; }
.sec-head .serif { font-size: 22px; color: var(--sea); }
.sh-title { display: flex; gap: 16px; align-items: baseline; }
/* Work: the column labels sit on the section rule, so one line heads the table */
.sec-head.sec-head-cols { display: grid; align-items: baseline; }
.sec-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.label { font-size: 13px; color: var(--muted); }

/* Work: company with its period, what I did, notes in the margin */
.sec-head-cols .sh-title, .row .c-company { grid-column: 1 / span 3; }
.sec-head-cols .c-what, .row .c-what { grid-column: 4 / span 6; }
.sec-head-cols .c-notes, .row .c-notes { grid-column: 10 / span 3; }
.row { padding: 16px 0; border-top: 1px solid var(--rule); align-items: baseline; transition: background .35s, opacity .8s var(--ease), transform .8s var(--ease); }
.row.first { border-top: 0; }
.row.last { border-bottom: 1px solid var(--rule); }
.row:hover { background: var(--hover); }
.row .co { display: inline-block; font-size: 21px; font-weight: 500; letter-spacing: -0.01em; transition: transform .45s var(--ease); }
.row:hover .co { transform: translateX(6px); }
.c-company { display: flex; flex-direction: column; gap: 2px; }
.c-company .sub { font-size: 14px; color: var(--muted); }
.per { display: inline-flex; gap: 8px; align-items: center; margin-bottom: 4px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.c-what p { margin: 0; line-height: 1.55; text-wrap: pretty; }
.row-earlier .co { font-size: 17px; }
.row-earlier .c-what { color: var(--muted); }
.earlier-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.earlier-list li { display: block; }
.earlier-co { color: var(--ink); font-weight: 500; }
.earlier-period { display: block; margin-top: 2px; font-size: 13px; font-variant-numeric: tabular-nums; }
.earlier-sum { display: block; margin-top: 2px; }

details.contrib { margin-top: 12px; }
details.contrib summary { cursor: pointer; list-style: none; display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--sea); font-weight: 500; }
details.contrib summary::-webkit-details-marker { display: none; }
details.contrib summary .plus { display: inline-block; transition: transform .35s var(--ease); }
details.contrib[open] summary .plus { transform: rotate(45deg); }
details.contrib ul { margin: 12px 0 0; padding: 0; list-style: none; }
details.contrib li { padding: 7px 0 7px 18px; position: relative; font-size: 14px; color: var(--muted); border-top: 1px solid var(--rule); }
details.contrib li::before { content: ""; position: absolute; left: 0; top: 15px; width: 8px; height: 1px; background: var(--sea); }

.live { position: relative; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--sea); color: var(--sea); flex: none; }
.live::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid currentColor; animation: tide 2.8s ease-out infinite; }
@keyframes tide { from { transform: scale(1); opacity: .8; } to { transform: scale(3.2); opacity: 0; } }

/* Footnotes */
.fn { display: inline-block; vertical-align: super; font-size: .7em; font-weight: 600; line-height: 1; padding: 3px 4px; margin-left: 2px; border-radius: 3px; color: var(--sea); transition: background .3s; }
.note { margin: -6px 0 0; padding: 6px 10px; display: grid; grid-template-columns: 18px minmax(0, 1fr); font-size: 13px; line-height: 1.5; color: var(--muted); border-radius: 4px; transition: background .3s; }
.note b { color: var(--sea); font-weight: 600; }
.fn.is-on, .note.is-on { background: var(--sea-soft); }

/* Stack and certifications share a row */
.duo { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: start; }
.duo > #stack { grid-column: 1 / span 7; }
.duo > #certifications { grid-column: 9 / span 4; }

.stack-row { padding: 14px 0; border-top: 1px solid var(--rule); align-items: baseline; }
.stack-row.first { border-top: 0; }
.stack-row.last { border-bottom: 1px solid var(--rule); }
.stack-row .g { grid-column: 1 / span 4; font-weight: 500; }
.stack-row .items { grid-column: 5 / span 8; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 16px; }

.certs { margin: 0; padding: 0; list-style: none; }
.certs li { padding: 12px 0; border-top: 1px solid var(--rule); }
.certs li:first-child { border-top: 0; }
.certs li:last-child { border-bottom: 1px solid var(--rule); }
.certs .prep { color: var(--muted); }

/* Education & languages: aligned under Stack and under certifications */
.edu-row { padding-top: 16px; row-gap: 16px; }
.edu-main { grid-column: 1 / span 7; }
.langs { grid-column: 9 / span 4; }
.edu-main, .langs { display: flex; flex-direction: column; gap: 4px; }
.edu-row .school { font-size: 18px; font-weight: 500; line-height: 1.3; }

/* Contact: headline on the left, links stacked on the right */
.contact-duo { margin-top: 32px; align-items: end; }
.contact-title { grid-column: 1 / span 7; margin: 0; font-size: clamp(32px, 4.2vw, 54px); line-height: 1.08; font-weight: 500; letter-spacing: -0.025em; text-wrap: balance; }
.contact-title .serif { font-size: 1.1em; color: var(--sea); }
.contact-stack { grid-column: 9 / span 4; display: flex; flex-direction: column; }
.contact-cell { padding: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.contact-cell + .contact-cell { border-top: 1px solid var(--rule); }
.contact-cell .val { font-size: 19px; font-weight: 500; }
.contact-cell a.val::after { content: " ↗"; color: var(--sea); }

.site-footer { margin-top: 80px; padding: 18px 0 32px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 13px; color: var(--muted); }
.site-footer .brand-mark { width: 18px; height: 18px; }
.site-footer .left { display: flex; gap: 10px; align-items: center; }

/* ---------- Motion ---------- */
.anim-fade { animation: fade .8s var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.anim-rise { animation: rise 1s var(--ease) both; }
@keyframes fadeonly { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(105%); } to { transform: none; } }
.anim-spin { animation: spin 1.6s var(--ease) .2s both; }
@keyframes spin { from { transform: rotate(-135deg); opacity: 0; } to { transform: none; opacity: 1; } }
.anim-laid { animation: laid .6s var(--ease) both; }
@keyframes laid { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* Scroll reveal: items rise in, staggered by an inline delay set in JS */
.rv { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.rv.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .rv { opacity: 1; transform: none; }
  .sec-head::after { transform: none; }
  .progress { display: none; }
}

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  :root { --gap: 16px; }
  .grid > *, .duo > * { grid-column: 1 / -1 !important; grid-row: auto !important; }
  .duo { display: block; }
  .site-header { padding-top: 16px; }
  .site-header .grid { row-gap: 10px; padding-bottom: 12px; }
  .header-role, .header-place { display: none; }
  .nav { justify-content: flex-start; flex-wrap: wrap; gap: 8px 20px; }
  .hero { padding-top: 40px; }
  /* Let the headline flow on narrow screens; fade instead of per-line rise. */
  .ln, .ln > span { display: inline; overflow: visible; padding: 0; margin: 0; }
  .ln > .anim-rise { animation-name: fadeonly; animation-duration: .9s; }
  .hero-lede { font-size: 17px; margin-top: 20px; }
  .hero-links { margin-top: 20px; }
  .hero-facts { margin-top: 28px; gap: 14px var(--gap); }
  .fact-v { font-size: 15px; }
  .bandbox { margin-top: 36px; }
  .section { padding-top: 56px; }
  .sec-head-cols > .label { display: none; }
  .row { row-gap: 6px; padding: 14px 0; }
  .row:hover { background: none; }
  .row:hover .co { transform: none; }
  /* The footnote repeats the first contribution; drop it on phones. */
  .row .c-notes, .row .fn { display: none; }
  details.contrib { margin-top: 8px; }
  .stack-row { row-gap: 4px; padding: 12px 0; }
  .stack-row .g { font-size: 13px; color: var(--muted); }
  .certs li { padding: 8px 0; }
  .contact-duo { margin-top: 24px; }
  .contact-stack { margin-top: 20px; }
  .site-footer { margin-top: 48px; padding-bottom: 28px; flex-wrap: wrap; }
}
