/* ==========================================================================
   Portfolio — "Tinta i terra"
   Paper càlid + tinta + un sol accent terracota. Fraunces (títols),
   Source Serif 4 (text), IBM Plex Mono (etiquetes, codi, botons).
   Temes: light (default paper) / dark (paper de nit) via [data-theme].
   ========================================================================== */

/* ---------- Fonts auto-hostatjades (abans Google Fonts; mateixos woff2 de
   fonts.gstatic.com, servits des del propi origen: sense cadena de tercers,
   cache d'1 any. Subsets latin + latin-ext via unicode-range. ---------- */

/* Fraunces — variable (wght 500-700) */
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url("../fonts/fraunces-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url("../fonts/fraunces-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces"; font-style: italic; font-weight: 500 600; font-display: swap;
  src: url("../fonts/fraunces-var-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces"; font-style: italic; font-weight: 500 600; font-display: swap;
  src: url("../fonts/fraunces-var-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Source Serif 4 — variable (wght 400-600) */
@font-face {
  font-family: "Source Serif 4"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("../fonts/source-serif-4-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("../fonts/source-serif-4-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("../fonts/source-serif-4-var-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("../fonts/source-serif-4-var-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* IBM Plex Mono — estàtiques 400/500 + itàliques */
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/plex-mono-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/plex-mono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/plex-mono-500-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/plex-mono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("../fonts/plex-mono-400-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("../fonts/plex-mono-400-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: italic; font-weight: 500; font-display: swap;
  src: url("../fonts/plex-mono-500-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: italic; font-weight: 500; font-display: swap;
  src: url("../fonts/plex-mono-500-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after { box-sizing: border-box; }

:root {
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-head: "Fraunces", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 14px;

  --container: 1120px;
  --header-h: 68px;

  --ease: cubic-bezier(.22, .8, .3, 1);

  /* gra de paper (feTurbulence inline, compartit pels dos temes) */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f4ec;
  --bg-alt: #ebe9dc;
  --surface: #fbfaf3;
  --border: rgba(38, 38, 32, .16);
  --text: #262620;
  --text-soft: #5b584a;
  --text-faint: #6b675a;
  --accent: #1f5290;          /* blau de tinta d'estilogràfica — 7.1:1 sobre bg */
  --accent-text: #1f5290;
  --on-accent: #ffffff;       /* 7.9:1 sobre l'accent */
  --chip-bg: #e6ebf3;
  --chip-border: rgba(31, 82, 144, .32);
  --shadow: 0 10px 26px rgba(38, 38, 32, .13);
  --grain-opacity: .035;
  --sun: radial-gradient(720px 560px at 85% -5%, rgba(31, 82, 144, .05), transparent 70%);
  --squiggle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='78' height='10' viewBox='0 0 78 10'%3E%3Cpath d='M2 7 Q10 2 19 6.5 T38 6 T57 7 T76 5.5' fill='none' stroke='%231F5290' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #191b16;
  --bg-alt: #1e211a;
  --surface: #242820;
  --border: rgba(231, 229, 216, .14);
  --text: #e7e5d8;
  --text-soft: #b0ad9b;
  --text-faint: #96927f;
  --accent: #8fb4e6;          /* blau de tinta a mitja llum — 7.9:1 sobre bg */
  --accent-text: #8fb4e6;
  --on-accent: #131c29;       /* tinta sobre l'accent — 7.8:1 */
  --chip-bg: #242b36;
  --chip-border: rgba(143, 180, 230, .32);
  --shadow: 0 10px 26px rgba(0, 0, 0, .35);
  --grain-opacity: .05;
  --sun: radial-gradient(720px 560px at 85% -5%, rgba(143, 180, 230, .06), transparent 70%);
  --squiggle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='78' height='10' viewBox='0 0 78 10'%3E%3Cpath d='M2 7 Q10 2 19 6.5 T38 6 T57 7 T76 5.5' fill='none' stroke='%238FB4E6' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background .3s var(--ease), color .3s var(--ease);
}

/* gra de paper per sobre de tot, imperceptible però tàctil */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background-image: var(--grain);
  opacity: var(--grain-opacity);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }

::selection { background: var(--chip-bg); }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

/* ---------- Accessibilitat ---------- */

.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-s);
  font-family: var(--font-mono);
  text-decoration: none;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ==========================================================================
   Capçalera — paper sòlid amb doble regle de diari
   ========================================================================== */

.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 3px 0 -2px var(--border);
  transition: background .3s var(--ease);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 100%;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  font-family: var(--font-head);
  font-style: italic;
  font-weight: 600;
  font-size: 1.15rem;
}
.brand-mark {
  font-family: var(--font-mono);
  font-style: normal;
  font-weight: 500;
  font-size: .85rem;
  color: var(--accent);
}
.brand-dot { color: var(--accent); }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: block;
  padding: 8px 11px;
  border-radius: var(--radius-s);
  font-family: var(--font-mono);
  font-size: .82rem;
  text-transform: lowercase;
  letter-spacing: .02em;
  color: var(--text-soft);
  text-decoration: none;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.nav-link:hover { color: var(--text); background: var(--bg-alt); }
.nav-link.active { color: var(--accent); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-switcher {
  display: flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
}
.lang-btn {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: .76rem;
  font-weight: 500;
  letter-spacing: .04em;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.lang-btn:hover { color: var(--text); }
.lang-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.theme-toggle:hover { color: var(--accent); transform: rotate(12deg); }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
  cursor: pointer;
}
.menu-bar {
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--text);
  transition: transform .25s var(--ease), opacity .25s var(--ease);
}
.menu-toggle[aria-expanded="true"] .menu-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-bar:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================================================
   Hero — llum de finestra, res d'orbes
   ========================================================================== */

.hero {
  position: relative;
  padding-top: calc(var(--header-h) + 72px);
  padding-bottom: 96px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--sun);
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  align-items: center;
  gap: 48px;
}

.hero-greeting {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: .9rem;
  color: var(--accent);
}

.hero-name {
  margin: 0;
  font-family: var(--font-head);
  font-size: clamp(2.4rem, 6vw, 3.9rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -.01em;
  color: var(--text);
}

.hero-role {
  margin: 14px 0 0;
  font-family: var(--font-head);
  font-style: italic;
  font-size: clamp(1.1rem, 2.6vw, 1.4rem);
  font-weight: 500;
  color: var(--text-soft);
}

.hero-tagline {
  margin: 18px 0 0;
  max-width: 54ch;
  color: var(--text-soft);
  font-size: 1.06rem;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
}

.chip {
  padding: 5px 12px;
  border: 1px solid var(--chip-border);
  border-radius: 4px;
  background: var(--chip-bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .78rem;
  text-transform: lowercase;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

/* Botons de tipus impremta: es premen físicament */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-s);
  font-family: var(--font-mono);
  font-size: .88rem;
  font-weight: 500;
  text-decoration: none;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease),
              border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 3px 3px 0 var(--text);
}
.btn-primary:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--text); }
.btn-primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--text); }

.btn-ghost {
  border: 1.5px solid currentColor;
  background: transparent;
  color: var(--text);
}
.btn-ghost:hover { color: var(--accent); background: var(--chip-bg); }
.btn-ghost:active { transform: translate(1px, 1px); }

/* La targeta de mètode — com treballo: això no caduca mai */

.hero-visual { min-width: 0; }

.method-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: rotate(.75deg);
  transition: transform .35s var(--ease);
}
.method-card:hover { transform: rotate(0deg) translateY(-3px); }

.method-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px dashed var(--border);
  background: var(--bg-alt);
}
.method-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .95rem;
}
.method-list {
  list-style: none;
  margin: 0;
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.method-list li {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.method-num {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  align-self: flex-start;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 500;
  color: var(--accent);
}
.method-list strong {
  display: block;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .98rem;
  line-height: 1.35;
}
.method-desc {
  display: block;
  font-size: .85rem;
  color: var(--text-soft);
}

.method-note {
  margin: 0;
  padding: 8px 18px 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-style: italic;
  font-size: .78rem;
  line-height: 1.55;
  color: var(--text-faint);
}

/* ==========================================================================
   Seccions — anotacions al marge i subratllats a mà
   ========================================================================== */

.section { padding: 96px 0; scroll-margin-top: var(--header-h); }
.section-alt { background: var(--bg-alt); }

.section-head { max-width: 640px; margin-bottom: 48px; }

.section-kicker {
  font-family: var(--font-mono);
  font-style: italic;
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: lowercase;
  color: var(--accent);
}
.section-kicker::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  margin-right: 10px;
  vertical-align: middle;
  background: currentColor;
}

.section-title {
  margin: 8px 0 0;
  width: fit-content;
  font-family: var(--font-head);
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 600;
  letter-spacing: -.01em;
  padding-bottom: 14px;
  padding-right: 6px;
  background: var(--squiggle) no-repeat left bottom / 78px 10px;
}

.section-subtitle {
  margin: 14px 0 0;
  color: var(--text-soft);
}

/* Subtítol de dues línies (IA, Experiència…): 1a principal, 2a reflexió al marge */
.sub-main {
  color: var(--text);
  font-size: 1.05em;
}
.sub-aside {
  display: inline-block;
  margin-top: 6px;
  color: var(--text-faint);
  font-style: italic;
  font-size: .95em;
}

/* ---------- Sobre mi ---------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  gap: 48px;
  align-items: start;
}

.about-text p { margin: 0 0 18px; color: var(--text-soft); font-size: 1.04rem; }

.about-side {
  display: flex;
  justify-content: center;
}

/* Foto com a polaroid: girada, amb peu escrit a màquina */
.about-photo {
  margin: 0;
  max-width: 300px;
  padding: 12px 12px 46px;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  box-shadow: var(--shadow);
  transform: rotate(-2deg);
  transition: transform .3s var(--ease);
}
.about-photo:hover { transform: rotate(0deg); }
.about-photo img {
  width: 100%;
  height: auto;
  border-radius: 1px;
}
.about-photo figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  text-align: center;
  font-family: var(--font-mono);
  font-style: italic;
  font-size: .78rem;
  text-transform: lowercase;
  color: var(--text-soft);
}

.about-highlights {
  list-style: none;
  margin: 26px 0 0;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  display: grid;
  gap: 13px;
}
.about-highlights li {
  position: relative;
  padding-left: 26px;
  font-size: .98rem;
}
.about-highlights li::before {
  content: "→";
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
  color: var(--accent);
}

/* ---------- Targetes (IA) ---------- */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.card {
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(38, 38, 32, .12);
}

.card-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--chip-bg);
  color: var(--accent);
}

.card-title {
  margin: 0 0 8px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.12rem;
}

.card-desc { margin: 0; color: var(--text-soft); font-size: .95rem; }

/* ---------- Habilitats ---------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.skill-group {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
}

.skill-group-title {
  margin: 0 0 16px;
  font-family: var(--font-mono);
  font-style: italic;
  font-weight: 500;
  font-size: .85rem;
  letter-spacing: .08em;
  text-transform: lowercase;
  color: var(--accent);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tag {
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-alt);
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-soft);
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.tag:hover { border-color: var(--accent); color: var(--text); }

/* ---------- Projectes ---------- */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.project-card {
  display: flex;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.project-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(38, 38, 32, .12);
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

/* Insígnia tipus etiqueta Dymo: relleu de tinta */
.project-badge {
  padding: 3px 10px;
  border-radius: 3px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: .68rem;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.project-link {
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 500;
  text-transform: lowercase;
  color: var(--text-soft);
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s var(--ease);
}
.project-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }

.project-title {
  margin: 0 0 8px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.14rem;
}

.project-desc {
  margin: 0 0 18px;
  color: var(--text-soft);
  font-size: .95rem;
  flex-grow: 1;
}

.project-tags { margin-top: auto; }

/* Línia "Exemple actual: …" dins la targeta de categoria */
.project-example {
  margin: 0 0 18px;
  font-size: .9rem;
  color: var(--text-faint);
}
.project-example a {
  color: var(--accent-text);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color .18s ease;
}
.project-example a:hover { border-color: var(--accent-text); }

/* Projectes en marxa — llista sòbria, sense aparença de producte acabat */
.wip-title {
  margin: 64px 0 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.2rem;
}
.wip-list {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: grid;
  gap: 13px;
  max-width: 680px;
}
.wip-list li {
  position: relative;
  padding-left: 24px;
  color: var(--text-soft);
  font-size: .96rem;
}
.wip-list li::before {
  content: "";
  position: absolute;
  left: 1px;
  top: .45em;
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--text-faint);
  border-radius: 50%;
}
.wip-list strong {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--text);
}

/* ---------- Línia de temps: cosida amb fil ---------- */

.timeline {
  position: relative;
  max-width: 720px;
  padding-left: 8px;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 15px;
  border-left: 1px dashed var(--border);
}

.timeline-item {
  position: relative;
  padding: 0 0 36px 44px;
}
.timeline-item:last-child { padding-bottom: 0; }

/* forats de llibreta: cercles buits; només l'actual és ple */
.timeline-marker {
  position: absolute;
  top: 7px;
  left: 10px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg);
}
.timeline-marker.filled { background: var(--accent); }

.timeline-period {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-style: italic;
  font-size: .76rem;
  letter-spacing: .05em;
  text-transform: lowercase;
  color: var(--text-faint);
}

.timeline-title {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.14rem;
}

.timeline-org {
  margin: 6px 0 0;
  color: var(--accent);
  font-size: .93rem;
  font-weight: 600;
}

.timeline-desc {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: .96rem;
}

.timeline-tags { margin-top: 14px; }

/* ---------- Més enllà dels títols: aprenentatge continu ---------- */

.beyond {
  margin-top: 52px;
  max-width: 720px;
}
.beyond-title {
  margin: 0 0 18px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.15rem;
}
.beyond-card {
  padding: 20px 22px 22px 24px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-m);
  background: var(--surface);
}
.beyond-eyebrow {
  display: inline-block;
  margin-bottom: 9px;
  font-family: var(--font-mono);
  font-style: italic;
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: lowercase;
  color: var(--accent-text);
}
.beyond-card-title {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.08rem;
}
.beyond-card-desc {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: .96rem;
  line-height: 1.6;
}

/* ---------- Idiomes ---------- */

.langs-title {
  margin: 56px 0 18px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.15rem;
}

.langs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: 720px;
}

.lang-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
}

.lang-name {
  font-family: var(--font-head);
  font-weight: 600;
}

.lang-level {
  color: var(--text-soft);
  font-size: .88rem;
}

/* ---------- Modal del CV ---------- */

.cv-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.cv-modal[hidden] { display: none; }

.cv-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 22, 17, .6);
}

.cv-modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  height: min(860px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.cv-modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px dashed var(--border);
  background: var(--bg-alt);
}

.cv-modal-title {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.05rem;
}

.cv-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-small { padding: 8px 16px; font-size: .8rem; }

.cv-modal-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.cv-modal-close:hover { color: var(--accent); border-color: var(--accent); }

.cv-modal-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: var(--bg-alt);
}

/* ---------- Contacte ---------- */

.contact-wrap { text-align: center; }
.contact-wrap .section-head { margin-inline: auto; }
.contact-wrap .section-title { margin-inline: auto; background-position: center bottom; }
.contact-wrap .section-kicker::before { display: none; }

.contact-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.social-links { display: flex; gap: 14px; }

.social-link {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.social-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-3px);
}

/* ---------- Peu ---------- */

/* ==========================================================================
   Visió — reflexió personal sobre la IA (analogia del riu)
   ========================================================================== */

.vision-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 4vw, 52px);
  align-items: center;
}

.vision-text p {
  margin: 0 0 16px;
  color: var(--text-soft);
}
.vision-text p:last-child { margin-bottom: 0; }
.vision-text .vision-lead {
  color: var(--text);
  font-size: 1.14rem;
  line-height: 1.55;
}

.vision-figure {
  margin: 0;
  transition-delay: .08s;
}
.vision-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-l);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.vision-figure figcaption {
  margin-top: 9px;
  text-align: right;
  font-family: var(--font-mono);
  font-style: italic;
  font-size: .72rem;
  letter-spacing: .03em;
  color: var(--text-faint);
}

/* Frase de tancament: mateix estil que els paràgrafs lead (sense accent) */
.vision-close {
  margin: clamp(28px, 4vw, 44px) 0 0;
  max-width: 60ch;
  color: var(--text);
  font-size: 1.14rem;
  line-height: 1.55;
}

@media (max-width: 860px) {
  .vision-grid { grid-template-columns: 1fr; gap: 30px; }
}

.site-footer {
  padding: 44px 0;
  border-top: 1px solid var(--border);
}

.footer-inner { text-align: center; }

/* Cierre "bookend": el eslogan del hero reaparece firmado con el garabato */
.footer-slogan {
  margin: 0 auto 34px;
  width: fit-content;
  max-width: 92%;
  padding: 0 6px 16px;
  font-family: var(--font-head);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.4rem, 3.2vw, 1.85rem);
  line-height: 1.3;
  color: var(--text);
  background: var(--squiggle) no-repeat center bottom / 92px 11px;
}

.footer-brand {
  margin: 0;
  font-family: var(--font-head);
  font-style: italic;
  font-weight: 600;
  font-size: 1.05rem;
}

.footer-tagline {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: .92rem;
}

/* ---------- Terminal interactiva del peu (easter egg) ---------- */
.footer-term {
  width: min(460px, 100%);
  margin: 18px auto 0;
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: .78rem;
  line-height: 1.65;
  color: var(--text);
  cursor: text;
}
.term-log {
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.term-log:empty { display: none; }
.term-out {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-soft);
  animation: term-in .22s var(--ease);
}
.term-strong { color: var(--text); }
.term-echoed { margin: 7px 0 1px; word-break: break-word; }
.term-echoed .term-prompt { color: var(--accent); }

.term-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
}
.term-prompt { color: var(--accent); white-space: nowrap; }
.term-field { position: relative; flex: 1; min-width: 0; }
.term-input {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--text);
  caret-color: var(--accent);
  outline: none;
}
.term-cursor {
  display: none;
  position: absolute;
  left: 0;
  top: .1em;
  width: .55em;
  height: 1.1em;
  background: var(--accent);
  pointer-events: none;
  animation: blink 1.2s steps(2) infinite;
}
/* el bloc idle només apareix quan la terminal està buida i sense focus */
.footer-term.term-empty:not(:focus-within) .term-cursor { display: block; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes term-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* ---------- Modal de l'easter egg ---------- */
.egg-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.egg-modal[hidden] { display: none; }
.egg-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 22, 17, .6);
  animation: egg-fade .25s var(--ease);
}
.egg-panel {
  position: relative;
  width: min(440px, 100%);
  padding: 34px 32px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
  animation: egg-pop .3s var(--ease);
}
.egg-emoji { margin: 0; font-size: 2.1rem; line-height: 1; }
.egg-title {
  margin: 14px 0 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.35rem;
}
.egg-body { margin: 16px 0 26px; }
.egg-reward {
  margin: 0;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre-line;
}
.egg-coda {
  margin: 18px 0 0;
  font-family: var(--font-mono);
  font-style: italic;
  font-size: .82rem;
  line-height: 1.7;
  color: var(--text-faint);
  white-space: pre-line;
}
.egg-close { width: 100%; }
@keyframes egg-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes egg-pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

.footer-copy {
  margin: 14px 0 0;
  font-family: var(--font-mono);
  color: var(--text-faint);
  font-size: .76rem;
}

/* ==========================================================================
   Animacions
   ========================================================================== */

html.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
html.js .reveal.visible {
  opacity: 1;
  transform: none;
}

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

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-visual { max-width: 560px; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .projects-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .menu-toggle { display: flex; }

  .nav-menu {
    position: fixed;
    top: var(--header-h);
    right: 0;
    left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 18px 24px 26px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    max-height: calc(100vh - var(--header-h));
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform .28s var(--ease), opacity .28s var(--ease), visibility .28s;
  }
  .nav-menu.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .nav-links { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav-link { padding: 12px 14px; font-size: .95rem; }

  .nav-actions {
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .about-side { order: -1; }
  .about-photo { max-width: 250px; }
  .section { padding: 72px 0; }
}

@media (max-width: 768px) {
  .cv-modal { padding: 0; }
  .cv-modal-panel { height: 100%; border-radius: 0; }
}

@media (max-width: 600px) {
  .cards-grid { grid-template-columns: 1fr; }
  .langs-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .hero { padding-top: calc(var(--header-h) + 48px); padding-bottom: 72px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .container { padding-inline: 18px; }
}
