/* Diego Henriquez portfolio
   Layout: drafting-sheet portfolio. Compact intro, 3x2 project grid, and project pages
   whose left column reads like a drawing's spec column. */
:root {
  --paper: #f3f5f6;
  --surface: #ffffff;
  --ink: #15202a;
  --muted: #56636f;
  --line: #d3dae0;
  --grid: rgba(21, 32, 42, 0.07);
  --accent: #1f55a1;
  --accent-ink: #ffffff;
  --signal: #b87400;
  --signal-soft: rgba(184, 116, 0, 0.12);

  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.5rem;
  --step-3: 2rem;

  --radius: 6px;
  --wrap: 1120px;
  color-scheme: light;
}
/* Always light. The dark palette below is kept for reference and only applies if data-theme="dark" is set. */
:root[data-theme="dark"] {
  --paper: #0f151b;
  --surface: #151d25;
  --ink: #e5eaee;
  --muted: #9aa7b2;
  --line: #2a3641;
  --grid: rgba(229, 234, 238, 0.06);
  --accent: #86abe6;
  --accent-ink: #0f151b;
  --signal: #f0b443;
  --signal-soft: rgba(240, 180, 67, 0.14);
  color-scheme: dark;
}

* { box-sizing: border-box; }
img { max-width: 100%; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-stretch: 112%; line-height: 1.1; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
p { margin: 0; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }
.label {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; }
.brand { font-family: var(--font-display); font-stretch: 112%; font-weight: 700; font-size: var(--step-1); color: var(--ink); text-decoration: none; white-space: nowrap; transition: opacity 180ms ease, transform 180ms ease; }
.brand.is-tucked { opacity: 0; transform: translateY(4px); pointer-events: none; }
.nav { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.9375rem; }
.nav a:hover { color: var(--accent); }
.nav .nav-cta { color: var(--accent-ink); background: var(--accent); padding: 7px 14px; border-radius: var(--radius); }
.nav .nav-cta:hover { color: var(--accent-ink); filter: brightness(1.08); }
@media (max-width: 560px) { .nav .hide-sm { display: none; } .nav { gap: 14px; } }

/* ---------- compact intro ---------- */
.intro { padding-block: 36px 8px; }
.intro h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; font-stretch: 118%; }
.lede { margin-top: 10px; font-size: var(--step-1); color: var(--muted); max-width: 62ch; }

/* ---------- sections ---------- */
section.block { padding-block: 56px; border-top: 1px solid var(--line); }
section.block.first { padding-top: 28px; border-top: 0; }
section.block.compact { padding-block: 40px; }
section.block.compact h2 { font-size: var(--step-2); }
.section-head { margin-bottom: 24px; }
.section-head h2 { font-size: var(--step-3); font-weight: 700; }

/* ---------- project grid ---------- */
.projects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 960px) { .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .projects { grid-template-columns: 1fr; } }

.card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 24px -16px color-mix(in srgb, var(--ink) 60%, transparent); }
.thumb {
  position: relative;
  aspect-ratio: 3 / 2;
  max-width: 100%;
  border-bottom: 1px solid var(--line);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 16px 16px;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.thumb .pending {
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted);
  text-align: center; line-height: 1.5;
  border: 1px dashed var(--line); background: var(--surface);
  padding: 8px 12px; border-radius: 4px; max-width: 90%;
}
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 18px 18px 20px; flex: 1; }
.card-body .label { font-size: 0.6875rem; }
.card-body h3 { font-size: 1.1875rem; font-weight: 700; }
.card-body p { color: var(--muted); font-size: 0.9375rem; }
.facts { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.facts li { position: relative; padding-left: 14px; font-size: 0.8125rem; line-height: 1.45; color: var(--ink); }
.facts li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 6px; height: 1.5px; background: var(--muted); }
.card-foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.03em; padding: 3px 8px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); white-space: nowrap; }
.tag.wip { background: var(--signal-soft); color: var(--signal); }
.status { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--accent); font-weight: 500; white-space: nowrap; }

/* six-station flow (bottleneck project) */
.flow { display: flex; align-items: stretch; gap: 4px; width: 100%; }
.station {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 2px; border: 1px solid var(--line); background: var(--surface); border-radius: 3px;
  font-family: var(--font-mono); font-size: 0.5625rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
  text-align: center; overflow-wrap: anywhere;
}
.station .bar { width: 60%; height: 3px; background: var(--muted); opacity: 0.45; border-radius: 2px; }
.station.constraint { border-color: var(--signal); background: var(--signal-soft); color: var(--signal); font-weight: 500; }
.station.constraint .bar { background: var(--signal); opacity: 1; width: 50%; }
.flow-wrap { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.flow-caption { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--muted); text-align: center; }
.flow-caption b { color: var(--signal); font-weight: 500; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 48px; }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; gap: 28px; } }
.about-copy { display: flex; flex-direction: column; gap: 12px; max-width: 62ch; }
.about-copy p { color: var(--muted); font-size: 0.9375rem; }
.about-copy h2 { font-weight: 700; }
.skills { margin: 0; display: grid; border-top: 1.5px solid var(--ink); }
.skills > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 16px; padding-block: 9px; border-bottom: 1px solid var(--line); }
.skills dt { margin: 0; }
.skills dd { margin: 0; font-size: 0.9375rem; }
@media (max-width: 520px) { .skills > div { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- contact ---------- */
.contact { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 40px; align-items: center; }
@media (max-width: 860px) { .contact { grid-template-columns: 1fr; gap: 20px; } }
.contact h2 { font-weight: 700; margin-bottom: 8px; }
.contact p { color: var(--muted); max-width: 52ch; }
.email-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.email-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.email-addr { font-family: var(--font-mono); font-size: 1.0625rem; color: var(--ink); user-select: all; overflow-wrap: anywhere; }
.copy-btn { font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--accent); background: transparent; border: 1px solid var(--accent); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; }
.copy-btn:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.contact-links { display: flex; gap: 18px; flex-wrap: wrap; font-weight: 600; font-size: 0.9375rem; }

footer { border-top: 1px solid var(--line); padding-block: 28px; }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
footer .label { font-size: 0.6875rem; }

/* ---------- project pages ---------- */
.case { padding-block: 32px 56px; }
.back { display: inline-flex; gap: 6px; font-weight: 600; font-size: 0.9375rem; text-decoration: none; }
.case-head { margin-top: 24px; max-width: 860px; }
.case-head h1 { font-size: clamp(1.875rem, 4.6vw, 3rem); font-weight: 800; margin-block: 12px 16px; }
.case-head .lede { max-width: 64ch; margin-top: 0; }
.case-head .tags { margin-top: 18px; }

.stats {
  display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr));
  gap: 1px; background: var(--line);
  margin-top: 36px; border: 1.5px solid var(--ink);
}
.stat { padding: 16px 18px 18px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat .num { font-family: var(--font-display); font-stretch: 112%; font-weight: 800; font-size: 2.125rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat.hot .num { color: var(--signal); }
.stat p { font-size: 0.875rem; color: var(--muted); }
@media (max-width: 860px) { .stats.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .stats.n3 { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .stats { grid-template-columns: 1fr !important; } }

.figure { margin: 36px 0 0; }
.figure .thumb { aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: var(--radius); }
.figure figcaption { margin-top: 10px; font-size: 0.875rem; color: var(--muted); }
.figure .shot { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #0f151b; transition: border-color 160ms ease; }
.figure .shot:hover { border-color: var(--accent); }
.figure .shot img { display: block; width: 100%; height: auto; }

.case-body { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 56px; margin-top: 48px; }
@media (max-width: 860px) { .case-body { grid-template-columns: 1fr; gap: 28px; } }
.spec { align-self: start; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 84px); border-top: 1.5px solid var(--ink); }
@media (max-width: 860px) { .spec { position: static; } }
.spec dl { margin: 0; }
.spec div { padding-block: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.spec dd { margin: 0; font-size: 0.9375rem; font-weight: 500; }
.prose { display: flex; flex-direction: column; gap: 36px; min-width: 0; }
.prose section { display: flex; flex-direction: column; gap: 12px; }
/* text keeps a readable measure; figures use the full column */
.prose > :not(.figure):not(section), .prose section > :not(.figure) { max-width: 68ch; }
.prose section .figure { margin: 8px 0; }
.prose h2 { font-size: var(--step-2); font-weight: 700; }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.prose li::marker { color: var(--muted); }
.prose .figure { margin-top: 0; }
.takeaway { border-left: 3px solid var(--signal); padding: 4px 0 4px 18px; font-size: var(--step-1); }

/* content still to be written (search the HTML for "To add") */
.todo {
  border: 1px dashed var(--signal);
  background: var(--signal-soft);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--ink);
}
.todo::before { content: "To add · "; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--signal); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.pager a:hover { border-color: var(--accent); }
.pager a.next { text-align: right; grid-column: 2; }
.pager .pager-title { font-family: var(--font-display); font-stretch: 112%; font-weight: 700; font-size: 1rem; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager a.next { grid-column: auto; } }

/* four projects: a 2x2 grid instead of 3 + 1 */
.projects.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 600px) { .projects.cols-2 { grid-template-columns: 1fr; } }
.figure .shot video { display: block; width: 100%; height: auto; }

/* Project pages: dark content, light header (header keeps the light tokens) */
body:has(article.case) { background: #0f151b; }
body:has(article.case) main,
body:has(article.case) footer {
  --paper: #0f151b;
  --surface: #151d25;
  --ink: #e5eaee;
  --muted: #9aa7b2;
  --line: #2a3641;
  --grid: rgba(229, 234, 238, 0.06);
  --accent: #86abe6;
  --accent-ink: #0f151b;
  --signal: #f0b443;
  --signal-soft: rgba(240, 180, 67, 0.14);
  color-scheme: dark;
  background: var(--paper);
  color: var(--ink);
}
body:has(article.case) .site-header { background: #ffffff; }

/* Home card with a dashboard still that plays the clip on hover */
.thumb.media { padding: 0; background: #0f151b; overflow: hidden; }
.thumb.media img, .thumb.media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.thumb.media video { opacity: 0; transition: opacity 200ms ease; }
.thumb.media.is-playing video { opacity: 1; }
.play-hint { position: absolute; right: 10px; bottom: 10px; font-family: var(--font-mono); font-size: 0.6875rem; color: #e5eaee; background: rgba(15, 21, 27, 0.8); border: 1px solid #2a3641; padding: 3px 8px; border-radius: 3px; transition: opacity 200ms ease; }
.thumb.media.is-playing .play-hint { opacity: 0; }
@media (hover: none) { .play-hint { display: none; } }

/* STAR summary near the top of a case study */
.star { margin-top: 44px; }
.star h2 { font-size: var(--step-2); font-weight: 700; margin-bottom: 14px; }
.star-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.star-item { background: var(--surface); padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; }
.star-k { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--signal); }
.star-item p { font-size: 0.9375rem; line-height: 1.55; }
@media (max-width: 960px) { .star-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .star-grid { grid-template-columns: 1fr; } }
.full-title { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line); font-size: var(--step-3); font-weight: 700; }
.full-title + .case-body { margin-top: 28px; }

/* Click-to-enlarge */
.figure .shot { cursor: zoom-in; }
.lb { border: 0; padding: 0; margin: auto; max-width: 96vw; max-height: 94vh; background: transparent; color: #e5eaee; overflow: visible; }
.lb::backdrop { background: rgba(5, 8, 11, 0.88); }
.lb-media { display: block; max-width: 96vw; max-height: 86vh; width: auto; height: auto; border-radius: 6px; border: 1px solid #2a3641; background: #0f151b; }
.lb-cap { margin-top: 10px; font-size: 0.875rem; color: #9aa7b2; max-width: 96vw; }
.lb-close { position: fixed; top: 14px; right: 16px; font: inherit; font-size: 0.875rem; font-weight: 600; color: #0f151b; background: #e5eaee; border: 0; border-radius: 6px; padding: 7px 12px; cursor: pointer; }
