:root {
  color-scheme: light;
  --bg: #f8f9fb;
  --surface: #eff2f6;
  --fg: #19212e;
  --muted: #556174;
  --accent: #245bcc;
  --button-fg: #ffffff;
  --border: #d6dce5;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'Cascadia Code', Consolas, monospace;
}

[data-theme='dark'] {
  color-scheme: dark;
  --bg: #14171c;
  --surface: #1b2027;
  --fg: #edf1f7;
  --muted: #a0acbd;
  --accent: #8bb4ff;
  --button-fg: #101a2d;
  --border: #343d49;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 7rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }
a, button { -webkit-tap-highlight-color: transparent; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
::selection { background: var(--accent); color: var(--button-fg); }
p, h1, h2, h3, h4 { margin: 0; }
.section-shell { max-width: 1160px; margin-inline: auto; padding-inline: 40px; }
.accent { color: var(--accent); }
.mono, .eyebrow, .placeholder-label, .project-number, .status, .entry-date {
  font-family: var(--mono);
  font-size: 0.75rem;
}
.eyebrow { letter-spacing: 0.08em; color: var(--muted); }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 100; padding: 10px 20px; background: var(--fg); color: var(--bg); transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.site-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--border); }
.header-inner { max-width: 1160px; padding: 18px 40px; margin: auto; display: flex; align-items: center; gap: 32px; }
.wordmark { font-size: 1.75rem; font-weight: 750; letter-spacing: -0.08em; line-height: 1; }
.wordmark span { color: var(--accent); }
.site-nav { display: flex; flex-wrap: wrap; gap: 26px; margin-left: auto; }
.site-nav a { font-size: 0.875rem; }
.header-controls { display: flex; gap: 14px; align-items: center; }
.language-switch { display: flex; gap: 2px; border: 1px solid var(--border); padding: 3px; border-radius: 6px; }
.language-switch button { border: 0; background: transparent; color: var(--muted); padding: 5px 8px; font-family: var(--mono); font-size: 0.7rem; cursor: pointer; border-radius: 3px; }
.language-switch button[aria-pressed='true'] { background: var(--surface); color: var(--fg); }
#theme-toggle { display: grid; place-items: center; width: 34px; height: 34px; background: transparent; color: var(--fg); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
.icon-sun { display: none; }
[data-theme='dark'] .icon-sun { display: block; }
[data-theme='dark'] .icon-moon { display: none; }
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px 65px; align-items: center; padding-top: 85px; padding-bottom: 28px; }
.hero-copy .eyebrow { display: flex; align-items: center; gap: 10px; }
.accent-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; flex-shrink: 0; }
h1 { font-size: clamp(2.6rem, 5.4vw, 4.5rem); font-weight: 650; letter-spacing: -0.055em; line-height: 1.1; margin-top: 28px; }
.hero-description { color: var(--muted); font-size: 1.1rem; max-width: 450px; margin-top: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 26px; margin-top: 34px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 26px; font-size: 0.875rem; font-weight: 600; padding: 12px 20px; border-radius: 5px; }
.button-primary { background: var(--accent); color: var(--button-fg); }
.button-primary:hover { color: var(--button-fg); filter: brightness(1.1); }
.text-link { display: inline-flex; align-items: center; gap: 15px; font-size: 0.875rem; }
.portrait-panel { min-width: 0; }
.portrait-frame { padding: 12px; border: 2px solid var(--accent); border-radius: 50%; }
.portrait-frame img { width: 100%; height: auto; aspect-ratio: 1 / 1; display: block; object-fit: cover; object-position: center; border-radius: 50%; }
.hero-footnote { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 22px; margin-top: 34px; color: var(--muted); font-size: 0.75rem; }
.intro-filler { padding-top: 12px; }
.intro-filler p { max-width: 760px; color: var(--muted); font-size: 0.95rem; }
.content-section { padding-top: 95px; padding-bottom: 12px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; margin-bottom: 35px; }
h2 { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 600; line-height: 1.2; letter-spacing: -0.045em; margin-top: 14px; }
.section-heading > p { max-width: 340px; font-size: 0.875rem; color: var(--muted); }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.project-card { padding: 22px; border: 1px solid var(--border); border-radius: 5px; }
.project-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.project-number { color: var(--muted); }
.status { font-size: 0.65rem; color: var(--accent); border: 1px solid var(--border); border-radius: 20px; padding: 3px 9px; }
.project-diagram { height: 130px; display: flex; justify-content: center; align-items: center; margin-block: 18px; background: var(--surface); border-radius: 3px; }
.project-diagram span { width: 26px; height: 26px; border: 1px solid var(--muted); position: relative; }
.project-diagram span + span { margin-left: 28px; }
.project-diagram span + span::before { content: ''; position: absolute; width: 28px; height: 1px; background: var(--muted); left: -29px; top: 12px; }
.project-diagram span:nth-child(2) { border-color: var(--accent); border-radius: 50%; }
h3 { font-size: 1.05rem; font-weight: 600; }
.project-card > p, .skill-group p { font-size: 0.875rem; color: var(--muted); margin-top: 10px; }
.project-footer { font-family: var(--mono); font-size: 0.65rem; color: var(--muted); border-top: 1px solid var(--border); margin-top: 24px; padding-top: 15px; }
.cv-block { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 40px; border-top: 1px solid var(--border); padding-block: 30px; }
.cv-block > h3 { color: var(--muted); font-size: 0.875rem; padding-top: 3px; }
.placeholder-label { font-size: 0.65rem; color: var(--accent); letter-spacing: 0.06em; }
.profile-placeholder p { max-width: 680px; margin-top: 10px; color: var(--muted); }
.cv-list { list-style: none; margin: 0; padding: 0; }
.cv-entry { display: grid; grid-template-columns: 115px minmax(0, 1fr); gap: 25px; padding-bottom: 26px; }
.cv-entry + .cv-entry { border-top: 1px solid var(--border); padding-top: 26px; }
.cv-entry:last-child { padding-bottom: 0; }
.entry-date { color: var(--muted); padding-top: 3px; }
h4 { font-size: 1rem; font-weight: 600; }
.cv-entry div > p { color: var(--muted); font-size: 0.875rem; margin-top: 8px; }
.cv-entry div > .entry-organization { margin-top: 3px; }
.skill-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 25px; }
.skill-group h4 { font-size: 0.875rem; }
.contact-section { margin-top: 80px; padding-block: 55px; border-top: 1px solid var(--border); }
.contact-row { display: flex; justify-content: space-between; align-items: center; gap: 30px; margin-top: 25px; }
.contact-row p { color: var(--muted); max-width: 500px; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--border); padding-block: 24px; font-size: 0.75rem; color: var(--muted); }
.reveal { animation: reveal-in 0.5s ease both; }
@keyframes reveal-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .section-shell { padding-inline: 28px; }
  .header-inner { padding-inline: 28px; gap: 24px; }
  .site-nav { gap: 18px; }
  .hero { gap: 35px; padding-top: 60px; }
  .cv-block { grid-template-columns: 130px minmax(0, 1fr); gap: 25px; }
  .project-card { padding: 16px; }
  .skill-grid { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 640px) {
  html { scroll-padding-top: 9rem; }
  .section-shell { padding-inline: 22px; }
  .header-inner { flex-wrap: wrap; justify-content: space-between; gap: 15px; padding: 14px 22px; }
  .header-controls { margin-left: auto; }
  .site-nav { order: 3; width: 100%; margin: 0; justify-content: space-between; gap: 10px; }
  .site-nav a { font-size: 0.8rem; }
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 45px; gap: 36px; }
  h1 { font-size: clamp(2.5rem, 10vw, 3.9rem); }
  .hero-copy .eyebrow { font-size: 0.65rem; letter-spacing: 0.03em; }
  .hero-description { font-size: 1rem; margin-top: 22px; }
  .hero-actions { gap: 20px; }
  .portrait-panel { max-width: 380px; width: 100%; }
  .hero-footnote { margin-top: 0; gap: 12px; align-items: flex-start; }
  .hero-footnote .mono { font-size: 0.65rem; }
  .content-section { padding-top: 65px; }
  .section-heading { display: block; margin-bottom: 25px; }
  .section-heading > p { margin-top: 18px; max-width: none; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card { padding: 22px; }
  .project-diagram { height: 115px; }
  .cv-block { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-block: 26px; }
  .cv-entry { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .contact-section { margin-top: 50px; padding-block: 38px; }
  .contact-row { align-items: flex-start; flex-direction: column; gap: 22px; }
  .site-footer { flex-wrap: wrap; font-size: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { animation: none; }
}
