/* Jorge Urbina — CV. Bone paper and olive ink; one photograph; sections separated by a step in tone. */

:root {
  --bg: #ecebe7;
  --surface: #e1dfd9;
  --ink: #38450f;
  --muted: #4f5a2c;
  --on-ink: #ecebe7;
  --on-ink-muted: #c9ccb4;
  --ink-raised: #4a5823;
  --track: #6a7248;

  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-text: 'Barlow', system-ui, sans-serif;

  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-sub: clamp(1.1875rem, 1.05rem + 0.45vw, 1.4375rem);
  --step-lead: clamp(1.25rem, 1.05rem + 0.9vw, 1.875rem);
  --step-title: clamp(2rem, 1.4rem + 2.2vw, 3rem);
  --step-head: clamp(2.25rem, 1.2rem + 3.4vw, 4rem);
  --step-name: clamp(3.5rem, 1.5rem + 5.5vw, 6rem);

  --m: clamp(16px, 2.2vw, 32px);
  --gap-section: clamp(88px, 10vw, 152px);
  --bar-h: 64px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 16px);
  scrollbar-color: var(--muted) var(--bg);
}
body {
  margin: 0;
  background: var(--ink);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
p, li { text-wrap: pretty; }
h1, h2, h3, h4, h5, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration-thickness: 0.08em; text-underline-offset: 0.2em; }
button { font: inherit; color: inherit; }
::selection { background: var(--ink); color: var(--on-ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.bar :focus-visible, .contact :focus-visible, .foot :focus-visible, .dock :focus-visible, .skip:focus-visible { outline-color: var(--on-ink); }

.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 {
  position: absolute; left: var(--m); top: -100px; z-index: 20;
  background: var(--bg); color: var(--ink); padding: 12px 18px; font-weight: 600;
}
.skip:focus { top: 12px; }

/* Shared headings */
.h-head {
  font-family: var(--font-display); font-weight: 700; font-size: var(--step-head);
  line-height: 0.95; letter-spacing: -0.02em; text-transform: uppercase; text-wrap: balance;
}
.section-top { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px 32px; align-items: end; }
.section-top .h-head { grid-column: 1 / 8; }
.section-note { grid-column: 9 / 13; max-width: 40ch; }

/* Download arrow, drawn so it follows the text colour */
.arrow { position: relative; display: inline-block; width: 12px; height: 15px; flex: none; }
.arrow::before { content: ''; position: absolute; left: 5px; top: 0; width: 2px; height: 12px; background: currentColor; }
.arrow::after {
  content: ''; position: absolute; left: 2px; bottom: 2px; width: 8px; height: 8px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}

/* Buttons: one shape, square and flat */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px;
  background: var(--ink); color: var(--on-ink);
  font-weight: 600; text-decoration: none;
  transition: background-color 200ms var(--ease-out), transform 160ms var(--ease-out);
}
.btn:hover { background: var(--muted); }
.btn:active { transform: translateY(2px); }
.btn-quiet { background: var(--surface); color: var(--ink); }
.btn-quiet:hover { background: #d2d0c8; }
.btn-light { background: var(--on-ink); color: var(--ink); }
.btn-light:hover { background: var(--on-ink-muted); }
.btn-quiet-dark { background: var(--ink-raised); color: var(--on-ink); }
.btn-quiet-dark:hover { background: #57672b; }

/* ---------- Bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  min-height: var(--bar-h);
  display: flex; align-items: center; gap: 32px;
  padding: 0 var(--m);
  background: var(--ink); color: var(--on-ink);
}
.wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: var(--step-lead);
  text-transform: uppercase; text-decoration: none; letter-spacing: -0.01em;
}
.bar-nav { display: flex; gap: 4px; margin-left: auto; }
.bar-nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  text-decoration: none; transition: color 200ms var(--ease-out);
}
.bar-nav a:hover { color: var(--on-ink-muted); }
.bar-nav a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.4em; }
.lang { display: flex; align-items: center; gap: 4px; font-weight: 600; }
.lang > * { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 10px; }
.lang-current { background: var(--ink-raised); }
.lang-other { text-decoration: none; }
.lang-other:hover { text-decoration: underline; }
.bar-pdf {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px;
  background: var(--on-ink); color: var(--ink); font-weight: 600; text-decoration: none;
  transition: background-color 200ms var(--ease-out), transform 160ms var(--ease-out);
}
.bar-pdf:hover { background: var(--on-ink-muted); }
.bar-pdf:active { transform: translateY(1px); }
.bar-pdf-short, .nav-short { display: none; }

/* ---------- Hero: the CV card beside the Mapocho ---------- */
.hero {
  display: grid; grid-template-columns: 7fr 5fr; gap: 12px;
  height: calc(100svh - var(--bar-h)); min-height: 640px; max-height: 1000px;
  padding: 0 var(--m) var(--m);
}
.hero-card {
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  background: var(--bg); padding: clamp(32px, 5vw, 80px);
}
.hero-name {
  font-family: var(--font-display); font-weight: 700; font-size: var(--step-name);
  line-height: 0.88; letter-spacing: -0.02em; text-transform: uppercase;
}
.hero-name span { display: block; }
.hero-role { margin-top: 28px; font-size: var(--step-lead); font-weight: 600; line-height: 1.3; }
.hero-role span { display: block; font-weight: 500; text-wrap: balance; }
.hero-focus { margin-top: 18px; font-weight: 600; color: var(--muted); }
.hero-sentence { margin-top: 10px; max-width: 46ch; }
.hero-sentence strong { font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-links { display: flex; flex-wrap: wrap; gap: 0 24px; margin-top: 24px; font-size: var(--step-small); }
.hero-links a, .hero-links span { display: inline-flex; align-items: center; min-height: 44px; }
.hero-links a { text-decoration: none; }
.hero-links a:hover { text-decoration: underline; }

.hero-photo { position: relative; overflow: hidden; background: var(--muted); }
.hero-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 68% 50%; }
.hero-photo figcaption {
  position: absolute; left: 0; bottom: 0;
  padding: 8px 14px; background: var(--ink); color: var(--on-ink); font-size: var(--step-small);
}

/* ---------- Intro: profile and four areas ---------- */
.intro { background: var(--bg); padding: var(--gap-section) var(--m); }
.intro-top { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px 32px; align-items: start; }
.intro-top .h-head { grid-column: 1 / 7; }
.intro-note { grid-column: 8 / 13; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 64px 48px; margin-top: 104px; }
.fact { max-width: 46ch; }
.fact-value {
  font-family: var(--font-display); font-weight: 700; font-size: var(--step-title);
  line-height: 0.95; letter-spacing: -0.02em; text-transform: uppercase;
}
.fact-label { margin-top: 14px; }

/* ---------- Rows: a heading column and a body column ---------- */
.row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px 32px; }
.row-head { grid-column: 1 / 5; }
.row-body { grid-column: 5 / 13; max-width: 72ch; }
.row-title {
  font-family: var(--font-display); font-weight: 700; font-size: var(--step-lead);
  line-height: 1.05; letter-spacing: -0.01em; text-wrap: balance;
}
.row-meta { margin-top: 6px; font-size: var(--step-small); color: var(--muted); }
.roles { max-width: 36rem; }
.roles li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.roles li + li { margin-top: 6px; }
.role-title { font-weight: 600; }
.role-dates { font-size: var(--step-small); white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.points { margin-top: 18px; }
.points li + li { margin-top: 12px; }

/* ---------- Experience ---------- */
.experience { background: var(--surface); padding: var(--gap-section) var(--m); }
.timeline { display: flex; gap: 4px; margin-top: 56px; }
.tl { flex: var(--grow) 1 0; min-width: 0; }
.tl a { display: flex; flex-direction: column; min-height: 44px; text-decoration: none; }
.tl a:hover .tl-name { text-decoration: underline; }
.tl-bar { height: 14px; background: var(--track); }
.tl.is-current .tl-bar { background: var(--ink); }
.tl-name { margin-top: 12px; font-size: var(--step-small); font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.tl-years { font-size: var(--step-small); color: var(--muted); font-variant-numeric: tabular-nums; }

.job { margin-top: 96px; }
.job-head .row-title { font-size: var(--step-title); line-height: 0.95; text-transform: uppercase; }
.job-lead { margin-bottom: 20px; }
.xp-group { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px 32px; align-items: start; margin-top: 88px; }
.xp-group-title {
  grid-column: 1 / 5; position: sticky; top: calc(var(--bar-h) + 32px);
  font-family: var(--font-display); font-weight: 700; font-size: var(--step-sub);
  line-height: 1.1; text-transform: uppercase; color: var(--muted);
}
.xp-items { grid-column: 5 / 13; display: grid; gap: 40px 48px; }
.xp-item p { max-width: 68ch; }
.xp-title {
  font-family: var(--font-display); font-weight: 700; font-size: var(--step-sub);
  line-height: 1.1; letter-spacing: -0.005em; margin-bottom: 8px;
}
.xp-item.is-lead .xp-title { font-size: var(--step-lead); line-height: 1.05; }
.xp-item.is-lead p { font-size: var(--step-sub); line-height: 1.45; font-weight: 400; }
.is-compact .xp-items { grid-template-columns: repeat(2, 1fr); gap: 32px 48px; }
.is-compact .xp-title { font-family: var(--font-text); font-size: var(--step-body); font-weight: 600; line-height: 1.3; margin-bottom: 4px; }

/* ---------- Earlier roles and education ---------- */
.earlier { background: var(--bg); padding: var(--gap-section) var(--m); }
.earlier .row { margin-top: 72px; }
.earlier .section-top + .row { margin-top: 96px; }
.edu-degree { font-weight: 600; }
.edu-degree + p { margin-top: 6px; }

/* ---------- Technical skills ---------- */
.stack { background: var(--surface); padding: var(--gap-section) var(--m) calc(var(--gap-section) * 0.7); }
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px 56px; margin-top: 72px; }

.skill-title {
  font-family: var(--font-display); font-weight: 700; font-size: var(--step-lead);
  line-height: 1.05; letter-spacing: -0.01em;
}
.skill-list { margin-top: 14px; max-width: 40ch; }
.skill-list li { display: inline; }
.skill-list li:not(:last-child)::after { content: ' · '; color: var(--muted); }

/* ---------- Contact ---------- */
.contact {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 48px 32px; align-items: start;
  background: var(--ink); color: var(--on-ink);
  padding: var(--gap-section) var(--m) calc(var(--gap-section) * 0.8);
}
.contact-head { grid-column: 1 / 7; }
.contact-open { margin-top: 20px; font-size: var(--step-lead); line-height: 1.3; max-width: 26ch; }
.contact-body { grid-column: 8 / 13; }
.contact-rows div { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 48px; }
.contact-rows dt { font-size: var(--step-small); color: var(--on-ink-muted); }
.contact-rows dd { text-align: right; overflow-wrap: anywhere; }
.contact-rows a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.contact-rows a:hover { text-decoration: underline; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------- Phone dock: PDF and email within thumb reach ---------- */
.dock { display: none; }

/* ---------- Print: the page as a document ---------- */
@media print {
  .bar, .dock, .skip, .hero-photo, .hero-actions, .contact-actions, .foot > a { display: none !important; }
  body, .hero, .hero-card, .intro, .experience, .earlier, .stack, .contact, .foot { background: #fff !important; color: #000 !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .hero { display: block; height: auto; min-height: 0; max-height: none; padding: 0; }
  .hero-card { padding: 0 0 24px; }
  section { padding: 24px 0 !important; break-inside: auto; }
  .xp-item, .row, .skill-group { break-inside: avoid; }
  .xp-group-title { position: static; }
  a { text-decoration: none; }
}

/* ---------- Footer ---------- */
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 32px;
  padding: 24px var(--m) 32px;
  background: var(--ink); color: var(--on-ink-muted); font-size: var(--step-small);
}
.foot p { max-width: 75ch; }
.foot a { color: var(--on-ink); }
.foot > a { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Motion: parts arrive once, from an already readable state ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] { opacity: 0; transform: translateY(20px); transition: opacity 600ms var(--ease-out), transform 800ms var(--ease-out); transition-delay: calc(var(--i, 0) * 70ms); }
  .js [data-reveal].is-in { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .xp-items { grid-template-columns: 1fr; }
  .skills { grid-template-columns: repeat(2, 1fr); }
  .facts { gap: 56px 32px; }
}

@media (max-width: 900px) {
  .bar { position: static; flex-wrap: wrap; gap: 0 12px; padding-top: 10px; }
  .wordmark { margin-right: auto; }
  .bar-nav { order: 3; width: calc(100% + 16px); margin: 4px -8px 0; justify-content: space-between; }
  .bar-nav a { padding: 0 8px; font-size: var(--step-small); }
  html { scroll-padding-top: 16px; }
  .hero { grid-template-columns: 1fr; height: auto; min-height: 0; max-height: none; gap: 12px; padding: 0 12px 12px; }
  .hero-card { padding: 40px 24px 32px; }
  .hero-photo { height: 24svh; }
  .xp-group-title { position: static; }
  .is-compact .xp-items { grid-template-columns: 1fr; }
  .dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--ink);
    transform: translateY(110%); visibility: hidden;
    transition: transform 300ms var(--ease-out), visibility 0s linear 300ms;
  }
  .dock.is-shown { transform: none; visibility: visible; transition: transform 300ms var(--ease-out); }
  html:not(.js) .dock { position: static; transform: none; visibility: visible; }
  .intro-top, .section-top, .row, .xp-group, .contact { display: block; }
  .intro-note, .section-note { margin-top: 24px; }
  .row-body { margin-top: 16px; }
  .xp-items { margin-top: 24px; }
  .contact-body { margin-top: 48px; }
  .timeline { display: grid; gap: 6px; }
  .tl a { width: 100%; display: grid; grid-template-columns: 9.5rem 1fr; grid-template-rows: auto auto; column-gap: 16px; align-items: center; }
  .tl-name { grid-column: 1; grid-row: 1; margin-top: 0; }
  .tl-years { grid-column: 1; grid-row: 2; }
  .tl-bar { grid-column: 2; grid-row: 1 / 3; height: 12px; width: calc(var(--grow) / 62 * 100%); min-width: 12px; }
}

/* ---------- Phone ---------- */
@media (max-width: 600px) {
  .bar-pdf-word { display: none; }
  .bar-pdf-short, .nav-short { display: inline; }
  .nav-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .hero-actions .btn { width: 100%; }
  .facts { grid-template-columns: 1fr; margin-top: 72px; }
  .skills { grid-template-columns: 1fr; }
  .roles li { flex-direction: column; gap: 0; }
  .contact-rows div { display: block; padding: 6px 0; }
  .contact-rows dd { text-align: left; }
  .contact-actions .btn { width: 100%; }
}
