/* ==========================================================
   Cristian Silva — Portfolio
   Alternative look & feel: dark, ultra-clean, near-brutalist
   Type: IBM Plex Sans + IBM Plex Mono (labels only)
   Contrast on --bg: ink 14.3:1, ink-muted 7.8:1, accent 8.0:1 (all AAA)
   ========================================================== */

:root {
  /* Color */
  --bg: #151b19;           /* very dark grey, slightly green */
  --surface: #1b2220;      /* placeholders only */
  --ink: #e4eae7;          /* primary text (off-white, not pure white) */
  --ink-muted: #a3b0ab;    /* secondary text */
  --line: #2c3532;         /* hairlines, grid */
  --line-strong: #46524e;
  --accent: #5fbfaf;       /* petrol green, lifted for dark bg */

  /* Type */
  --font-sans: "IBM Plex Sans", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Layout */
  --max: 1200px;
  --gutter: clamp(20px, 4vw, 48px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-decoration: none; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.label {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ---------- Sample banner (remove before launch) ---------- */
.sample-banner {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  color: var(--bg);
  background: var(--accent);
  padding: 6px var(--gutter);
}

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .container {
  display: flex; align-items: center; justify-content: space-between; height: 72px;
}
.brand { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.nav { display: flex; gap: 32px; }
.nav a { font-size: 15px; color: var(--ink-muted); }
.nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; text-decoration-color: var(--accent); }

/* ---------- Hero ---------- */
.hero { padding: clamp(72px, 12vw, 160px) 0 clamp(56px, 8vw, 96px); border-bottom: 1px solid var(--line); }
.hero .label { color: var(--accent); margin: 0 0 32px; }
.hero h1 {
  font-weight: 600;
  font-size: clamp(44px, 7.4vw, 96px);
  line-height: 1.0;
  letter-spacing: -0.035em;
  margin: 0 0 40px;
  max-width: 13ch;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: end;
}
.hero .lede { font-size: clamp(19px, 1.8vw, 21px); color: var(--ink-muted); margin: 0; max-width: 54ch; }

.actions { display: flex; flex-wrap: wrap; gap: 0; justify-content: flex-end; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 22px;
  font-size: 15px; font-weight: 500;
  border: 1px solid var(--line-strong);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.btn + .btn { border-left: 0; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Strengths ---------- */
.strengths { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.strength { padding: 36px 32px 40px 0; }
.strength + .strength { padding-left: 32px; border-left: 1px solid var(--line); }
.strength .label { display: block; margin-bottom: 18px; color: var(--accent); }
.strength h3 { font-size: 19px; font-weight: 600; line-height: 1.3; margin: 0 0 8px; }
.strength p { font-size: 16px; color: var(--ink-muted); margin: 0; line-height: 1.6; }

/* ---------- Section heading ---------- */
.section { padding: clamp(72px, 10vw, 128px) 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: 20px; border-bottom: 1px solid var(--line-strong);
}
.section-head h2 { font-weight: 600; font-size: clamp(30px, 3.4vw, 44px); letter-spacing: -0.025em; line-height: 1.1; margin: 0; }

/* ---------- Case index (rows) ---------- */
.case-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 40px;
  padding: 44px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
}
.case-num { font-family: var(--font-mono); font-size: 15px; color: var(--ink-muted); padding-top: 6px; }
.case-text h3 {
  font-weight: 600;
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.case-text p { color: var(--ink-muted); margin: 0 0 24px; max-width: 52ch; }
.case-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-bottom: 24px; }
.case-meta span { font-family: var(--font-mono); font-size: 13px; color: var(--ink-muted); }
.case-meta span::before { content: "/ "; color: var(--accent); }
.read-more { font-size: 15px; font-weight: 500; color: var(--accent); }
.case-row:hover h3 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; text-decoration-color: var(--accent); }
.case-row:hover .media { border-color: var(--accent); }
.case-row.soon .read-more { color: var(--ink-muted); }

/* Placeholder screen (replaced by real anonymized screenshots later) */
.media {
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  display: grid;
  grid-template-columns: 18% 1fr;
  transition: border-color 0.12s ease;
}
.media-side { border-right: 1px solid var(--line); }
.media-main { padding: 7%; display: grid; gap: 10px; align-content: start; }
.bar { height: 8px; background: var(--line); }
.bar.w40 { width: 40%; } .bar.w60 { width: 60%; } .bar.w80 { width: 80%; }
.bar.accent { background: #2f5a53; }
.row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.row .bar { height: 28px; }
.media-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); margin-top: 8px; }

/* Real screenshot thumbnail */
.media.media-shot { display: block; position: relative; overflow: hidden; background: var(--surface); border: 0; transition: opacity 0.12s ease; }
.case-row:hover .media.media-shot { opacity: 0.85; } /* same hover as the case-page gallery */
/* Inner shadow on top and bottom edges: suggests the screen continues beyond the crop */
.media.media-shot::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(21, 27, 25, 0.9) 0%, rgba(21, 27, 25, 0.35) 8%, rgba(21, 27, 25, 0) 22%),
    linear-gradient(to top, rgba(21, 27, 25, 0.9) 0%, rgba(21, 27, 25, 0.35) 8%, rgba(21, 27, 25, 0) 22%);
}
.media.media-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; }

/* ---------- About teaser ---------- */
.about-teaser { display: grid; grid-template-columns: 80px minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; padding-top: 44px; }
.about-teaser p { font-size: clamp(20px, 2vw, 24px); line-height: 1.5; margin: 0 0 28px; max-width: 40ch; }
.text-link { font-size: 15px; font-weight: 500; color: var(--accent); }
.text-link:hover { text-decoration: underline; text-underline-offset: 6px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 56px; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; }
.site-footer .label { text-transform: none; letter-spacing: 0.02em; }
.site-footer nav { display: flex; gap: 28px; }
.site-footer a { font-size: 14px; color: var(--ink-muted); }
.site-footer a:hover { color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .actions { justify-content: flex-start; }
  .case-row, .about-teaser { grid-template-columns: 56px 1fr; }
  .case-row .media { grid-column: 2; }
  .about-teaser > div:last-child { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .nav { gap: 20px; }
  .nav .hide-sm { display: none; }
  .strengths { grid-template-columns: 1fr; }
  .strength, .strength + .strength { padding: 28px 0; border-left: 0; }
  .strength + .strength { border-top: 1px solid var(--line); }
  .case-row, .about-teaser { grid-template-columns: 1fr; gap: 20px; }
  .case-row .media { grid-column: 1; }
  .btn { flex: 1 1 auto; justify-content: center; }
}

/* ==========================================================
   Case study pages
   ========================================================== */
.container.narrow { max-width: 860px; }
.case-hero { padding: clamp(48px, 7vw, 88px) 0 0; }
.back { display: inline-block; font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.04em; color: var(--ink-muted); margin-bottom: 36px; }
.back:hover { color: var(--accent); }
.case-hero h1 {
  font-weight: 600;
  font-size: clamp(38px, 5.6vw, 68px); line-height: 1.04; letter-spacing: -0.03em;
  margin: 0 0 24px;
}
.case-hero .lede { font-size: clamp(19px, 1.9vw, 22px); color: var(--ink-muted); margin: 0 0 36px; max-width: 58ch; }

.case-cta { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin: 0 0 48px; }
.cta-note { font-family: var(--font-mono); font-size: 13px; color: var(--ink-muted); }

/* Hero screenshot */
.container.hero-wide { max-width: 1100px; margin: 0 auto 48px; }
.case-hero-shot { margin: 0; }
.shot-frame { position: relative; background: var(--surface); border: 1px solid var(--line-strong); }
.shot-bar { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line-strong); }
.shot-bar span { width: 9px; height: 9px; background: var(--line-strong); }
.shot-scroll { height: clamp(380px, 62vh, 640px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) var(--surface); }
.shot-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.shot-scroll img { width: 100%; height: auto; display: block; }
.shot-hint {
  position: absolute; right: 0; bottom: 0; pointer-events: none;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--bg); background: var(--accent); padding: 8px 14px;
}
.case-hero-shot figcaption, .fig figcaption {
  font-size: 15px; color: var(--ink-muted); margin-top: 14px; line-height: 1.55;
  padding-left: 14px; border-left: 1px solid var(--accent);
}

/* Facts strip */
.case-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0;
  margin: 0; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong);
}
.case-facts > div { padding: 20px 20px 22px 0; }
.case-facts > div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.case-facts dt { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.case-facts dd { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink); }

/* Body text */
.case-body-text { padding-bottom: clamp(64px, 9vw, 112px); }
.case-body-text > hr { border: 0; border-top: 1px solid var(--line); margin: 48px 0; }
.case-body-text h2 {
  font-weight: 600; font-size: clamp(28px, 3vw, 38px); letter-spacing: -0.025em; line-height: 1.15;
  margin: 80px 0 20px; padding-top: 20px; border-top: 1px solid var(--line-strong);
}
.case-body-text > hr + h2 { margin-top: 0; padding-top: 0; border-top: 0; }
.case-body-text h3 { font-size: 21px; font-weight: 600; line-height: 1.3; margin: 48px 0 10px; }
.case-body-text p, .case-body-text li { font-size: 18px; }
.case-body-text p { margin: 0 0 18px; }
.case-body-text strong { color: var(--ink); font-weight: 600; }
.case-body-text ul { list-style: none; padding: 0; margin: 0 0 18px; }
.case-body-text li { position: relative; padding-left: 24px; margin: 12px 0; color: var(--ink-muted); }
.case-body-text li::before { content: "—"; position: absolute; left: 0; color: var(--accent); }
.case-body-text a:not(.proto-card):not(.next-case) { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.case-body-text h3 + p em:first-child { font-style: normal; font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.case-body-text blockquote {
  margin: 40px 0; padding: 28px 0 28px 28px;
  border-left: 3px solid var(--accent);
  font-size: clamp(22px, 2.4vw, 28px); line-height: 1.35; font-weight: 500; letter-spacing: -0.01em;
}
.case-body-text blockquote p { margin: 0; font-size: inherit; }

/* Image / prototype placeholders */
.fig { margin: 32px 0; }
.ph {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 220px; padding: 24px; margin: 0;
  border: 1px dashed var(--line-strong); background: var(--surface);
  color: var(--ink-muted); font-size: 15px; text-align: center;
}
.ph-kind { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }

.proto-card {
  display: flex; align-items: center; gap: 18px; margin: 24px 0 40px; padding: 18px 22px;
  border: 1px solid var(--accent); color: var(--ink);
  transition: background 0.12s ease;
}
.proto-card:hover { background: rgba(95, 191, 175, 0.08); }
.proto-icon {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--accent); color: var(--bg); font-size: 14px;
}
.proto-card .ph-kind { display: block; color: var(--accent); margin-bottom: 2px; }
.proto-title { display: block; font-weight: 600; font-size: 17px; color: var(--ink); }

/* Next case */
.next-case {
  display: block; margin-top: 88px; padding: 32px 0;
  border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
}
.next-case .label { display: block; margin-bottom: 10px; color: var(--accent); }
.next-title { font-weight: 600; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.2; letter-spacing: -0.02em; }
.next-case:hover .next-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; text-decoration-color: var(--accent); }

@media (max-width: 640px) {
  .case-facts > div, .case-facts > div + div { padding: 16px 0; border-left: 0; }
  .case-facts > div + div { border-top: 1px solid var(--line); }
}

/* ---------- Case gallery (key designs) ---------- */
.gallery { margin: 0; }
.gallery-head { display: flex; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--line-strong); margin-bottom: 20px; }
.gallery-wrap { padding: 0 var(--gutter); margin: 0 0 56px; }
.gallery-grid { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 40px; }
.gallery-grid > li { flex: 0 0 300px; }
.gallery-item {
  position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1 / 1;
  padding: 0; margin: 0; overflow: hidden; cursor: zoom-in;
  background: var(--surface); border: 0; color: var(--ink-muted);
  font: inherit; transition: opacity 0.12s ease;
}
.gallery-item:not(:has(img)) { border: 1px dashed var(--line-strong); }
.gallery-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.gallery-item:hover { opacity: 0.85; }
.gallery-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: #0f1413; }
.lightbox[hidden] { display: none; }
.lightbox-bar { flex: none; display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 var(--gutter); border-bottom: 1px solid var(--line); }
.lightbox-controls { display: flex; }
.lb-btn {
  width: 48px; height: 48px; display: grid; place-items: center; cursor: pointer;
  background: transparent; color: var(--ink); border: 1px solid var(--line-strong); font: 500 18px var(--font-sans);
}
.lb-btn + .lb-btn { border-left: 0; }
.lb-btn:hover { background: var(--ink); color: var(--bg); }
.lb-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lightbox-stage { flex: 1; overflow: auto; padding: 32px var(--gutter) 64px; }
.lightbox-stage:focus { outline: none; }
.lightbox-stage img { display: block; width: 100%; max-width: 1280px; height: auto; margin: 0 auto; }
.lightbox-ph {
  max-width: 1280px; margin: 0 auto; aspect-ratio: 3 / 4; display: grid; place-items: center;
  border: 1px dashed var(--line-strong); background: var(--surface);
}
body.lb-open { overflow: hidden; }

@media (max-width: 640px) {
  .gallery-grid { gap: 24px; }
  .gallery-grid > li { flex-basis: calc((100% - 24px) / 2); }
  .gallery-head .label:last-child { display: none; }
}

/* ---------- Diagram (opens in its own zoomable viewer) ---------- */
.fig.diagram { margin: 32px 0; }
.diagram-open {
  position: relative; display: block; width: 100%; padding: 0; margin: 0; border: 0;
  background: var(--surface); cursor: zoom-in; transition: opacity 0.12s ease;
}
.diagram-open img { display: block; width: 100%; height: auto; }
.diagram-open:hover { opacity: 0.9; }
.diagram-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.diagram-hint {
  position: absolute; right: 12px; bottom: 12px; padding: 6px 12px;
  font: 500 13px var(--font-sans); color: var(--bg); background: var(--ink);
}
.dv .dv-zoom { width: auto; padding: 0 16px; font-size: 14px; }
.dv .dv-stage { padding: 24px var(--gutter) 48px; cursor: zoom-in; user-select: none; }
.dv .dv-stage img { width: 100%; max-width: none; height: auto; margin: 0 auto; background: #fff; }
.dv.is-zoomed .dv-stage { cursor: grab; padding: 0; }
.dv.is-zoomed.is-dragging .dv-stage { cursor: grabbing; }
.dv.is-zoomed .dv-stage img { width: auto; max-width: none; }

/* ---------- How it was built (sprint strip) ---------- */
.build-strip { margin: 72px 0 0; padding: 24px 0 28px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.build-strip .label { margin: 0 0 10px; }
.build-lede { margin: 0 0 20px; color: var(--ink-muted); max-width: 62ch; }
.case-body-text .sprints { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 8px; }
.case-body-text .sprints li { margin: 0; padding: 0; display: inline-flex; align-items: center; gap: 8px; }
.case-body-text .sprints li::before { content: none; display: none; }
.sprints .chip { display: inline-flex; align-items: baseline; gap: 8px; padding: 7px 12px; border: 1px solid var(--line-strong); font-size: 14px; color: var(--ink); white-space: nowrap; }
.sprints .imp .chip { border-color: var(--accent); }
.sprints .s-n { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }
.sprints .imp .s-n { color: var(--accent); }
.sprints .arrow, .sprints .gap { color: var(--ink-muted); font-size: 14px; }
@media (max-width: 640px) { .sprints .arrow { display: none; } .case-body-text .sprints { gap: 8px; } }

/* ---------- Screenshots inside the case text ---------- */
.fig-shot img { display: block; width: 100%; height: auto; }

/* ---------- Failure map (case 1, decision 3) ---------- */
.failure-map { margin: 40px 0; }
.failure-map .fmap-steps { margin: 0 0 20px; }
.fmap-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.fmap-group { border: 1px solid var(--line-strong); padding: 16px 18px 18px; }
.fmap-group--main { grid-row: span 3; border-color: var(--accent); }
.fmap-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 10px; font-size: 16px; font-weight: 600; color: var(--ink); }
.fmap-n { font-family: var(--font-mono); font-size: 13px; color: var(--ink-muted); }
.fmap-group--main .fmap-n { color: var(--accent); }
.case-body-text .fmap-group ul { list-style: none; margin: 0; padding: 0; }
.case-body-text .fmap-group li { margin: 0; padding: 5px 0; font-size: 14px; line-height: 1.45; color: var(--ink-muted); border-top: 1px solid var(--line); }
.case-body-text .fmap-group li:first-child { border-top: 0; padding-top: 0; }
.case-body-text .fmap-group li::before { content: none; display: none; }
.failure-map figcaption { margin-top: 16px; }
@media (max-width: 640px) { .fmap-groups { grid-template-columns: 1fr; } .fmap-group--main { grid-row: auto; } }
