/* ==========================================================================
   Chase Hilgeman Portfolio — "Drawing Set" theme
   Blueprint navy with drafting-grid details. Every page is a numbered sheet.
   ========================================================================== */

:root {
  --bg: #0a1628;
  --bg-deep: #07101f;
  --surface: #0f2038;
  --surface-2: #142a48;
  --line: rgba(118, 176, 255, 0.20);
  --line-strong: rgba(118, 176, 255, 0.42);
  --grid: rgba(118, 176, 255, 0.035);
  --grid-major: rgba(118, 176, 255, 0.07);
  --ink: #d6e4f5;
  --muted: #88a0bf;
  --heading: #ffffff;
  --blue: #6cc4ff;
  --blue-soft: rgba(108, 196, 255, 0.12);
  --accent: #f0883e;
  --accent-strong: #f5a06a;
  --accent-soft: rgba(240, 136, 62, 0.12);
  --on-accent: #0a1628;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.30);
  --radius: 4px;
  --header-h: 68px;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Space Grotesk", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

/* Smooth cross-page transitions in browsers that support them */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 0.18s ease both; }
::view-transition-new(root) { animation: vt-in 0.28s ease both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--bg);
  /* drafting grid: minor 24px, major 120px */
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.25s ease, color 0.25s ease;
}

main { flex: 1; }
img { max-width: 100%; display: block; }
svg { display: block; }

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--accent); }

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

::selection { background: var(--accent); color: var(--on-accent); }

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 28px; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }

.icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border-bottom: 1px solid var(--line);
}

.nav { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 20px; }

.brand { display: flex; align-items: center; gap: 12px; color: var(--heading); }
.brand:hover { color: var(--heading); }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px dashed var(--line-strong);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-sub { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

.nav-links { display: flex; align-items: center; gap: 2px; list-style: none; }
.nav-links a {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.93rem;
  border: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-links a .num { font-family: var(--font-mono); font-size: 0.7rem; color: var(--blue); opacity: 0.8; }
.nav-links a:hover { color: var(--heading); border-color: var(--line); }
.nav-links a[aria-current="page"] { color: var(--heading); border-color: var(--line-strong); background: var(--blue-soft); }
.nav-links a[aria-current="page"] .num { color: var(--accent); opacity: 1; }

.nav-tools { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.menu-btn { display: none; }


/* ---------- Page header (sheet title) ---------- */
.page-head { padding: 72px 0 40px; }
.sheet-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.sheet-label::before { content: ""; width: 28px; height: 1.5px; background: currentColor; }

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--heading); letter-spacing: -0.02em; line-height: 1.12; }
.page-title { font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 700; letter-spacing: -0.035em; }
.page-title .hl { color: var(--accent); }
.page-intro { max-width: 640px; margin-top: 18px; font-size: 1.15rem; color: var(--muted); }

.section { padding: 32px 0 72px; }
.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1.35rem;
  margin-bottom: 26px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-title .mono { font-size: 0.78rem; color: var(--blue); font-weight: 500; letter-spacing: 0.05em; }

/* ---------- Sheet (card with registration corners) ---------- */
.sheet {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 28px;
  box-shadow: var(--shadow);
}
.sheet::before, .sheet::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 0 solid var(--accent);
  opacity: 0.65;
  pointer-events: none;
}
.sheet::before { top: -1px; left: -1px; border-top-width: 1.5px; border-left-width: 1.5px; }
.sheet::after { bottom: -1px; right: -1px; border-bottom-width: 1.5px; border-right-width: 1.5px; }

.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
}

/* ---------- Buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 22px;
  font: inherit;
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--heading);
  background: transparent;
  border: 1.5px solid var(--line-strong);
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}
.btn:hover { color: var(--accent); border-color: var(--accent); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 0.88rem; }
.btn .arrow { transition: transform 0.2s ease; }
.btn:hover .arrow { transform: translateX(4px); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.chip {
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: var(--blue-soft);
  white-space: nowrap;
}

.bullets { padding-left: 1.2em; display: grid; gap: 8px; }
.bullets li::marker { color: var(--accent); content: "▸  "; }

/* ---------- HOME ---------- */
.hero { padding: 56px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: center; }
.hero-title { font-size: clamp(2.6rem, 6vw, 4.4rem); font-weight: 700; letter-spacing: -0.035em; line-height: 1.02; }
.hero-title .line { display: block; }
.hero-title .role { margin-top: 0.35em; font-size: 0.42em; font-weight: 500; letter-spacing: -0.01em; color: var(--blue); }
.hero-lead { margin: 26px 0 32px; max-width: 540px; font-size: 1.18rem; color: var(--muted); }
.hero-lead strong { color: var(--ink); font-weight: 600; }

.collage { position: relative; width: 100%; max-width: 500px; aspect-ratio: 1 / 1; justify-self: center; }
.print {
  position: absolute;
  display: block;
  padding: 8px 8px 30px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.print img { width: 100%; height: 100%; object-fit: cover; }
.print-label {
  position: absolute;
  left: 10px;
  bottom: 8px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.print-main { left: 3%; top: 0; width: 56%; height: 78%; transform: rotate(-3deg); z-index: 2; }
.print-main img { object-position: 50% 30%; }
.print-flag { right: 2%; top: 6%; width: 40%; height: 42%; transform: rotate(4deg); z-index: 1; }
.print-knife { right: 0; bottom: 2%; width: 54%; height: 44%; transform: rotate(2.5deg); z-index: 3; }
.print:hover { z-index: 5; transform: rotate(0deg) translateY(-6px); box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55); }
.print:hover .print-label { color: var(--accent); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  margin: 40px 0 64px;
}
.stat { padding: 22px 24px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat-num { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; color: var(--heading); line-height: 1; letter-spacing: -0.03em; }
.stat-num .unit { color: var(--accent); font-size: 1.4rem; }
.stat-label { margin-top: 8px; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.index-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 40px; }
.connect { display: flex; align-items: center; justify-content: space-between; gap: 24px 40px; flex-wrap: wrap; margin-bottom: 88px; }
.connect h2 { font-size: 1.6rem; margin: 6px 0 6px; }
.connect p { color: var(--muted); max-width: 480px; }
.btn-linkedin { flex-basis: 100%; }
.index-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 190px;
  color: var(--ink);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.index-card:hover { color: var(--ink); transform: translateY(-4px); border-color: var(--accent); }
.index-card .top { display: flex; justify-content: space-between; align-items: center; }
.index-card .sheet-no { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.index-card h3 { font-size: 1.45rem; margin-top: auto; }
.index-card p { font-size: 0.95rem; color: var(--muted); }
.index-card .go { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent); letter-spacing: 0.06em; text-transform: uppercase; }
.index-card .go .icon { width: 16px; height: 16px; transition: transform 0.2s ease; }
.index-card:hover .go .icon { transform: translateX(4px); }

/* ---------- ABOUT ---------- */
.about-grid { display: grid; grid-template-columns: 340px 1fr; gap: 56px; align-items: start; }
.portrait { position: sticky; top: calc(var(--header-h) + 24px); }
.portrait-frame { position: relative; padding: 14px; border: 1px solid var(--line-strong); background: var(--surface); }
.portrait-frame img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; filter: saturate(0.9) contrast(1.03); }
.portrait-frame .cross { position: absolute; width: 22px; height: 22px; }
.portrait-frame .cross::before, .portrait-frame .cross::after { content: ""; position: absolute; background: var(--accent); }
.portrait-frame .cross::before { left: 50%; top: 0; bottom: 0; width: 1.5px; transform: translateX(-50%); }
.portrait-frame .cross::after { top: 50%; left: 0; right: 0; height: 1.5px; transform: translateY(-50%); }
.cross.tl { top: -11px; left: -11px; } .cross.tr { top: -11px; right: -11px; }
.cross.bl { bottom: -11px; left: -11px; } .cross.br { bottom: -11px; right: -11px; }
.portrait-caption { display: flex; justify-content: space-between; margin-top: 12px; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

.prose p { margin-bottom: 20px; font-size: 1.08rem; }

.skill-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.skill-card { padding: 24px; border: 1px solid var(--line); background: var(--surface); transition: border-color 0.2s ease; }
.skill-card:hover { border-color: var(--line-strong); }
.skill-ico { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 16px; border: 1px solid var(--accent); color: var(--accent); }
.skill-card h3 { font-size: 1.1rem; }
.skill-level { margin: 4px 0 16px; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--blue); }

.interest-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.interest { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border: 1px solid var(--line); background: var(--surface); transition: border-color 0.2s ease; }
.interest:hover { border-color: var(--line-strong); }
.interest .ico { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--accent); color: var(--accent); flex-shrink: 0; }
.interest h4 { font-size: 1rem; margin-bottom: 2px; }
.interest p { font-size: 0.9rem; color: var(--muted); line-height: 1.5; }

.edu-block { display: grid; grid-template-columns: 1fr auto; gap: 16px 32px; align-items: center; }
.edu-block h3 { font-size: 1.3rem; margin: 6px 0 4px; }
.edu-block .grad { text-align: right; }
.edu-block .grad .yr { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; color: var(--accent); line-height: 1; }

/* ---------- EXPERIENCE ---------- */
.rev-list { display: grid; gap: 28px; }
.rev { display: grid; grid-template-columns: 200px 1fr; gap: 0; padding: 0; }
.rev-side { padding: 28px 24px; border-right: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; gap: 18px; }
.rev-side .k { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.rev-side .v { font-family: var(--font-mono); font-size: 0.92rem; color: var(--heading); }
.rev-side .v.accent { color: var(--accent); }
.rev-main { padding: 28px 30px; }
.rev-main h2 { font-size: 1.55rem; margin-bottom: 4px; }
.rev-main .org { color: var(--blue); font-weight: 600; margin-bottom: 18px; }
.rev-main .bullets { margin-bottom: 22px; }
.rev-main .chips { margin-bottom: 22px; }

/* ---------- PROJECTS ---------- */
.project-list { display: grid; gap: 36px; }
.project { display: grid; grid-template-columns: 1fr 1fr; padding: 0; }
.project:nth-child(even) .project-art { order: 2; border-right: 0; border-left: 1px solid var(--line); }
.project-art {
  position: relative;
  min-height: 340px;
  display: grid;
  place-items: center;
  padding: 28px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(var(--grid-major) 1px, transparent 1px) -1px -1px / 40px 40px,
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px) -1px -1px / 40px 40px,
    var(--bg-deep);
  overflow: hidden;
}
.project-art .corner-label { position: absolute; top: 14px; left: 16px; font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

/* Photo panels */
.project-art.photo-knife { padding: 0; background: #b8c6d7; }
.project-art.photo-cover { padding: 0; }
.project-art.photo-cover img { object-position: 50% 30%; }
.project-art.photo-knife .corner-label { color: #34445a; z-index: 1; pointer-events: none; }
.photo-link { position: absolute; inset: 0; overflow: hidden; }
.photo-link img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.photo-link:hover img { transform: scale(1.03); }

.photo-pair { display: flex; gap: 20px; align-items: flex-end; justify-content: center; width: 100%; }
.photo-pair figure { flex: 1 1 0; max-width: 230px; }
.photo-pair img {
  width: 100%;
  height: auto;
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.photo-pair figcaption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.project-body { padding: 30px; display: flex; flex-direction: column; }
.project-body h2 { font-size: 1.75rem; margin: 8px 0 12px; }
.project-body > p { color: var(--muted); margin-bottom: 18px; }
.project-body .bullets { margin-bottom: 22px; font-size: 0.98rem; }

.title-block { margin-top: auto; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-strong); }
.title-block div { padding: 8px 12px; border-right: 1px solid var(--line); }
.title-block div:last-child { border-right: 0; }
.title-block .k { display: block; font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.title-block .v { font-family: var(--font-mono); font-size: 0.82rem; color: var(--heading); }

/* ---------- DOCUMENTS ---------- */
.doc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 88px; }
.doc { display: flex; flex-direction: column; padding: 0; color: var(--ink); transition: transform 0.2s ease, border-color 0.2s ease; }
.doc:hover { color: var(--ink); transform: translateY(-5px); border-color: var(--accent); }
.doc-thumb {
  height: 230px;
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 46px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(var(--grid-major) 1px, transparent 1px) -1px -1px / 20px 20px,
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px) -1px -1px / 20px 20px,
    var(--bg-deep);
  overflow: hidden;
}
/* Fade the bottom of the page preview into the card */
.doc-thumb::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
  background: linear-gradient(transparent, var(--bg-deep));
  pointer-events: none;
}
.paper {
  width: 172px;
  height: auto;
  align-self: flex-start;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  transform: rotate(-2deg) translateY(6px);
  transform-origin: top center;
  transition: transform 0.3s ease;
}
.doc:hover .paper { transform: rotate(0deg) translateY(-4px) scale(1.04); }
.doc-type { position: absolute; z-index: 2; top: 12px; right: 12px; font-family: var(--font-mono); font-size: 0.66rem; padding: 2px 7px; background: var(--accent); color: var(--on-accent); font-weight: 600; letter-spacing: 0.06em; }
.doc-body { padding: 18px 20px 20px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex: 1; }
.doc-body h3 { font-size: 1.1rem; margin-top: 4px; }
.doc-body .icon { color: var(--muted); transition: transform 0.2s ease, color 0.2s ease; }
.doc:hover .doc-body .icon { color: var(--accent); transform: translateX(4px); }

/* ---------- CONTACT ---------- */
.contact-card { container-type: inline-size; }
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 32px; align-items: start; margin-bottom: 88px; }
.big-email {
  display: block;
  font-family: var(--font-display);
  font-size: min(1.75rem, 5.9cqi);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 10px 0 22px;
  line-height: 1.2;
}
.big-email:hover { color: var(--accent); }
.contact-list { list-style: none; display: grid; gap: 0; margin-top: 26px; border-top: 1px solid var(--line); }
.contact-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.contact-list .k { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.contact-list .v { font-weight: 600; color: var(--heading); text-align: right; }
.contact-list a.v:hover { color: var(--accent); }

.form { display: grid; gap: 16px; }
.form h2 { font-size: 1.4rem; }
.field { display: grid; gap: 6px; }
.field label { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea {
  font: inherit;
  font-size: 1rem;
  color: var(--heading);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  padding: 12px 14px;
  border-radius: 0;
  transition: border-color 0.15s ease;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-note { font-size: 0.85rem; color: var(--muted); }

/* ---------- 404 ---------- */
.lost { min-height: 60vh; display: grid; place-items: center; text-align: center; padding: 80px 0; }
.lost .code { font-family: var(--font-display); font-size: clamp(6rem, 22vw, 13rem); font-weight: 700; line-height: 0.9; color: transparent; -webkit-text-stroke: 2px var(--blue); letter-spacing: -0.05em; }
.lost h1 { font-size: 2rem; margin: 18px 0 10px; }
.lost p { color: var(--muted); margin-bottom: 28px; }
.lost .btn-row { justify-content: center; }

/* ---------- Footer / title block ---------- */
.site-footer { border-top: 1px solid var(--line-strong); background: var(--surface); }
.tb { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr; }
.tb > div { padding: 14px 18px; border-right: 1px solid var(--line); }
.tb > div:last-child { border-right: 0; }
.tb .k { display: block; font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.tb .v { font-family: var(--font-mono); font-size: 0.85rem; color: var(--heading); }
.tb .v a { color: var(--heading); }
.tb .v.links { display: flex; flex-wrap: wrap; gap: 2px 16px; }
.tb .v a:hover { color: var(--accent); }
.tb .title .v { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }


/* ---------- PDF viewer dialog ---------- */
dialog.viewer {
  width: min(1000px, 92vw);
  height: 88vh;
  max-width: none;
  max-height: none;
  margin: auto;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
dialog.viewer[open] { display: flex; flex-direction: column; animation: pop 0.2s ease; }
dialog.viewer::backdrop { background: rgba(4, 10, 20, 0.75); backdrop-filter: blur(4px); }
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--line); }
.viewer-head h2 { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-actions { display: flex; gap: 8px; }
.viewer iframe { flex: 1; width: 100%; border: 0; background: #525659; }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 2000;
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--accent);
  color: var(--on-accent);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  @view-transition { navigation: none; }
}

/* ========== Tablet ========== */
@media (max-width: 960px) {
  .nav-links a .num { display: none; }
  .hero-grid { grid-template-columns: 1fr; }
  .collage { max-width: 440px; }
  .skill-grid { grid-template-columns: 1fr 1fr; }
  .index-grid, .doc-grid { grid-template-columns: repeat(2, 1fr); }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .portrait { position: static; max-width: 320px; }
  .project { grid-template-columns: 1fr; }
  .project-art, .project:nth-child(even) .project-art { order: 0; border: 0; border-bottom: 1px solid var(--line); min-height: 260px; }
  .contact-grid { grid-template-columns: 1fr; }
  .tb { grid-template-columns: repeat(4, 1fr); }
  .tb .title { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ========== Mobile ========== */
@media (max-width: 760px) {
  :root { --header-h: 62px; }
  body { font-size: 1rem; background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px; }
  .wrap { padding: 0 16px; }

  .menu-btn { display: grid; }
  .brand-sub { display: none; }
  .nav-links {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 16px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 12px; font-size: 1.05rem; border: 0; border-bottom: 1px solid var(--line); }
  .nav-links li:last-child a { border-bottom: 0; }
  .nav-links a .num { display: inline; }

  .page-head { padding: 44px 0 28px; }
  .page-intro { font-size: 1.05rem; }
  .section { padding: 20px 0 56px; }
  .sheet { padding: 22px 18px; }
  .sheet.project, .sheet.rev, .sheet.doc { padding: 0; }
  .project-art .corner-label { display: none; }
  .doc-thumb { height: 200px; padding-top: 42px; }
  .paper { width: 150px; }

  .hero { padding: 32px 0 24px; }
  .hero-lead { font-size: 1.05rem; }
  .btn-row .btn { flex: 1 1 auto; }
  .collage { max-width: min(360px, calc(100% - 24px)); margin-top: 8px; }
  .contact-card { padding-left: 14px; padding-right: 14px; }
  .print { padding: 6px 6px 26px; }
  .print-label { font-size: 0.6rem; left: 8px; bottom: 7px; }

  .stats { grid-template-columns: 1fr 1fr; margin: 28px 0 48px; }
  .stat { padding: 18px; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .stat-num { font-size: 1.8rem; }

  .index-grid, .doc-grid, .interest-grid { grid-template-columns: 1fr; }
  .index-grid, .doc-grid, .contact-grid { margin-bottom: 56px; }
  .index-grid { margin-bottom: 24px; }
  .connect { margin-bottom: 56px; }
  .connect .btn-row { width: 100%; }
  .connect .btn { flex: 1 1 100%; }
  .index-card { min-height: 0; }
  .index-card:hover, .doc:hover { transform: none; }

  .skill-grid { grid-template-columns: 1fr; }
  .skill-card { padding: 20px; }

  .edu-block { grid-template-columns: 1fr; }
  .edu-block .grad { text-align: left; }

  .rev { grid-template-columns: 1fr; }
  .rev-side { flex-direction: row; flex-wrap: wrap; gap: 12px 28px; border-right: 0; border-bottom: 1px solid var(--line); padding: 18px; }
  .rev-main { padding: 22px 18px; }
  .rev-main .btn-row .btn { flex: 1 1 100%; }

  .project-art { min-height: 220px; padding: 20px; }
  .project-art.photo-cover { aspect-ratio: 1 / 1; }
  .project-body { padding: 22px 18px; }
  .title-block { grid-template-columns: 1fr 1fr; }
  .title-block div:nth-child(2) { border-right: 0; }
  .title-block div:nth-child(3) { grid-column: 1 / -1; border-top: 1px solid var(--line); }

  .contact-list li { flex-direction: column; align-items: flex-start; gap: 2px; }
  .contact-list .v { text-align: left; }

  .tb { grid-template-columns: 1fr 1fr; }
  .tb > div { border-bottom: 1px solid var(--line); }
  .tb > div:nth-child(odd):not(.title) { border-right: 0; }
  .tb > div:nth-child(even) { border-right: 1px solid var(--line); }
  .tb > div:last-child { border-bottom: 0; }
}
