:root {
  --bg: #1E1E1E;
  --surface: #11131a;
  --text: #e7e9ee;
  --muted: #a2a6b3;
  --line: #1f2230;
  --accent: #7dd3fc;
  --accent-2: #60a5fa;
  --shadow: 0 12px 40px rgba(0,0,0,0.35);
  --deck-ease: cubic-bezier(.16,1,.3,1);
  --deck-speed: 320ms;
  --deck-speed-fast: 200ms;
  /* Stronger line specifically for accordion in dark theme */
  --acc-line: color-mix(in oklab, var(--text), transparent 78%);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: #e5e7eb;
  --accent: #0284c7;
  --accent-2: #0ea5e9;
  --shadow: 0 10px 30px rgba(2,6,23,0.08);
  --acc-line: color-mix(in oklab, var(--text), transparent 90%);
}

* { box-sizing: border-box; }
/* Avoid competing scroll containers; let body handle scrolling */
html, body { overflow-x: hidden; }
/* Prevent layout shift when vertical scrollbar appears */
html { overflow-y: auto; }
body { overflow-y: auto; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans";
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }

.wrap { width: min(512px, 92%); margin: 0 auto; }
.wrap.small { width: min(512px, 92%); text-align: center; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; background: var(--accent-2); color: #09111e; padding: 8px 12px; border-radius: 8px; }

.site-header { position: sticky; top: 0; z-index: 10; backdrop-filter: saturate(130%) blur(8px); background: var(--bg); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.site-header .tools { display: inline-flex; align-items: center; gap: 8px; }
/* Slightly smaller label text for header CV button */
.site-header .pill-btn.label span { font-size: 0.9rem; }
.brand { font-weight: 700; letter-spacing: 0.2px; }
.icon-btn { background: var(--surface); color: var(--muted); border: 1px solid var(--line); width: 36px; height: 36px; border-radius: 50%; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; display: none; }
/* Crisper 18px stroke icons (avoid 1.5px strokes when scaling 24→18) */
.icon-btn .icon-sun,
.icon-btn .icon-moon {
  stroke-width: 1.3333; /* ~1px effective at 18px */
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
}
/* Improve precision for filled social SVGs too */
.social-icons svg,
.pill-btn svg {
  width: 18px; height: 18px;
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
}
[data-theme="light"] .icon-sun { display: block; }
:root:not([data-theme="light"]) .icon-btn { background: transparent; border-color: var(--acc-line); color: var(--muted); }
:root:not([data-theme="light"]) .icon-btn:hover { color: var(--text); }
:root:not([data-theme="light"]) .icon-moon { display: block; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 2.4rem; }
h2 { font-size: clamp(1.1rem, 2.2vw, 1.25rem); color: var(--muted); font-weight: 700; }
h3 { font-size: 1rem; }
.lede { color: var(--muted); }
.grad-text {
  background: linear-gradient(90deg, #007BFF, #008C8C);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.em { font-weight: 700; color: var(--accent); }

.btn { display: inline-block; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; background: var(--surface); box-shadow: var(--shadow); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn:hover { transform: translateY(-1px); }
.btn.btn-small { height: 36px; padding: 0 12px; display: inline-flex; align-items: center; border-radius: 18px; box-shadow: none; }

/* Dark mode: match higher-contrast borders in header */
:root:not([data-theme="light"]) .site-header .btn { border-color: var(--acc-line); }

.intro { padding: 36px 0 16px; background: var(--bg); }
.intro .kicker { color: var(--muted); font-size: 0.8rem; }
.intro-head { display: flex; gap: 12px; align-items: center; margin: 8px 0 14px; }
.availability { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); padding: 6px 10px; border-radius: 999px; font-size: 0.85rem; color: var(--muted); }
.availability .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; display: inline-block; box-shadow: 0 0 0 4px color-mix(in oklab, #22c55e, transparent 80%); }

.stack { position: relative; margin: 22px 0 0; height: 280px; }
.case-card { position: absolute; inset: 0; border-radius: 16px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.case-card img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(10%); }
.case-card::after { content: ""; position: absolute; inset: 0; border-radius: 16px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.35)); }
.case-card figcaption { position: absolute; inset-inline: 0; bottom: 0; padding: 10px 12px; }
.caption { display: flex; justify-content: space-between; color: #cbd5e1; font-size: 0.85rem; }
.caption a { color: var(--text); text-decoration: none; }

/* Experience accordion */
.experience { padding: 36px 0 24px; background: var(--bg); }
.accordion { border: 1px solid var(--acc-line); border-radius: 14px; overflow: hidden; background: transparent; box-shadow: none; padding: 6px 0; }
.acc-item { border-top: 0; }
.acc-item:first-child { border-top: 0; }
.acc-summary { list-style: none; display: grid; grid-template-columns: 64px 1fr auto 24px; gap: 12px; align-items: center; padding: 18px 16px 16px 16px; cursor: pointer; position: relative; }
.acc-summary::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 1px; background: var(--acc-line); }
.acc-item[open] .acc-summary::after { opacity: 0; }
.acc-summary::-webkit-details-marker { display: none; }
.acc-summary:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.acc-item[open] .acc-summary { background: transparent; }
.acc-summary .year { color: var(--muted); font-weight: 400; letter-spacing: .2px; }
.acc-summary .company { font-weight: 500; color: var(--text); }
.acc-summary .role { color: var(--muted); white-space: nowrap; }
.acc-summary:hover .role, .acc-summary:focus-visible .role { color: var(--text); }
.acc-summary .toggle { justify-self: end; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; color: var(--muted); line-height: 1; position: relative; transform: translateY(0px) rotate(0deg); transition: transform 220ms var(--deck-ease), color 220ms ease, opacity 220ms ease; align-self: center; }
.acc-summary .toggle::before,
.acc-summary .toggle::after { content: ""; position: absolute; width: 12px; height: 2px; background: currentColor; border-radius: 2px; transition: height 200ms ease, width 200ms ease, transform 220ms var(--deck-ease); }
.acc-summary .toggle::after { transform: rotate(90deg); }
.acc-item[open] .acc-summary .toggle { transform: rotate(45deg); color: var(--muted); opacity: .75; }
.acc-item[open] .acc-summary .toggle::before,
.acc-item[open] .acc-summary .toggle::after { height: 2px; }
.acc-panel { padding: 8px 22px 18px 22px; position: relative; overflow: hidden; transition: max-height 280ms var(--deck-ease), padding-top 200ms ease, padding-bottom 200ms ease, transform 280ms var(--deck-ease); will-change: max-height, transform; }
.acc-item:not([open]) .acc-panel { max-height: 0; padding-top: 0; padding-bottom: 0; transform: translateY(-6px); overflow: clip; }
.acc-item[open] .acc-panel { max-height: 1000px; transform: translateY(0); }
.acc-panel::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 1px; background: var(--acc-line); }
.accordion > .acc-item:last-child .acc-panel::after { display: none; }
/* No bottom divider for last item when closed */
.accordion > .acc-item:last-child .acc-summary::after { display: none; }
.acc-panel p { margin: 0 0 10px; color: var(--muted); }

.footer-cta { padding: 32px 0; }
.footer-cta .quiet { color: var(--muted); text-align: center; }
.footer-cta .cta-row { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 12px 0 18px; }
.social-icons { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.social-icons a { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.social-icons a:hover { color: var(--text); border-color: var(--text); }
/* Stronger border contrast for dark mode */
:root:not([data-theme="light"]) .social-icons a { border-color: var(--acc-line); }

/* Text-labeled variant for email button */
.social-icons a.label { width: auto; padding: 0 12px; gap: 8px; }
.social-icons a.label span { font-size: 0.9rem; }
/* Gradient text on hover for labeled email */
 

/* Reusable pill button, matching social icon style */
.pill-btn { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; background: transparent; }
.pill-btn:hover { color: var(--text); border-color: var(--text); }
:root:not([data-theme="light"]) .pill-btn { border-color: var(--acc-line); }

/* Gradient stroke for header pill button: red → blue, preserves rounding */
.site-header .pill-btn {
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    linear-gradient(90deg, #ef4444, #3b82f6) border-box;
}
.site-header .pill-btn:hover {
  color: var(--text);
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    linear-gradient(90deg, #f87171, #60a5fa) border-box;
}
.pill-btn.label { width: auto; padding: 0 12px; gap: 8px; }

.contact-form { display: grid; gap: 12px; margin-top: 10px; }
.contact-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.contact-form label { display: grid; gap: 6px; font-weight: 600; }
.contact-form input, .contact-form textarea { width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; }
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid color-mix(in oklab, var(--accent-2), transparent 60%); outline-offset: 2px; }
.contact-form.minimal .actions { justify-content: center; }
.contact-form .actions { align-items: center; display: grid; grid-auto-flow: column; gap: 10px; justify-content: start; }

.site-footer { padding: 28px 0; color: var(--muted); }
.site-footer .fine { font-size: 0.85rem; color: var(--muted); }
.site-footer .wrap.small { text-align: initial; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

@media (max-width: 640px) {
  .contact-form .row { grid-template-columns: 1fr; }
  /* Larger tap targets on mobile */
  .icon-btn, .social-icons a, .pill-btn { width: 44px; height: 44px; }
  .pill-btn.label { height: 44px; }
  /* Keep H1 size same as desktop */
  h1 { font-size: 2.4rem; }
  /* Accordion compaction */
  .acc-summary { grid-template-columns: 48px 1fr 24px; align-items: start; gap: 6px; }
  .acc-summary .role { grid-column: 2 / 4; white-space: normal; font-size: 0.9rem; margin-top: 0; }
  /* Keep the + toggle pinned to the right */
  .acc-summary .toggle { grid-column: 3; grid-row: 1; justify-self: end; align-self: center; }
  /* Deck caption edge-to-edge on small screens */
  .deck-caption { padding: 0; }
  /* Prevent horizontal scroll due to deck peeks */
  .deck { overflow-x: hidden; }
  .deck-carousel { overflow-x: hidden; }
}

/* Deck carousel */
.deck-carousel { padding: 12px 0 12px; }
.deck-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.deck-nav { display: grid; grid-auto-flow: column; gap: 8px; }
.deck-btn { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.deck-btn:hover { color: var(--text); border-color: var(--text); }

.deck { position: relative; height: 408px; margin-top: 12px; outline: none; overflow: visible; }
.deck-card { position: absolute; top: 0; left: calc(50% - 180px); width: 360px; height: 360px; border-radius: 32px; overflow: hidden; background: #ffffff; border: none; box-shadow: 0 12px 28px rgba(0,0,0,0.24), 0 4px 10px rgba(0,0,0,0.16); display: grid; align-content: end; justify-items: start; transform-origin: 100% 100%; }
.deck-card { cursor: ew-resize; }
.deck-card.has-bg { background-size: cover; background-position: center; background-repeat: no-repeat; }
.deck-card img { display: none; }
.deck-label { display: none; }
.deck-card { transition: transform var(--deck-speed) ease-in-out, left var(--deck-speed) ease-in-out, width var(--deck-speed) ease-in-out, height var(--deck-speed) ease-in-out, filter var(--deck-speed-fast) linear; will-change: transform, left, width, height; }

@media (prefers-reduced-motion: reduce) {
  .deck-card { transition: none; }
}

/* Positions driven by inline style from JS; these set defaults for noscript */
/* Noscript/default stack: first card active, others peek on right with bottom-right origin */
.deck-card:nth-child(1) { transform: rotate(0deg) scale(1); z-index: 5; }
.deck-card:nth-child(2) { transform: rotate(5deg) scale(.95); z-index: 4; }
.deck-card:nth-child(3) { transform: rotate(10deg) scale(.9); z-index: 3; }
.deck-card:nth-child(4) { transform: rotate(15deg) scale(.85); z-index: 2; }
.deck-card:nth-child(5) { transform: rotate(20deg) scale(.8); z-index: 1; }

/* Card title (visible only on active card) */
.deck-caption { position: absolute; left: calc(50% - 180px); top: 384px; width: 360px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; letter-spacing: 0.2px; padding: 0 16px; }
.deck-caption .title { color: var(--text); font-weight: 700; text-align: left; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-caption .link { flex: 0 0 auto; }
.deck-caption a { color: var(--muted); font-weight: 500; text-decoration: none; }
.deck-caption a:hover { color: var(--text); text-decoration: none; }
.deck-caption a:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }

/* (removed) password gate styles */
/* Password gate overlay (removed) */
/* Accordion: prevent selecting summary rows while allowing panel copy */
.acc-summary, .acc-summary * {
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
.accordion .acc-panel, .accordion .acc-panel * {
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}
/* Rollback: header pill returns to gray + rounded */
.site-header .pill-btn {
  border: 1px solid var(--line) !important;
  background: transparent !important;
  border-image: none !important;
}
:root:not([data-theme="light"]) .site-header .pill-btn {
  border-color: var(--acc-line) !important;
}
.site-header .pill-btn:hover {
  color: var(--text) !important;
  border-color: var(--text) !important;
}
/* Revert: use border-image gradient stroke for header pill button */
.site-header .pill-btn {
  border: 1.5px solid transparent;
  background: transparent;
  border-image: linear-gradient(90deg, #ef4444, #3b82f6) 1;
}
.site-header .pill-btn:hover {
  color: var(--text);
  background: transparent;
  border-image: linear-gradient(90deg, #f87171, #60a5fa) 1;
}
