/* Nicolás Araya · Portfolio */
:root {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --ink: #15171C;
  --ink-2: #3D424B;
  --muted: #5A606B;
  --line: #E3E3DD;
  --line-strong: #C9CBC3;
  --green: #1E6B47;
  --green-dark: #134A30;
  --green-soft: #E4F0E8;
  --thesis-bg: #EEF3EE;
  --thesis-line: #D8E2D8;
  --dark: #15171C;
  --dark-line: #2E323A;
  --font-body: "Inter", system-ui, sans-serif;
  --font-head: "Space Grotesk", "Inter", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
}
img, video { display: block; max-width: 100%; }
a { color: var(--green); }
a:hover { color: var(--green-dark); }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; margin: 0; }
p { margin: 0; }
figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.wrap { max-width: 1200px; margin: 0 auto; padding-inline: 24px; }
.section { padding-block: 88px; display: flex; flex-direction: column; gap: 40px; }
.band { background: var(--surface); border-block: 1px solid var(--line); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green);
}
.mono { font-family: var(--font-mono); font-size: 12px; color: var(--muted); text-transform: uppercase; }
.h2 { font-size: clamp(30px, 4vw, 40px); line-height: 1.1; letter-spacing: -0.01em; }
.h3 { font-size: 20px; }
.lead { font-size: 18px; color: var(--ink-2); }
.body-2 { font-size: 15px; color: var(--ink-2); }
.small { font-size: 14px; color: var(--muted); }
.intro { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; min-height: 48px;
  padding: 12px 24px; border-radius: 999px;
  text-decoration: none; font-weight: 500;
  border: 1px solid var(--line-strong); color: var(--ink);
}
.btn:hover { color: var(--ink); background: #F0F0EA; }
.btn-primary { background: var(--green); border-color: var(--green); color: #FFFFFF; font-weight: 600; }
.btn-primary:hover { background: var(--green-dark); color: #FFFFFF; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* Nav */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px; background: var(--ink); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700;
}
.brand-name { font-family: var(--font-head); font-weight: 600; font-size: 17px; }
.nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.nav-links a { padding: 10px 12px; color: var(--ink-2); text-decoration: none; font-size: 15px; }
.nav-links a:hover { color: var(--ink); }
.nav-links .nav-cta { margin-left: 8px; padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 500; }
.nav-links .nav-cta:hover { color: var(--bg); background: #2A2D35; }

/* Hero */
.hero { display: flex; flex-wrap: wrap; gap: 56px; align-items: center; padding-block: 72px 56px; }
.hero-text { flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.hero h1 { font-size: clamp(38px, 5.4vw, 56px); line-height: 1.05; letter-spacing: -0.02em; }
.hero .lead { font-size: 19px; max-width: 560px; }
.hero-figure { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.hero-figure img { width: 100%; height: 520px; object-fit: cover; border-radius: 20px; }
.facts { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 12px; padding-top: 24px; border-top: 1px solid var(--line); }
.fact { display: flex; flex-direction: column; gap: 2px; min-width: 140px; }
.fact strong { font-family: var(--font-head); font-weight: 600; font-size: 20px; }
.fact span { font-size: 14px; color: var(--muted); }

/* Pillars */
.pillars { padding-bottom: 80px; }
.pillars h2 { font-size: 22px; margin-bottom: 24px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.grid-300 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.pillar {
  text-decoration: none; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; padding: 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.pillar:hover { border-color: var(--line-strong); color: var(--ink); }
.pillar .num { font-family: var(--font-mono); font-size: 13px; color: var(--green); }
.pillar .title { font-family: var(--font-head); font-weight: 600; font-size: 20px; }
.pillar .text { font-size: 15px; color: var(--muted); }

/* Cards */
.card { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--bg); display: flex; flex-direction: column; }
.card-body { padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.card > img { width: 100%; height: 200px; object-fit: cover; }
.photo-pair { display: flex; height: 260px; }
.photo-pair img { height: 100%; object-fit: cover; min-width: 0; }
.photo-pair img:first-child { flex: 3 1 0; }
.photo-pair img:last-child { flex: 2 1 0; }

.feature { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: var(--bg); }
.feature > img { flex: 1 1 460px; min-width: 0; height: 400px; object-fit: cover; }
.feature-body { flex: 1 1 400px; min-width: 0; padding: 40px; display: flex; flex-direction: column; gap: 16px; justify-content: center; }
.feature-body h3 { font-size: 26px; line-height: 1.2; }
.pill { align-self: flex-start; padding: 4px 12px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); font-size: 13px; font-weight: 600; }

/* Papers */
.papers-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.papers-head h3 { font-size: 22px; }
.papers { border-top: 1px solid var(--line); }
.paper { padding: 20px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: flex-start; }
.paper-text { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.paper-title { font-family: var(--font-head); font-weight: 600; font-size: 18px; line-height: 1.3; }
.paper-authors { font-size: 15px; color: var(--ink-2); }
.paper-authors strong { color: var(--ink); font-weight: 600; }
.status { padding: 4px 12px; border-radius: 999px; background: #F1EEE4; color: #5C4A12; font-size: 13px; font-weight: 600; }

/* Thesis */
.thesis { background: var(--thesis-bg); border-bottom: 1px solid var(--thesis-line); }
.thesis .section { gap: 48px; }
.thesis .intro { max-width: 820px; gap: 16px; }
.thesis .lead { font-size: 19px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.tag { padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid #C9D6C9; font-size: 14px; }
.tag-dark { background: var(--ink); border-color: var(--ink); color: #FFFFFF; font-weight: 600; }
.video-box { border-radius: 20px; overflow: hidden; background: #0B0C0E; }
.video-box video { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.panel { background: var(--surface); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.panel p { font-size: 18px; }
.block { display: flex; flex-direction: column; gap: 20px; }
.block > h3 { font-size: 22px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.step { display: flex; flex-direction: column; gap: 10px; }
.step img { width: 100%; height: 180px; object-fit: cover; border-radius: 14px; background: var(--surface); }
.step img.contain { object-fit: contain; }
.step-label { font-family: var(--font-mono); font-size: 13px; color: var(--green); }
.inner { background: var(--surface); border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.inner-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.inner-head h4 { font-size: 19px; }
.inner .step img { height: 170px; border-radius: 12px; border: 1px solid var(--line); }
.vote {
  height: 170px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 16px;
  font-family: var(--font-head); font-weight: 600; font-size: 28px;
}
.vote .keep { color: var(--green); }
.stat { background: var(--surface); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.stat strong { font-family: var(--font-head); font-weight: 600; font-size: 34px; line-height: 1.1; }
.app { background: var(--surface); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.app img { width: 100%; height: 220px; object-fit: cover; }
.app img.contain { object-fit: contain; padding: 12px; background: var(--surface); }
.app figcaption { padding: 20px 24px; display: flex; flex-direction: column; gap: 4px; }
.app-title { font-family: var(--font-head); font-weight: 600; font-size: 18px; }
.thesis .btn { border-color: #A9BBA9; }

/* Field */
.split-head { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-end; justify-content: space-between; }
.split-head > div { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.split-head > p { flex: 1 1 360px; min-width: 0; font-size: 17px; color: var(--ink-2); }
.mosaic { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); grid-auto-rows: 260px; gap: 16px; }
.tile { position: relative; border-radius: 16px; overflow: hidden; background: var(--surface); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile img.contain { object-fit: contain; }
.tile figcaption {
  position: absolute; left: 12px; bottom: 12px; padding: 6px 12px; border-radius: 8px;
  background: rgba(21, 23, 28, 0.84); color: #FFFFFF; font-size: 13px;
}
@media (min-width: 880px) {
  .tile.wide { grid-column: span 2; }
  .tile.tall { grid-row: span 2; }
}
.list-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); border-top: 1px solid var(--line); }
.list-item { padding: 24px 24px 24px 0; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--line); }
.list-item h3 { font-size: 18px; }

/* Teaching */
.dark { background: var(--dark); color: #F2F2EE; }
.dark .eyebrow { color: #7FD1A3; }
.teach { display: flex; flex-direction: row; flex-wrap: wrap; gap: 56px; align-items: flex-start; }
.teach-text { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.teach-text > p { font-size: 17px; color: #C9CCD2; }
.roles li { padding: 14px 0; border-top: 1px solid var(--dark-line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.roles li:last-child { border-bottom: 1px solid var(--dark-line); }
.roles .role { font-weight: 600; }
.roles .where { color: #A9AEB7; font-size: 15px; }
.teach-photos { flex: 1 1 460px; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 220px; gap: 12px; }
.teach-photos > * { border-radius: 14px; overflow: hidden; position: relative; }
.teach-photos img { width: 100%; height: 100%; object-fit: cover; }
.teach-photos .wide { grid-column: span 2; }

/* Building */
.venture { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: var(--surface); }
.venture-body { flex: 1 1 400px; min-width: 0; padding: 40px; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.venture-body h3 { font-size: 28px; }
.venture > img { flex: 1 1 460px; min-width: 0; height: 340px; object-fit: cover; object-position: top; }
.mini { border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.mini h3 { font-size: 18px; }

/* Timeline */
.timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.year { padding: 20px 20px 24px 0; border-top: 2px solid var(--ink); display: flex; flex-direction: column; gap: 10px; }
.year:last-child { border-top-color: var(--green); }
.year-label { font-family: var(--font-mono); font-size: 14px; color: var(--green); }
.year ul { display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.45; }
.year .key { font-weight: 600; }

/* Contact */
.contact { display: flex; flex-wrap: wrap; gap: 48px; align-items: center; padding-block: 96px 64px; }
.contact > img { flex: 0 1 300px; width: 300px; height: 380px; object-fit: cover; border-radius: 20px; }
.contact-text { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.contact h2 { font-size: clamp(30px, 4.4vw, 44px); line-height: 1.1; letter-spacing: -0.01em; }
.site-footer { border-top: 1px solid var(--line); padding-block: 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }

@media (max-width: 640px) {
  .section { padding-block: 64px; }
  .hero { padding-block: 40px; gap: 32px; }
  .hero-figure img { height: 360px; }
  .feature > img { height: 260px; }
  .feature-body, .venture-body { padding: 28px; }
  .nav-links .nav-cta { margin-left: 0; }
  .contact > img { width: 100%; flex-basis: 100%; }
}

/* Code */
.stack { display: flex; flex-wrap: wrap; gap: 8px; }
.stack li { padding: 6px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }
.repos { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.repo {
  text-decoration: none; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; padding: 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.repo:hover { border-color: var(--green); color: var(--ink); }
.repo-name { font-family: var(--font-mono); font-weight: 600; font-size: 16px; color: var(--green-dark); }
.repo-name::after { content: " ↗"; color: var(--muted); font-weight: 400; }
.repo-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.repo-tags span { padding: 2px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); font-size: 12px; font-weight: 600; }

/* How I work with AI */
.ai-sec { border-top: 1px solid var(--line); }
.ai-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.ai-col { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.ai-col .num { font-family: var(--font-mono); font-size: 13px; color: var(--green); }
.ai-col h3 { font-size: 20px; }
.ai-col ul { display: flex; flex-direction: column; gap: 10px; }
.ai-col li { font-size: 15px; color: var(--ink-2); padding-left: 16px; position: relative; }
.ai-col li::before { content: ""; position: absolute; left: 0; top: 0.65em; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.pillars .grid-auto { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.lang-btn {
  margin-left: 6px; min-width: 44px; min-height: 40px; padding: 8px 12px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: transparent;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.lang-btn:hover { background: #F0F0EA; }
.abstract { margin-top: 4px; }
.abstract summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--green); width: fit-content; padding: 6px 0; }
.abstract summary:hover { color: var(--green-dark); }
.abstract p { margin-top: 8px; font-size: 15px; line-height: 1.65; color: var(--ink-2); max-width: 820px; }

/* Talk video (research) */
.talk { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; border: 1px solid var(--line); border-radius: 20px; padding: 24px; background: var(--bg); }
.talk-video { flex: 0 1 280px; min-width: 0; border-radius: 14px; overflow: hidden; background: #0B0C0E; }
.talk-video video { width: 100%; height: auto; aspect-ratio: 480 / 864; }
.talk-body { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.talk-body h3 { font-size: 24px; }

/* Teaching materials */
.materials { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.materials h3 { font-size: 19px; }
.materials .course { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; color: #A9AEB7; margin-top: 6px; }
.mat-list { display: flex; flex-wrap: wrap; gap: 8px; }
.mat-list a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--dark-line); color: #F2F2EE; text-decoration: none; font-size: 14px;
}
.mat-list a:hover { border-color: #7FD1A3; color: #FFFFFF; }
.materials .note { font-size: 13px; color: #A9AEB7; }

/* Gallery teaser (home) */
.g-teaser { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); grid-auto-rows: 200px; gap: 12px; }
.g-teaser a { border-radius: 14px; overflow: hidden; display: block; }
.g-teaser img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.g-teaser a:hover img { transform: scale(1.04); }

/* Contact card with QR */
.vcard { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.vcard img { width: 132px; height: 132px; flex: 0 0 132px; image-rendering: pixelated; }
.vcard-text { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.vcard-text strong { font-family: var(--font-head); font-size: 18px; }

/* Gallery page */
.g-head { padding-block: 48px 24px; display: flex; flex-direction: column; gap: 20px; }
.g-head h1 { font-size: clamp(34px, 5vw, 48px); line-height: 1.05; letter-spacing: -0.02em; }
.g-filters { display: flex; flex-wrap: wrap; gap: 8px; position: sticky; top: 69px; z-index: 5; background: var(--bg); padding-block: 10px; }
.g-chip {
  min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2); font: 500 14px var(--font-body); cursor: pointer;
}
.g-chip:hover { border-color: var(--ink); }
.g-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.g-chip .n { font-family: var(--font-mono); font-size: 12px; opacity: .7; margin-left: 4px; }
.g-grid { columns: 4 240px; column-gap: 12px; padding-bottom: 72px; }
.g-item { break-inside: avoid; margin-bottom: 12px; position: relative; border-radius: 12px; overflow: hidden; background: var(--line); }
.g-item.is-off { display: none; }
.g-item a { display: block; }
.g-item img { width: 100%; height: auto; }
.g-item figcaption {
  position: absolute; inset: auto 0 0 0; padding: 28px 12px 10px; font-size: 13px; color: #FFFFFF;
  background: linear-gradient(transparent, rgba(21, 23, 28, 0.85)); opacity: 0; transition: opacity .2s ease; pointer-events: none;
}
.g-item:hover figcaption, .g-item a:focus-visible + figcaption { opacity: 1; }
@media (hover: none) { .g-item figcaption { display: none; } }

/* Lightbox */
.lb { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(11, 12, 14, 0.96); color: #F2F2EE; }
.lb::backdrop { background: rgba(11, 12, 14, 0.96); }
.lb[open] { display: grid; grid-template-rows: 1fr auto; }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 56px 64px 8px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 24px 20px; font-size: 15px; }
.lb-count { font-family: var(--font-mono); font-size: 13px; color: #A9AEB7; white-space: nowrap; }
.lb-btn {
  position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 1px solid #3A3F48;
  background: rgba(21, 23, 28, 0.7); color: #FFFFFF; font-size: 22px; line-height: 1; cursor: pointer;
}
.lb-btn:hover { background: #2A2D35; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lb-close { right: 12px; top: 8px; }
@media (max-width: 640px) {
  .lb-stage { padding: 56px 8px 8px; }
  .lb-prev, .lb-next { top: auto; bottom: 8px; transform: none; }
  .g-filters { top: 0; position: static; }
  .g-grid { columns: 2 150px; column-gap: 8px; }
  .g-item { margin-bottom: 8px; }
}

/* Skills (same tiers as the CV) */
.skills { padding-bottom: 80px; display: flex; flex-direction: column; gap: 24px; }
.skills > h2 { font-size: 22px; }
.skill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.skill-group { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.skill-group h3 { font-size: 18px; }
.skill-group .stack li { background: var(--bg); }
.also { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
