/* ==========================================================================
   Ryan Huang — Portfolio
   Design system: "spec sheet" — datasheet-inspired, engineering-notebook
   grid, quantified results pulled out as bold parameter callouts.
   ========================================================================== */

:root {
  /* Color */
  --ink: #15171a;
  --ink-soft: #363b42;
  --muted: #5b6470;
  --line: #e2e5e9;
  --line-strong: #cbd1d8;
  --paper: #ffffff;
  --surface: #f4f5f7;
  --surface-dark: #eceef1;
  --accent: #ff5a1f;        /* safety orange — primary */
  --accent-ink: #a33c12;    /* darker orange for text on light bg */
  --accent-2: #1f7a4d;      /* pcb green — secondary */
  --dark: #15171a;
  --dark-surface: #1f2226;
  --on-dark: #f2f3f4;
  --on-dark-muted: #a7adb5;

  /* Type */
  --display: 'Space Grotesk', 'Arial Narrow', sans-serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;

  /* Layout */
  --maxw: 1180px;
  --gutter: clamp(20px, 4vw, 48px);
  --radius: 3px;
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent);
  display: inline-block;
  flex: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 13px 22px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--ink); border-color: var(--ink); }

/* ---------- Nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.site-nav .logo {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.site-nav .logo .dot { color: var(--accent); }
.site-nav ul {
  list-style: none;
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.site-nav a.navlink {
  text-decoration: none;
  color: var(--ink-soft);
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}
.site-nav a.navlink:hover,
.site-nav a.navlink.active { color: var(--ink); border-bottom-color: var(--accent); }
.nav-toggle { display: none; }

@media (max-width: 700px) {
  .site-nav ul { position: absolute; top: 64px; left: 0; right: 0; background: var(--paper); flex-direction: column; gap: 0; border-bottom: 1px solid var(--line); display: none; }
  .site-nav ul.open { display: flex; }
  .site-nav ul li { border-top: 1px solid var(--line); }
  .site-nav a.navlink { display: block; padding: 16px var(--gutter); border-bottom: none; }
  .nav-toggle {
    display: block;
    background: none;
    border: none;
    font-family: var(--mono);
    font-size: 13px;
    text-transform: uppercase;
    cursor: pointer;
    color: var(--ink);
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: 96px 0 72px;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 34px 34px;
  background-position: center top;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.hero .wrap { position: relative; }
.hero-eyebrow { margin-bottom: 22px; }
.hero h1 {
  font-size: clamp(42px, 7vw, 82px);
  margin-bottom: 18px;
}
.hero .role {
  font-family: var(--display);
  font-size: clamp(18px, 2.4vw, 24px);
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 22px;
}
.hero .lede {
  max-width: 620px;
  font-size: 18px;
  color: var(--ink-soft);
  margin-bottom: 36px;
}
.hero .actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 40px; }
.hero .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}
.hero .meta a { text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.hero .meta a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Spec strip ---------- */
.spec-strip {
  background: var(--dark);
  color: var(--on-dark);
  padding: 34px 0;
  overflow: hidden;
}
.spec-strip .wrap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.spec-item .num {
  font-family: var(--display);
  font-size: clamp(24px, 3vw, 34px);
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.spec-item .label {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--on-dark-muted);
  margin-top: 4px;
}
@media (max-width: 860px) {
  .spec-strip .wrap { grid-template-columns: repeat(2, 1fr); row-gap: 26px; }
}

/* ---------- Section shell ---------- */
.section { padding: 88px 0; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 44px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: clamp(28px, 4vw, 38px); }
.section-head .desc { color: var(--muted); max-width: 420px; font-size: 15px; }

/* ---------- Project grid ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  background: var(--line);
  border: 1px solid var(--line);
}
.project-card {
  background: var(--paper);
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  position: relative;
}
.project-card .thumb {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--surface);
}
.project-card .thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
}
.project-card:hover .thumb img { transform: scale(1.045); }
.project-card .body { padding: 26px 28px 30px; flex: 1; display: flex; flex-direction: column; }
.project-card .tagrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 10px;
}
.project-card h3 { font-size: 23px; margin-bottom: 10px; }
.project-card .hook { color: var(--muted); font-size: 14.5px; flex: 1; }
.project-card .go {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.project-card .go .arrow { transition: transform 0.2s ease; }
.project-card:hover .go .arrow { transform: translateX(4px); }
@media (max-width: 760px) {
  .project-grid { grid-template-columns: 1fr; }
}

/* ---------- Experience preview / list ---------- */
.xp-list { border-top: 1px solid var(--line); }
.xp-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.xp-row .when { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.xp-row .who h4 { font-family: var(--body); font-weight: 600; font-size: 17px; margin-bottom: 3px; }
.xp-row .who .role { color: var(--muted); font-size: 14px; }
.xp-row .link { font-family: var(--mono); font-size: 12px; text-transform: uppercase; color: var(--accent-ink); white-space: nowrap; }
@media (max-width: 700px) {
  .xp-row { grid-template-columns: 1fr; gap: 6px; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 56px 0 40px;
  background: var(--surface);
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 28px;
}
.site-footer h3 { font-size: 26px; margin-bottom: 10px; }
.site-footer .foot-links {
  display: flex; flex-wrap: wrap; gap: 8px 24px;
  font-family: var(--mono); font-size: 13px;
}
.site-footer .foot-links a { text-decoration: none; color: var(--ink-soft); border-bottom: 1px solid var(--line-strong); }
.site-footer .foot-links a:hover { color: var(--accent); border-color: var(--accent); }
.site-footer .copyright { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 30px; }

/* ==========================================================================
   Project detail pages
   ========================================================================== */
.proj-hero {
  border-bottom: 1px solid var(--line);
  padding: 44px 0 0;
}
.proj-hero .backlink {
  font-family: var(--mono);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
}
.proj-hero .backlink:hover { color: var(--accent); }
.proj-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 34px;
}
.proj-hero .org {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.proj-hero h1 { font-size: clamp(34px, 5.5vw, 56px); max-width: 780px; }
.proj-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.proj-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.tag {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--line-strong);
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--ink-soft);
}
.proj-hero-img { width: 100%; aspect-ratio: 16/8; overflow: hidden; background: var(--surface); }
.proj-hero-img img { width: 100%; height: 100%; object-fit: cover; }

.proj-body { padding: 68px 0; }
.proj-block { display: grid; grid-template-columns: 220px 1fr; gap: 40px; padding: 46px 0; border-top: 1px solid var(--line); }
.proj-block:first-child { border-top: none; padding-top: 0; }
.proj-block .label {
  font-family: var(--mono);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-ink);
  display: flex;
  gap: 10px;
}
.proj-block .label .n { color: var(--line-strong); }
.proj-block .content ul { margin: 0; padding-left: 20px; }
.proj-block .content li { margin-bottom: 10px; }
.proj-block .content li:last-child { margin-bottom: 0; }
.proj-block .content p { font-size: 16.5px; }
.proj-block .content strong { color: var(--ink); }

.proj-figrow {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 26px;
}
.proj-figrow.single { grid-template-columns: 1fr; }
.proj-figrow.triple { grid-template-columns: repeat(3, 1fr); }
figure.fig { margin: 0; }
figure.fig img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--surface); border-radius: var(--radius); }
figure.fig figcaption {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 8px;
}
@media (max-width: 760px) {
  .proj-block { grid-template-columns: 1fr; gap: 14px; }
  .proj-figrow, .proj-figrow.triple { grid-template-columns: 1fr; }
}

.results-callouts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 28px;
}
.callout { background: var(--surface); padding: 24px 22px; }
.callout .num { font-family: var(--display); font-size: 30px; font-weight: 600; color: var(--accent-ink); }
.callout .desc { font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-top: 6px; }
@media (max-width: 700px) {
  .results-callouts { grid-template-columns: 1fr; }
}

.proj-gallery { border-top: 1px solid var(--line); padding: 60px 0; }
.proj-gallery .section-head { margin-bottom: 30px; }

.proj-nextprev {
  border-top: 1px solid var(--line);
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.proj-nextprev a { text-decoration: none; color: inherit; padding: 40px var(--gutter); display: block; }
.proj-nextprev a:first-child { border-right: 1px solid var(--line); }
.proj-nextprev .dir { font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.proj-nextprev h4 { font-size: 20px; }
.proj-nextprev a:hover { background: var(--surface); }
@media (max-width: 700px) {
  .proj-nextprev { grid-template-columns: 1fr; }
  .proj-nextprev a:first-child { border-right: none; border-bottom: 1px solid var(--line); }
}

/* ==========================================================================
   Experience page
   ========================================================================== */
.xp-card {
  border-top: 1px solid var(--line);
  padding: 52px 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
}
.xp-card:first-of-type { border-top: none; }
.xp-card .meta-col .when { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.xp-card .meta-col h3 { font-size: 24px; margin-bottom: 4px; }
.xp-card .meta-col .role { color: var(--muted); font-size: 14.5px; margin-bottom: 14px; }
.xp-card .meta-col .place { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.xp-card ul { margin: 0 0 18px; padding-left: 20px; }
.xp-card li { margin-bottom: 10px; font-size: 15.5px; }
.xp-card li:last-child { margin-bottom: 0; }
.xp-card .tagrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.xp-card .xp-figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 24px; }
.xp-card .xp-figs img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius); background: var(--surface); }
@media (max-width: 760px) {
  .xp-card { grid-template-columns: 1fr; gap: 16px; }
  .xp-card .xp-figs { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   Resume page
   ========================================================================== */
.resume-shell { padding: 60px 0 90px; }
.resume-frame-wrap {
  border: 1px solid var(--line);
  background: var(--surface);
  height: 82vh;
  min-height: 520px;
}
.resume-frame-wrap iframe { width: 100%; height: 100%; border: none; }
.resume-actions { display: flex; gap: 14px; margin-bottom: 26px; flex-wrap: wrap; }

/* Utility */
.only-print { display: none; }
