/* CV page. On wide screens the name runs up a sticky left spine and the CV reads beside it;
   on phones and paper the name is horizontal. The print rules at the end produce the PDF
   ("Download PDF" calls window.print()), so screen and paper share one source. */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-lg);
  max-width: 66rem;
  margin: 0 auto;
  padding: var(--space-md) 16px 0;
  font-size: 0.9375rem;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 44px;
  color: var(--ink-2);
  text-decoration: none;
}

.back:hover .back-label {
  text-decoration: underline;
}

/* Language switch: two links (each language is its own page), styled as a segmented control. */
.lang {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px;
}

.lang a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 38px;
  padding: 0 var(--space-sm);
  border-radius: 999px;
  color: var(--ink-2);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.lang a:hover {
  color: var(--ink);
}

.lang a[aria-current="page"] {
  background: var(--ink);
  color: var(--bg);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 44px;
  padding: 0 var(--space-md);
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: oklch(0.99 0 0);
  font: 600 0.9375rem/1 var(--font);
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out),
    transform 160ms var(--ease-out);
}

.btn:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn:active {
  transform: translateY(1px);
}

@media (prefers-color-scheme: dark) {
  .btn {
    color: oklch(0.18 0.01 40);
  }
}

/* ---------------------------------------------------------------- document */

.cv {
  max-width: 66rem;
  margin: 0 auto;
  padding: var(--space-xl) 16px var(--space-2xl);
}

.name {
  margin: 0;
  font-size: clamp(2.75rem, 1.8rem + 4vw, 3.75rem);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.name b {
  color: var(--accent);
  font-weight: 700;
}

.tagline {
  margin: var(--space-sm) 0 0;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.3;
}

.credentials {
  margin: var(--space-2xs) 0 0;
  color: var(--ink-2);
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-lg);
  margin: var(--space-md) 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

.contact li {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.contact .icon {
  color: var(--accent);
}

.contact a {
  text-decoration: none;
}

.contact a:hover {
  text-decoration: underline;
}

.summary {
  max-width: 62ch;
  margin: var(--space-xl) 0 0;
  font-size: 1.1875rem;
  line-height: 1.55;
}

/* The spine: from 52rem the header's children join the page grid, and the name takes a
   sticky first column, set vertically and read bottom to top. */
@media (min-width: 52rem) {
  .cv {
    display: grid;
    grid-template-columns: 7rem 1fr;
    column-gap: var(--space-2xl);
    align-items: start;
  }

  .cv-head {
    display: contents;
  }

  .cv > *,
  .cv-head > * {
    grid-column: 2;
  }

  .cv-head > .name {
    grid-column: 1;
    grid-row: 1 / span 30;
    position: sticky;
    top: var(--space-lg);
    padding-left: var(--space-sm);
    border-left: 1px solid var(--rule);
    font-size: clamp(4rem, 2rem + 4vw, 5.5rem);
    line-height: 0.9;
    white-space: nowrap;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
  }

  .tagline {
    margin-top: 0;
  }
}

.cv-section {
  margin-top: var(--space-2xl);
}

.section-title {
  margin: 0 0 var(--space-md);
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.15;
}

.section-title .lead {
  color: var(--accent);
}

/* Entries: role and dates on one line, organization in orange below. */
.entry + .entry {
  margin-top: var(--space-lg);
}

.entry-head {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title when"
    "org org";
  column-gap: var(--space-md);
  align-items: baseline;
}

.entry-title {
  grid-area: title;
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
}

.entry-title a {
  text-decoration-color: color-mix(in oklch, currentColor 35%, transparent);
}

.org {
  grid-area: org;
  margin: 0;
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 600;
}

.when {
  grid-area: when;
  margin: 0;
  color: var(--ink-2);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

@media (max-width: 34rem) {
  .entry-head {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "org"
      "when";
  }

  .when {
    text-align: left;
  }
}

.points {
  margin: var(--space-xs) 0 0;
  padding-left: 1.25rem;
}

.points li + li {
  margin-top: var(--space-2xs);
}

.points li::marker {
  color: var(--ink-2);
}

.stack {
  color: var(--ink-2);
}

/* Skills and the other short lists: label column + content column. */
.facts {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: var(--space-xs) var(--space-lg);
  margin: 0;
}

.facts dt {
  font-weight: 700;
}

.facts dd {
  margin: 0;
}

@media (max-width: 34rem) {
  .facts {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .facts dd + dt {
    margin-top: var(--space-sm);
  }
}

.cv-foot {
  margin-top: var(--space-2xl);
  color: var(--ink-2);
  font-size: 0.875rem;
}

/* One short entrance for the header; the content is visible without it. `translate` rather
   than `transform`, so it composes with the spine's rotation instead of replacing it. */
@media (prefers-reduced-motion: no-preference) {
  .cv-head > * {
    animation: rise 700ms var(--ease-out) both;
  }

  .cv-head > :nth-child(2) {
    animation-delay: 60ms;
  }

  .cv-head > :nth-child(3) {
    animation-delay: 120ms;
  }

  .cv-head > :nth-child(4) {
    animation-delay: 180ms;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 0.5rem;
  }
}

/* ---------------------------------------------------------------- print / PDF */

@page {
  size: letter;
  margin: 14mm 16mm 16mm;

  @bottom-left {
    content: "October 2026";
    font: 7.5pt "Source Sans 3", sans-serif;
    color: #8a8a8a;
  }

  @bottom-center {
    content: "Jaime Sanz Biava  ·  CV";
    font: 7.5pt "Source Sans 3", sans-serif;
    color: #8a8a8a;
  }

  @bottom-right {
    content: counter(page);
    font: 7.5pt "Source Sans 3", sans-serif;
    color: #8a8a8a;
  }
}

@page es {
  @bottom-left {
    content: "Octubre 2026";
  }
}

@media print {
  :root {
    color-scheme: light;
    --bg: #fff;
    --ink: oklch(0.23 0.012 44);
    --ink-2: oklch(0.45 0.012 44);
    --rule: oklch(0.88 0.008 44);
    --accent: oklch(0.56 0.155 44);
  }

  html {
    font-size: 9.6pt;
  }

  html[lang="es"] body {
    page: es;
  }

  body {
    line-height: 1.38;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .toolbar,
  .cv-foot {
    display: none;
  }

  .cv {
    display: block;
    max-width: none;
    padding: 0;
  }

  .cv-head {
    display: block;
  }

  .cv-head > .name {
    position: static;
    padding: 0;
    border: 0;
    font-size: 30pt;
    line-height: 1.05;
    writing-mode: horizontal-tb;
    transform: none;
  }

  .tagline {
    margin-top: 0.3rem;
    font-size: 1.3rem;
  }

  .summary {
    max-width: none;
    margin-top: 1rem;
    font-size: 1.05rem;
    line-height: 1.45;
  }

  .cv-section {
    margin-top: 1.3rem;
  }

  .section-title {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    break-after: avoid;
  }

  .entry + .entry {
    margin-top: 0.8rem;
  }

  .entry-head {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "title when"
      "org org";
    break-inside: avoid;
    break-after: avoid;
  }

  .when {
    text-align: right;
  }

  .points {
    margin-top: 0.2rem;
  }

  .points li + li {
    margin-top: 0.05rem;
  }

  .points li {
    break-inside: avoid;
  }

  .facts {
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
  }

  a {
    text-decoration: none;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
  }
}
