/* Raúl Balanzá portfolio. Colours, type and the cursor come from assets/tokens.css (copied from ../brand).
   Layout: one left-aligned column, section names in a narrow left gutter, rows separated by hairlines. */

@font-face { font-family: "Balanza"; font-weight: 300; font-display: swap; src: url("assets/fonts/balanza-300.woff2") format("woff2"); }
@font-face { font-family: "Balanza"; font-weight: 400; font-display: swap; src: url("assets/fonts/balanza-400.woff2") format("woff2"); }
@font-face { font-family: "Balanza"; font-weight: 700; font-display: swap; src: url("assets/fonts/balanza-700.woff2") format("woff2"); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
#contact { scroll-margin-top: 32px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--step-0)/1.6 var(--f-body);
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
/* header, main, footer in a column at least as tall as the window, so the footer sits at the bottom of short pages */
.wrap { max-width: 900px; margin: 0 auto; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
h1, h2, h3 { margin: 0; font-family: var(--f-display); font-weight: 400; text-wrap: balance; }
p { margin: 0; max-width: 62ch; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.muted { color: var(--muted); }
.mono { font-family: var(--f-mono); font-size: var(--step--1); letter-spacing: 0.02em; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 20px; top: 12px; background: var(--fg); color: var(--bg); padding: 6px 10px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; padding-block: 28px; }
.top .home { display: block; line-height: 0; color: var(--fg); }
.top .home svg { height: 26px; width: auto; display: block; }
.top-right { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 24px; }
.theme { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.theme:hover { color: var(--fg); border-color: var(--muted); }
.theme svg { grid-area: 1 / 1; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 10; stroke-linecap: butt; stroke-linejoin: miter; }
.theme .ti { display: none; }
.theme[data-current="system"] .ti-system, .theme[data-current="light"] .ti-light, .theme[data-current="dark"] .ti-dark { display: block; }
.theme:not([data-current]) .ti-system { display: block; }
.nav { display: flex; flex-wrap: wrap; gap: 6px 24px; font-family: var(--f-mono); font-size: var(--step--1); }
.nav a { color: var(--muted); text-decoration: none; padding-block: 4px; }
.nav a:hover { color: var(--fg); }
.nav a[aria-current="page"] { color: var(--fg); text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 7px; }

/* page title / hero */
.hero { padding-block: clamp(20px, 5vw, 56px) 0; display: grid; gap: 22px; }
.hero h1 { font-weight: 700; font-size: var(--step-4); line-height: 0.98; letter-spacing: -0.01em; }
.hero .lead { font-size: var(--step-1); line-height: 1.5; color: var(--muted); max-width: 46ch; text-wrap: pretty; }
.hero .now { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.hero .now .mono { color: var(--muted); }
.page-title { padding-block: clamp(16px, 4vw, 40px) 0; display: grid; gap: 16px; }
.page-title h1 { font-weight: 700; font-size: var(--step-3); line-height: 1.05; }
.page-title p { color: var(--muted); max-width: 52ch; }

/* sections */
main { flex: 1 0 auto; display: grid; align-content: start; gap: clamp(48px, 8vw, 88px); padding-bottom: clamp(72px, 10vw, 120px); }
.sec { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 16px 40px; align-items: start; }
.sec > h2 { font-size: var(--step-0); color: var(--muted); padding-top: 14px; }
.sec-body { display: grid; gap: 24px; min-width: 0; }
@media (max-width: 720px) { .sec { grid-template-columns: 1fr; } .sec > h2 { padding-top: 0; } }
.more { font-family: var(--f-mono); font-size: var(--step--1); color: var(--muted); }
.more a { color: var(--fg); }

/* rows: the one list pattern used everywhere */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 24px; padding-block: 14px; border-top: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 1px solid var(--line); }
.rows .t { font-family: var(--f-display); font-size: var(--step-1); line-height: 1.3; }
.rows .t a { text-decoration: none; }
.rows .t a:hover { text-decoration: underline; }
.rows .d { grid-column: 1 / -1; color: var(--muted); max-width: 62ch; }
.rows .y { grid-column: 2; grid-row: 1; font-family: var(--f-mono); font-size: var(--step--1); color: var(--muted); white-space: nowrap; padding-top: 6px; font-variant-numeric: tabular-nums; }
.rows .x { grid-column: 1 / -1; display: grid; gap: 8px; padding-top: 4px; }
.rows .x p { max-width: 62ch; }
.links { display: flex; flex-wrap: wrap; gap: 4px 18px; font-family: var(--f-mono); font-size: var(--step--1); }
.stack { font-family: var(--f-mono); font-size: var(--step--1); color: var(--muted); }

.groups { display: grid; gap: clamp(40px, 6vw, 64px); }

/* projects: compact rows, name | description + stack | years */
.plist { list-style: none; margin: 0; padding: 0; }
.pr { display: grid; grid-template-columns: 13rem minmax(0, 1fr) 6.5rem; gap: 2px 20px; align-items: baseline; padding-block: 10px; border-top: 1px solid var(--line); }
.pr:last-child { border-bottom: 1px solid var(--line); }
.pn { font-family: var(--f-display); font-size: 1.05rem; line-height: 1.35; }
.pn a { text-decoration: none; }
.pn a:hover { text-decoration: underline; }
.pd { color: var(--muted); font-size: 0.95rem; line-height: 1.45; display: grid; gap: 2px; }
.pm { display: flex; flex-wrap: wrap; gap: 0 14px; font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.02em; }
.pm a { color: var(--fg); }
.py { font-family: var(--f-mono); font-size: var(--step--1); color: var(--muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .pr { grid-template-columns: minmax(0, 1fr) auto; }
  .pn { grid-column: 1; }
  .py { grid-column: 2; grid-row: 1; }
  .pd { grid-column: 1 / -1; }
}

/* compact two-column facts (skills, languages) */
.facts { display: grid; gap: 10px; margin: 0; }
.facts div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 16px; }
.facts dt { font-family: var(--f-mono); font-size: var(--step--1); color: var(--muted); padding-top: 3px; }
.facts dd { margin: 0; }
@media (max-width: 480px) { .facts div { grid-template-columns: 1fr; gap: 0; } }

/* contact */
.contact { display: grid; gap: 18px; }
.email { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 16px; }
.email a { font-family: var(--f-display); font-size: var(--step-2); line-height: 1.2; text-decoration-color: var(--line); overflow-wrap: anywhere; }
.btn { font: 400 var(--step--1) var(--f-mono); color: var(--fg); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.btn:hover { border-color: var(--muted); }

/* home: the drawn 'about' grid. Cells are separated by hairlines, not cards. */
.about { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: dense; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.about figure { margin: 0; background: var(--bg); padding: 22px 22px 18px; display: grid; gap: 18px; align-content: space-between; min-width: 0; }
.about .wide { grid-column: span 2; }
.about svg { display: block; width: 100%; height: auto; color: var(--fg); overflow: visible; }
.about figcaption { font-family: var(--f-display); font-size: 1.05rem; line-height: 1.35; }
.about figcaption a { font-family: var(--f-mono); font-size: var(--step--1); margin-left: 6px; white-space: nowrap; }
@media (max-width: 860px) { .about { grid-template-columns: repeat(2, minmax(0, 1fr)); } .about .lang { grid-column: span 2; } .about .lang svg { max-width: 320px; } }
.hob { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 12px; padding-block: 12px; }
.hob-i { display: grid; justify-items: center; gap: 14px; text-align: center; }
.hob-i svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 10; stroke-linecap: butt; stroke-linejoin: miter; color: var(--fg); }
.hob-i span { font-family: var(--f-mono); font-size: var(--step--1); color: var(--fg); }
.sx { overflow-x: auto; }
@media (max-width: 560px) {
  .about { grid-template-columns: 1fr; }
  .about .wide, .about .lang { grid-column: auto; }
  .about .path svg { min-width: 560px; }       /* keep the timeline legible; it scrolls inside its card */
  .hob { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* header: logo and theme switch on one row, menu below */
  .top-right { display: contents; }
  .top .theme { order: 1; margin-left: auto; }
  .top .nav { order: 2; flex-basis: 100%; }
}
.dg { stroke: currentColor; stroke-width: 2; }
.dg-f { stroke: var(--line); stroke-width: 1; }
.dg-fill { fill: currentColor; }
.dg-t, .dg-tf, .dg-inv { font: 400 11px var(--f-mono); }
.dg-t { fill: var(--muted); }
.dg-name { fill: var(--fg); font: 700 28px var(--f-display); }
.dg-tf { fill: var(--fg); }
.dg-inv { fill: var(--bg); }
.dg-sm { font-size: 10px; }
.dg-link { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.dg-f-strong { stroke: var(--muted); stroke-width: 1.5; }
.dg-dash { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.8; }
.dg-bg { fill: var(--bg); }
.dg-spark { stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: miter; }
.ic { stroke: var(--fg); stroke-width: 1.5; }
.ic-t { fill: var(--fg); font: 700 6.5px var(--f-mono); }
.ic-dot { fill: var(--fg); }
.ic-inv { stroke: var(--bg); stroke-width: 1.5; }
.ic-inv-t { fill: var(--bg); font: 700 6.5px var(--f-mono); }
.ic-inv-dot { fill: var(--bg); }
.hello { display: grid; gap: 14px; }
.hello h2 { font-size: var(--step-0); color: var(--muted); }

/* home, alternative layout: one drawing per row, caption on the left */
.about-rows { display: grid; border-top: 1px solid var(--line); }
.arow { margin: 0; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 20px 48px; align-items: center; padding-block: 28px; border-bottom: 1px solid var(--line); }
.arow figcaption { font-family: var(--f-display); font-size: var(--step-2); line-height: 1.2; text-wrap: balance; }
.arow .art { justify-self: end; width: 100%; max-width: 340px; }
.arow.wide .art { max-width: none; }
.arow svg { display: block; width: 100%; height: auto; color: var(--fg); overflow: visible; }
@media (max-width: 720px) { .arow { grid-template-columns: 1fr; } .arow .art { justify-self: start; } }

/* home, alternative layout: a sketchbook page. Drawings at different sizes, staggered left and right,
   captions as short notes with a leader line. Placement per drawing is the .b-<key> rules below. */
.about-board { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; row-gap: clamp(40px, 6vw, 72px); align-items: start; padding-block: 8px 24px; }
.bfig { margin: 0; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bfig svg { display: block; width: 100%; height: auto; color: var(--fg); overflow: visible; }
.bfig figcaption { font-family: var(--f-display); font-size: 1.15rem; line-height: 1.3; display: flex; align-items: baseline; gap: 12px; max-width: 30ch; }
.bfig figcaption::before { content: ""; flex: none; width: 28px; height: 1px; background: var(--muted); transform: translateY(-0.3em); }
.b-location { grid-column: 1 / span 6; grid-row: 1; }
.b-stack { grid-column: 8 / span 5; grid-row: 1; margin-top: clamp(40px, 9vw, 104px); }
.b-infra { grid-column: 3 / span 5; grid-row: 2; }
.b-path { grid-column: 1 / span 8; grid-row: 3; }
.b-focus { grid-column: 9 / span 4; grid-row: 3; margin-top: clamp(24px, 5vw, 56px); }
.b-languages { grid-column: 2 / span 4; grid-row: 4; margin-top: clamp(16px, 4vw, 48px); flex-direction: column-reverse; }
.b-hobbies { grid-column: 6 / span 7; grid-row: 4; margin-top: clamp(48px, 9vw, 112px); }
.b-focus figcaption, .b-stack figcaption, .b-hobbies figcaption { align-self: flex-end; flex-direction: row-reverse; text-align: right; }
@media (max-width: 760px) {
  .about-board { grid-template-columns: 1fr; }
  .about-board .bfig { grid-column: 1; grid-row: auto; margin-top: 0; width: 88%; }
  .about-board .bfig:nth-child(even) { justify-self: end; }
  .b-languages { flex-direction: column; }
}

/* 404 */
.nf { gap: 22px; }
.nf-term { margin: 0; padding: 18px 20px; background: var(--raise); border-radius: 4px; font: 400 0.92rem/1.7 var(--f-mono); overflow-x: auto; white-space: pre; }
.nf-p { color: var(--fg); }
.nf-err { color: var(--muted); }

/* small language tag on post rows and post pages */
.tag { display: inline-block; margin-left: 10px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 3px; font: 400 0.62rem/1.5 var(--f-mono); letter-spacing: 0.04em; color: var(--muted); vertical-align: 0.2em; }

/* blog post: one readable column */
.post { display: grid; gap: 40px; padding-block: clamp(16px, 4vw, 40px) 0; max-width: 70ch; }
.post-head { display: grid; gap: 14px; }
.post-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin: 0; font-family: var(--f-mono); font-size: var(--step--1); color: var(--muted); }
.post-meta .tag { margin-left: 0; }
.post h1 { font-weight: 700; font-size: clamp(2rem, 6vw, var(--step-3)); line-height: 1.08; }
.prose { font-size: 1.0625rem; line-height: 1.75; overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.1em; }
.prose p, .prose ul, .prose ol, .prose pre, .prose figure, .prose blockquote { margin-bottom: 0; }
.prose h2 { font-size: var(--step-2); line-height: 1.2; margin-top: 2em; }
.prose h3 { font-size: 1.3rem; margin-top: 1.7em; }
.prose h4 { font-size: 1.1rem; margin-top: 1.5em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.35em; }
.prose figure { margin: 2em 0 0; display: grid; gap: 10px; justify-items: center; }
.prose img { display: block; max-width: 100%; height: auto; border-radius: 3px; }
.prose figcaption { font-size: 0.88rem; color: var(--muted); text-align: center; max-width: 60ch; }
.prose pre { font: 400 0.82rem/1.6 var(--f-mono); background: var(--raise); padding: 16px 18px; border-radius: 4px; overflow-x: auto; white-space: pre; }
.prose code { font-family: var(--f-mono); font-size: 0.86em; }
.prose blockquote { border-left: 2px solid var(--line); padding-left: 16px; color: var(--muted); }
.prose .note { background: var(--raise); padding: 14px 16px; border-radius: 4px; font-size: 0.95rem; }
.prose sup { font-size: 0.72em; line-height: 0; }
.prose a { text-decoration-color: var(--muted); }
.post-foot { padding-top: 24px; border-top: 1px solid var(--line); font-family: var(--f-mono); font-size: var(--step--1); }

/* placeholder */
.placeholder { border: 1px dashed var(--line); padding: 24px; display: grid; gap: 6px; }
.placeholder p { color: var(--muted); }

/* footer */
.foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding-block: 28px 40px; border-top: 1px solid var(--line); }
.foot svg { height: 20px; width: auto; display: block; color: var(--fg); }
.foot .mono { color: var(--muted); }
.contact-icons { display: flex; gap: 20px; align-items: center; margin: 0; }
.contact-icons a { display: block; color: var(--muted); line-height: 0; padding: 4px; margin: -4px; text-decoration: none; }
.contact-icons a:hover { color: var(--fg); }
.contact-icons svg { width: 22px; height: 22px; display: block; fill: currentColor; }
