/* ============================================================
   Yan Jumpaengjan — Portfolio v2 professional refresh
   Dark/light themes, restrained enterprise/security aesthetic
   ============================================================ */

:root,
[data-theme="dark"] {
  --bg: #08090c;
  --bg-1: #0d1017;
  --panel: #10141d;
  --panel-2: #161b26;
  --surface: rgba(255,255,255,0.035);
  --surface-strong: rgba(255,255,255,0.065);
  --line: rgba(255,255,255,0.075);
  --line-2: rgba(255,255,255,0.12);
  --line-3: rgba(255,255,255,0.20);

  --fg: #f4f7fb;
  --fg-2: #c7d0dd;
  --fg-3: #8d99aa;
  --fg-4: #5f6b7a;

  --warm: #6ea8ff;
  --warm-deep: #3f7ee8;
  --cool: #8b5cf6;
  --cool-deep: #6d45dd;
  --ok: #35d07f;

  --warm-glow: 110 168 255;
  --cool-glow: 139 92 246;

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 18px;
  --radius-sm: 10px;
  --maxw: 1180px;
  --pad-x: clamp(20px, 5vw, 64px);
  --shadow: 0 24px 80px rgba(0,0,0,.34);
}

[data-theme="light"] {
  --bg: #f6f8fb;
  --bg-1: #eef2f7;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --surface: rgba(15,23,42,0.035);
  --surface-strong: rgba(15,23,42,0.065);
  --line: rgba(15,23,42,0.09);
  --line-2: rgba(15,23,42,0.14);
  --line-3: rgba(15,23,42,0.24);

  --fg: #0f172a;
  --fg-2: #334155;
  --fg-3: #64748b;
  --fg-4: #94a3b8;

  --warm: #2563eb;
  --warm-deep: #1d4ed8;
  --cool: #7c3aed;
  --cool-deep: #6d28d9;
  --ok: #059669;

  --warm-glow: 37 99 235;
  --cool-glow: 124 58 237;
  --shadow: 0 24px 70px rgba(15,23,42,.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-feature-settings: "cv01", "ss03";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background .25s ease, color .25s ease;
}

::selection { background: rgba(var(--warm-glow), .26); color: var(--fg); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

.page { position: relative; min-height: 100vh; isolation: isolate; }
.atmos { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
[data-theme="dark"] .atmos {
  background:
    radial-gradient(900px 520px at 10% -10%, rgba(var(--warm-glow), .16), transparent 65%),
    radial-gradient(760px 480px at 92% 6%, rgba(var(--cool-glow), .12), transparent 62%),
    linear-gradient(180deg, rgba(255,255,255,.018), transparent 36%);
}
[data-theme="light"] .atmos {
  background:
    radial-gradient(900px 520px at 10% -10%, rgba(var(--warm-glow), .10), transparent 65%),
    radial-gradient(760px 480px at 92% 6%, rgba(var(--cool-glow), .07), transparent 62%),
    linear-gradient(180deg, #fff, transparent 30%);
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad-x); position: relative; z-index: 1; }

/* Type */
h1, h2, h3, h4 { margin: 0; color: var(--fg); }
h1 {
  font-family: var(--sans);
  font-size: clamp(46px, 7vw, 86px);
  line-height: .98;
  letter-spacing: -0.055em;
  font-weight: 590;
  max-width: 900px;
}
h2 {
  font-family: var(--sans);
  font-size: clamp(32px, 4.2vw, 54px);
  line-height: 1.04;
  letter-spacing: -0.045em;
  font-weight: 590;
}
h3 { font-family: var(--sans); font-size: 19px; font-weight: 590; letter-spacing: -0.02em; line-height: 1.35; }
h4 { font-size: 12px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-3); }
p { margin: 0; color: var(--fg-2); font-size: 16px; line-height: 1.72; }
.lead { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.65; color: var(--fg-2); font-weight: 400; max-width: 64ch; }
.italic { font-style: normal; }
.serif { font-family: var(--sans); }
.mono { font-family: var(--mono); font-feature-settings: "ss01", "cv01"; }

.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); }
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 5px rgba(53,208,127,.10); }

.section { position: relative; padding: clamp(76px, 9vw, 132px) 0; }
.section-head { display: flex; flex-direction: column; gap: 18px; margin-bottom: clamp(34px, 5vw, 58px); max-width: 760px; }
.section-head p { color: var(--fg-3); max-width: 60ch; }

/* Buttons */
.btn, .nav-cta, .theme-switch {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--fg);
  font-size: 14px; font-weight: 560;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
  white-space: nowrap;
}
.btn { padding: 12px 18px; }
.btn:hover, .theme-switch:hover { transform: translateY(-1px); background: var(--surface-strong); border-color: var(--line-3); }
.btn--primary, .nav-cta {
  background: linear-gradient(180deg, var(--warm), var(--warm-deep));
  color: #fff;
  border-color: rgba(255,255,255,.16);
  box-shadow: 0 14px 34px -18px rgba(var(--warm-glow), .80), inset 0 1px 0 rgba(255,255,255,.28);
}
.btn--primary:hover, .nav-cta:hover { box-shadow: 0 18px 44px -18px rgba(var(--warm-glow), .95), inset 0 1px 0 rgba(255,255,255,.32); }
.arrow { width: 14px; height: 14px; transition: transform .2s ease; }
.btn:hover .arrow { transform: translate(3px, -3px); }

/* Cards */
.card, .about-card, .exploring, .contact-card {
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.card { position: relative; border-radius: var(--radius); overflow: hidden; transition: border-color .2s ease, transform .2s ease, background .2s ease; }
.card:hover { border-color: var(--line-2); transform: translateY(-3px); }
.card .spot { position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(420px 220px at var(--mx,50%) var(--my,0%), rgba(var(--warm-glow), .12), transparent 68%); opacity: 0; transition: opacity .25s ease; pointer-events: none; }
.card:hover .spot { opacity: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 12px; font-weight: 560; color: var(--fg-2); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }

/* Nav */
.nav { position: fixed; top: 18px; left: 0; right: 0; z-index: 100; display: flex; justify-content: center; pointer-events: none; padding: 0 112px 0 16px; }
.nav-inner { pointer-events: auto; display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 18px; background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%); border: 1px solid var(--line-2); border-radius: 999px; box-shadow: 0 18px 46px -24px rgba(0,0,0,.55); }
.nav-brand { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 650; letter-spacing: -0.01em; padding-right: 18px; margin-right: 4px; border-right: 1px solid var(--line); }
.nav-brand .mark { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--warm), var(--cool)); box-shadow: 0 0 0 1px rgba(255,255,255,.18), 0 10px 22px -12px rgba(var(--warm-glow), .85); position: relative; }
.nav-brand .mark::after { content: ""; position: absolute; inset: 6px 5px; border-radius: 2px; border: 1px solid rgba(255,255,255,.75); border-top: 0; }
.nav a.nav-link { padding: 9px 13px; font-size: 13.5px; font-weight: 540; color: var(--fg-3); border-radius: 999px; transition: color .18s ease, background .18s ease; }
.nav a.nav-link:hover, .nav a.nav-link.active { color: var(--fg); background: var(--surface-strong); }
.nav-cta { padding: 9px 15px; font-size: 13.5px; }
.theme-switch { position: fixed; top: 18px; right: 18px; z-index: 110; height: 44px; padding: 0 14px; background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%); }
.theme-switch .theme-icon { font-size: 15px; line-height: 1; }
.theme-switch .theme-label { font-size: 13px; font-weight: 590; color: var(--fg-2); }
@media (max-width: 820px) { .nav { justify-content: flex-start; padding-right: 86px; } .nav-links, .nav-cta { display: none !important; } .nav-brand { border-right: 0; padding-right: 8px; } .theme-switch .theme-label { display: none; } .theme-switch { width: 44px; padding: 0; } }

/* Hero */
.hero { position: relative; padding: clamp(150px, 18vh, 205px) 0 clamp(78px, 10vw, 128px); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.28fr .92fr; gap: clamp(42px, 6vw, 72px); align-items: center; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1 .accent { color: var(--warm); font-style: normal; }
.hero h1 .name { font-weight: 590; }
.hero-status { display: inline-flex; align-items: center; gap: 10px; padding: 7px 13px 7px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 540; color: var(--fg-2); }
.hero-status .live { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 14px rgba(53,208,127,.75); }
.hero-status .live::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--ok) 55%, transparent); animation: ping 1.9s ease-out infinite; }
@keyframes ping { from { transform: scale(.55); opacity: .85; } to { transform: scale(1.65); opacity: 0; } }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 34px; }
.hero-side { position: relative; aspect-ratio: 1 / 1.04; border-radius: 28px; border: 1px solid var(--line); background: radial-gradient(closest-side at 30% 28%, rgba(var(--warm-glow), .22), transparent 72%), radial-gradient(closest-side at 82% 80%, rgba(var(--cool-glow), .16), transparent 72%), linear-gradient(180deg, var(--panel), var(--bg-1)); overflow: hidden; box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.06); }
[data-theme="light"] .hero-side { background: radial-gradient(closest-side at 30% 28%, rgba(var(--warm-glow), .15), transparent 72%), radial-gradient(closest-side at 82% 80%, rgba(var(--cool-glow), .10), transparent 72%), linear-gradient(180deg, #fff, #eef2f7); }
.hero-side svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-side-caption { position: absolute; left: 22px; bottom: 22px; right: 22px; display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 11px; color: var(--fg-3); letter-spacing: .06em; }
.netnode { transform-origin: center; animation: nodepulse 4s ease-in-out infinite; }
@keyframes nodepulse { 0%,100% { opacity:.52; transform:scale(1); } 50% { opacity:1; transform:scale(1.25); } }
.hero-meta { margin-top: 34px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; border-top: 1px solid var(--line); padding-top: 26px; max-width: 570px; }
.hero-meta .item .lbl { font-size: 11px; color: var(--fg-4); letter-spacing: .11em; text-transform: uppercase; margin-bottom: 6px; font-weight: 650; }
.hero-meta .item .val { font-size: 14.5px; color: var(--fg); font-weight: 590; }

/* About */
.about { display: grid; grid-template-columns: 1.15fr .95fr; gap: clamp(40px, 6vw, 70px); align-items: start; }
@media (max-width: 920px) { .about { grid-template-columns: 1fr; } }
.about-card { padding: 26px; border-radius: 16px; display: flex; flex-direction: column; gap: 11px; box-shadow: none; }
.about-card .num { font-family: var(--mono); font-size: 11px; color: var(--warm); letter-spacing: .08em; }
.about-card h3 { font-size: 17px; }
.about-card p { font-size: 14.5px; color: var(--fg-3); line-height: 1.65; }
.about-quote { margin-top: 22px; padding-left: 18px; border-left: 2px solid var(--warm); font-family: var(--sans); font-style: normal; font-size: 18px; color: var(--fg-2); line-height: 1.6; }
.about-quote .sig { display: block; margin-top: 14px; font-size: 12px; color: var(--fg-4); letter-spacing: .04em; }

/* Projects */
.proj-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 820px) { .proj-grid { grid-template-columns: 1fr; } }
.proj { padding: 26px; display: flex; flex-direction: column; gap: 14px; min-height: 334px; cursor: pointer; }
.proj-visual { position: relative; height: 178px; margin: -8px -8px 6px; border-radius: 15px; overflow: hidden; background: radial-gradient(700px 240px at 50% 100%, rgba(var(--warm-glow), .12), transparent 60%), linear-gradient(180deg, var(--panel), var(--bg-1)); border: 1px solid var(--line); }
[data-theme="light"] .proj-visual { background: radial-gradient(700px 240px at 50% 100%, rgba(var(--warm-glow), .09), transparent 60%), linear-gradient(180deg, #fff, #eef2f7); }
.proj-visual svg { width: 100%; height: 100%; display: block; }
.proj-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.proj h3, .post h3 { font-family: var(--sans); font-weight: 590; letter-spacing: -0.03em; }
.proj h3 { font-size: 24px; line-height: 1.18; }
.proj-kind { font-family: var(--mono); font-size: 11px; color: var(--fg-4); letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.proj p { font-size: 14.5px; color: var(--fg-3); line-height: 1.62; }
.proj-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.proj-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 11.5px; color: var(--fg-4); }
.proj-go { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-2); transition: gap .18s ease, color .18s ease; }
.proj:hover .proj-go { color: var(--warm); gap: 10px; }

/* Exploring */
.exploring { display: grid; grid-template-columns: .9fr 2fr; gap: 36px; align-items: start; padding: 34px 36px; border-radius: 22px; }
@media (max-width: 820px) { .exploring { grid-template-columns: 1fr; gap: 24px; padding: 26px; } }
.expl-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .expl-list { grid-template-columns: 1fr; } }
.expl-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 15px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.expl-glyph { width: 32px; height: 32px; flex-shrink: 0; border-radius: 9px; background: linear-gradient(135deg, rgba(var(--warm-glow), .22), rgba(var(--cool-glow), .16)); border: 1px solid var(--line-2); display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 590; color: var(--fg); }
.expl-item .name { font-size: 14px; font-weight: 650; color: var(--fg); }
.expl-item .note { font-size: 12.5px; color: var(--fg-3); margin-top: 2px; line-height: 1.48; }

/* Blog */
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 980px) { .blog-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .blog-grid { grid-template-columns: 1fr; } }
.post-link { display: block; color: inherit; text-decoration: none; height: 100%; }
.post-link:focus-visible { outline: 2px solid rgba(var(--warm-glow), .85); outline-offset: 4px; border-radius: 20px; }
.post { display: flex; flex-direction: column; padding: 0; cursor: pointer; height: 100%; }
.post-img { aspect-ratio: 16/10; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--surface-strong); }
.post-img svg, .post-img img { width: 100%; height: 100%; display: block; }
.post-img img { object-fit: cover; transition: transform .35s ease, filter .35s ease; }
.post-link:hover .post-img img { transform: scale(1.03); filter: saturate(1.05) contrast(1.05); }
.blog-status { margin: -14px 0 22px; color: var(--fg-3); font-size: 14px; }
.post-body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post h3 { font-size: 21px; line-height: 1.23; }
.post p { font-size: 14px; color: var(--fg-3); line-height: 1.58; }
.post-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.post-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 12px; font-family: var(--mono); font-size: 11.5px; color: var(--fg-4); border-top: 1px solid var(--line); }

/* Contact */
.contact-card { position: relative; padding: clamp(38px, 6vw, 70px); border-radius: 28px; overflow: hidden; }
.contact-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(850px 360px at 0% 0%, rgba(var(--warm-glow), .14), transparent 62%), radial-gradient(850px 360px at 100% 100%, rgba(var(--cool-glow), .10), transparent 62%); pointer-events: none; }
.contact-grid { position: relative; display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: end; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; gap: 32px; } }
.contact h2 { font-size: clamp(34px, 4.2vw, 54px); }
.contact h2 .italic { color: var(--warm); }
.contact-list { display: flex; flex-direction: column; gap: 10px; }
.contact-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.contact-row:hover { background: var(--surface-strong); border-color: var(--line-2); transform: translateY(-1px); }
.contact-row .lbl { font-size: 11px; color: var(--fg-4); letter-spacing: .10em; text-transform: uppercase; margin-bottom: 3px; font-weight: 650; }
.contact-row .val { font-size: 14.5px; color: var(--fg); overflow-wrap: anywhere; }
.contact-row .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-strong); color: var(--fg-2); transition: background .18s ease, color .18s ease; flex: 0 0 auto; }
.contact-row:hover .ic { background: rgba(var(--warm-glow), .16); color: var(--warm); }

/* Footer */
.footer { padding: 54px 0 36px; border-top: 1px solid var(--line); margin-top: 58px; }
.footer-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer-row p { font-size: 13.5px; color: var(--fg-3); }
.footer-row .links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-row .links a { font-size: 13px; color: var(--fg-3); }
.footer-row .links a:hover { color: var(--fg); }
.footer-mini { margin-top: 28px; font-family: var(--mono); font-size: 11px; color: var(--fg-4); }

.fade-in { opacity: 0; transform: translateY(8px); animation: fadeIn .65s cubic-bezier(.2,.7,.2,1) forwards; }
@keyframes fadeIn { to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  h1 { font-size: clamp(40px, 13vw, 54px); }
  .hero { padding-top: 126px; }
  .hero-meta { grid-template-columns: 1fr; gap: 12px; }
  .section-head[style] { flex-direction: column !important; align-items: flex-start !important; }
  .section-head .btn { align-self: flex-start !important; }
  .btn { width: auto; }
}


/* ============================================================
   Polish pass — integrated header, contrast, spacing, accessibility
   ============================================================ */
:root,
[data-theme="dark"] {
  --fg-2: #d4dbe7;
  --fg-3: #a6b1c2;
  --fg-4: #7c8797;
  --line: rgba(255,255,255,0.10);
  --line-2: rgba(255,255,255,0.16);
}
[data-theme="light"] {
  --fg-2: #263445;
  --fg-3: #4f5f73;
  --fg-4: #738197;
  --line: rgba(15,23,42,0.11);
  --line-2: rgba(15,23,42,0.18);
}

.nav { padding: 0 16px; }
.nav-inner {
  gap: 5px;
  padding: 8px;
  max-width: min(calc(100vw - 32px), 940px);
}
.nav-brand { padding-left: 10px; margin-right: 2px; }
.theme-switch {
  position: static;
  height: 36px;
  min-width: 84px;
  padding: 0 13px;
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}
.theme-switch .theme-icon { width: 16px; text-align: center; }

.hero {
  padding-top: clamp(136px, 16vh, 180px);
  padding-bottom: clamp(58px, 8vw, 104px);
}
h1 {
  font-size: clamp(42px, 6.15vw, 76px);
  letter-spacing: -0.052em;
  max-width: 820px;
}
.hero-grid { grid-template-columns: 1.18fr .92fr; }
.hero-side { max-width: 430px; justify-self: end; }
.section { padding: clamp(58px, 7.2vw, 108px) 0; }
p, .lead, .proj p, .post p, .about-card p, .expl-item .note { color: var(--fg-2); }
.proj-kind, .post-foot, .proj-foot, .footer-mini, .hero-side-caption { color: var(--fg-3); }
.chip {
  color: var(--fg-2);
  background: color-mix(in srgb, var(--surface-strong) 70%, transparent);
}
.proj-go { font-size: 12px; font-weight: 650; letter-spacing: .01em; }
.card, .about-card, .exploring, .contact-card { box-shadow: 0 18px 56px rgba(0,0,0,.20); }
[data-theme="light"] .card,
[data-theme="light"] .about-card,
[data-theme="light"] .exploring,
[data-theme="light"] .contact-card { box-shadow: 0 18px 56px rgba(15,23,42,.075); }
.proj-visual, .post-img { filter: saturate(.9) contrast(1.08); }
.exploring h2 { font-size: clamp(30px, 3.6vw, 46px); }
.expl-list { gap: 16px; }
.contact-row .val { font-weight: 540; }
.footer-row .links a, .footer-row p { color: var(--fg-2); }

.btn:focus-visible,
.nav a:focus-visible,
.theme-switch:focus-visible,
.contact-row:focus-visible,
.card:focus-visible {
  outline: 2px solid var(--warm);
  outline-offset: 3px;
}

@media (max-width: 820px) {
  .nav-inner { width: auto; }
  .theme-switch {
    display: inline-flex;
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
  }
  .theme-switch .theme-label { display: none; }
  .hero-side { justify-self: stretch; max-width: none; }
}
@media (max-width: 640px) {
  .nav { top: 12px; padding: 0 12px; }
  .nav-brand span:last-child { max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hero { padding-top: 118px; }
  h1 { font-size: clamp(38px, 12vw, 52px); letter-spacing: -0.045em; }
  .hero-cta .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}


/* Project case-study modal */
body.modal-open { overflow: hidden; }
.project-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 44px);
  background: rgba(3, 6, 12, .72);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
}
.project-dialog {
  position: relative;
  width: min(1080px, 100%);
  max-height: min(820px, calc(100vh - 48px));
  overflow: auto;
  border-radius: 28px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 94%, transparent), var(--bg-1));
  box-shadow: 0 32px 110px rgba(0,0,0,.52);
}
[data-theme="light"] .project-dialog { background: linear-gradient(180deg, #fff, #f8fafc); box-shadow: 0 32px 90px rgba(15,23,42,.24); }
.project-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--surface-strong);
  color: var(--fg);
  font-size: 25px;
  line-height: 1;
}
.project-close:hover { background: rgba(var(--warm-glow), .14); border-color: var(--line-3); }
.project-dialog-grid { display: grid; grid-template-columns: .86fr 1.25fr; gap: clamp(24px, 4vw, 46px); padding: clamp(24px, 4.6vw, 54px); }
.project-dialog-aside { display: flex; flex-direction: column; gap: 18px; }
.project-dialog-visual { min-height: 290px; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); background: radial-gradient(700px 240px at 50% 100%, rgba(var(--warm-glow), .13), transparent 60%), linear-gradient(180deg, var(--panel), var(--bg-1)); }
.project-dialog-visual svg { width: 100%; height: 100%; display: block; }
.project-meta-list { display: grid; gap: 10px; }
.project-meta-list div { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.project-meta-list span { display: block; margin-bottom: 4px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .11em; text-transform: uppercase; color: var(--fg-4); }
.project-meta-list strong { font-size: 14px; color: var(--fg); font-weight: 620; }
.project-dialog-body { display: flex; flex-direction: column; gap: 18px; padding-right: 18px; }
.project-dialog-body h2 { font-size: clamp(34px, 5vw, 58px); }
.project-copy { display: grid; gap: 12px; margin-top: 8px; }
.project-copy h3 { margin-top: 14px; font-size: 17px; color: var(--fg); }
.project-copy p, .project-copy li { color: var(--fg-2); line-height: 1.72; }
.project-copy ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.project-stack { margin-top: 6px; }
.project-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.proj:focus-visible, .project-close:focus-visible { outline: 2px solid rgba(var(--warm-glow), .85); outline-offset: 4px; }
@media (max-width: 860px) {
  .project-dialog-grid { grid-template-columns: 1fr; }
  .project-dialog-visual { min-height: 220px; }
  .project-dialog-body { padding-right: 0; }
}
