:root {
  color-scheme: dark;
  --bg: #0a0e13;
  --bg-soft: #0d1218;
  --surface: #111821;
  --surface-raised: #161f29;
  --surface-quiet: #0e141b;
  --border: #27323e;
  --border-soft: #1a232d;
  --text: #eef1f4;
  --text-soft: #bdc6cf;
  --muted: #7f8b98;
  --accent: #d59a57;
  --accent-strong: #e4ac6b;
  --technical: #78bdb9;
  --technical-strong: #92cecb;
  --page-accent: var(--accent);
  --shadow: 0 22px 60px rgba(0, 0, 0, .24);
  --container: 72rem;
  --reading: 47rem;
  --radius-sm: 4px;
  --radius-md: 7px;
  --radius-lg: 12px;
  --font-sans: "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease: 180ms cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
html.nav-open { overflow: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  font-family: var(--font-sans);
  color: var(--text);
  line-height: 1.65;
  background:
    radial-gradient(circle at 78% -10%, rgba(120, 189, 185, .07), transparent 28rem),
    radial-gradient(circle at 18% 0%, rgba(213, 154, 87, .045), transparent 24rem),
    linear-gradient(180deg, var(--bg) 0%, #0b1016 100%);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body.page-theme-radio { --page-accent: var(--accent); }
body.page-theme-nature { --page-accent: var(--technical); }
img { display: block; max-width: 100%; }
button { font: inherit; }
a { color: var(--technical-strong); text-decoration: none; transition: color var(--ease), border-color var(--ease), background var(--ease), transform var(--ease); }
a:hover { color: var(--accent-strong); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--page-accent); outline-offset: 4px; }
::selection { color: #0a0e13; background: var(--accent-strong); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 19, .86);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  transition: box-shadow var(--ease), border-color var(--ease), background var(--ease);
}
.site-header.is-scrolled { border-color: var(--border); box-shadow: 0 12px 40px rgba(0, 0, 0, .2); background: rgba(10, 14, 19, .94); }
.site-header__inner, .primary-nav, .footer-inner { width: min(100% - 3rem, var(--container)); margin-inline: auto; }
.site-header__inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.brand { display: inline-flex; flex-direction: column; gap: .05rem; color: var(--text); flex: 0 0 auto; }
.brand:hover { color: var(--text); }
.brand__name { font: 760 .95rem/1.1 var(--font-sans); letter-spacing: .22em; }
.brand__domain { color: var(--muted); font: 500 .67rem/1.2 var(--font-mono); letter-spacing: .06em; }
.header-actions { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.language-nav { display: flex; gap: .18rem; }
.language-nav a { min-width: 2.2rem; padding: .34rem .42rem; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--muted); text-align: center; font: 650 .72rem/1 var(--font-mono); }
.language-nav a:hover { color: var(--text); border-color: var(--border); }
.language-nav a[aria-current="page"] { color: #0a0e13; background: var(--page-accent); border-color: var(--page-accent); }
.restricted-link { display: inline-flex; align-items: center; gap: .55rem; padding-left: 1rem; border-left: 1px solid var(--border); color: var(--text-soft); font-size: .79rem; white-space: nowrap; }
.restricted-link::before { content: ""; width: .42rem; height: .42rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(213, 154, 87, .08); }
.restricted-link:hover { color: var(--text); }
.primary-nav { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; min-height: 45px; align-items: center; border-top: 1px solid var(--border-soft); }
.primary-nav a { color: var(--muted); font-size: .82rem; font-weight: 560; }
.primary-nav a:hover, .primary-nav a[aria-current="page"] { color: var(--text); }
.nav-toggle, .mobile-restricted-link { display: none; }
.nav-toggle { width: 2.75rem; height: 2.75rem; padding: 0; place-items: center; color: var(--text); background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.nav-toggle:hover { border-color: #3a4857; background: rgba(255,255,255,.025); }
.nav-toggle__icon, .nav-toggle__icon::before, .nav-toggle__icon::after { width: 1rem; height: 1px; background: currentColor; transition: transform var(--ease), opacity var(--ease), background var(--ease); }
.nav-toggle__icon { position: relative; display: block; }
.nav-toggle__icon::before, .nav-toggle__icon::after { content: ""; position: absolute; left: 0; }
.nav-toggle__icon::before { top: -.32rem; }
.nav-toggle__icon::after { top: .32rem; }
.nav-toggle[aria-expanded="true"] .nav-toggle__icon { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__icon::before { transform: translateY(.32rem) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__icon::after { transform: translateY(-.32rem) rotate(-45deg); }

/* Layout and typography */
.content-shell { width: min(100% - 3rem, var(--container)); margin-inline: auto; }
.content-shell > section { padding-block: clamp(4rem, 8vw, 7rem); border-bottom: 1px solid var(--border-soft); }
.content-shell > section:last-child { border-bottom: 0; }
.hero-grid > *, .subpage-hero__grid > *, .section-grid > * { min-width: 0; }
.section-label, .section-index, .feature-kicker, .meta-label {
  margin: 0;
  color: var(--page-accent);
  text-transform: uppercase;
  letter-spacing: .13em;
  font: 680 .7rem/1.5 var(--font-mono);
}
.section-index { color: var(--muted); }
h1, h2, h3, p { text-wrap: pretty; }
h1, h2, h3 { margin-top: 0; color: var(--text); font-weight: 680; letter-spacing: -.035em; }
p { color: var(--text-soft); }
.hero-home { padding-top: clamp(5rem, 10vw, 9rem) !important; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(16rem, .65fr); gap: clamp(3rem, 8vw, 7rem); align-items: end; }
.hero-copy h1 { max-width: 12ch; margin: .8rem 0 1.35rem; font-size: clamp(3.2rem, 8vw, 6.5rem); line-height: .96; letter-spacing: -.058em; }
.hero-role { margin: 0 0 1.35rem; color: var(--text); font-size: clamp(1.05rem, 2.3vw, 1.3rem); }
.hero-summary { max-width: 44rem; margin: 0; font-size: clamp(1rem, 1.7vw, 1.12rem); }
.profile-panel { align-self: stretch; padding: 1.2rem; background: linear-gradient(145deg, rgba(22, 31, 41, .82), rgba(14, 20, 27, .82)); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.profile-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: calc(var(--radius-lg) - 3px); filter: saturate(.82) contrast(1.03); }
.profile-meta { margin: 1.15rem 0 0; display: grid; gap: .78rem; }
.profile-meta div { display: grid; gap: .15rem; padding-top: .78rem; border-top: 1px solid var(--border-soft); }
.profile-meta dt { color: var(--muted); font: 600 .66rem/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .09em; }
.profile-meta dd { margin: 0; color: var(--text-soft); font-size: .9rem; overflow-wrap: anywhere; }
.section-grid { display: grid; grid-template-columns: minmax(12rem, .45fr) minmax(0, 1fr); gap: clamp(2.5rem, 7vw, 7rem); align-items: start; }
.section-heading { position: sticky; top: 9rem; }
.section-heading h2 { max-width: 18ch; margin: .55rem 0 0; font-size: clamp(1.85rem, 4vw, 2.75rem); line-height: 1.08; }
.prose { max-width: var(--reading); }
.prose p { margin: 0 0 1.25rem; font-size: clamp(1rem, 1.5vw, 1.08rem); }
.prose p:first-child { color: var(--text); font-size: clamp(1.12rem, 2vw, 1.32rem); }

/* Interests */
.interest-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 2.4rem; }
.interest-panel { --panel-accent: var(--accent); position: relative; min-height: 24rem; padding: clamp(1.6rem, 3vw, 2.2rem); display: flex; flex-direction: column; overflow: hidden; background: linear-gradient(145deg, rgba(17, 24, 33, .98), rgba(13, 19, 26, .98)); border: 1px solid var(--border); border-radius: var(--radius-md); }
.interest-panel--nature { --panel-accent: var(--technical); }
.interest-panel::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: var(--panel-accent); opacity: .88; }
.interest-panel::after { content: ""; position: absolute; width: 14rem; height: 14rem; right: -7rem; top: -7rem; border-radius: 50%; background: var(--panel-accent); opacity: .035; filter: blur(2px); transition: opacity var(--ease), transform var(--ease); }
.interest-panel:hover { transform: translateY(-2px); border-color: #354250; box-shadow: 0 18px 45px rgba(0,0,0,.16); }
.interest-panel:hover::after { opacity: .065; transform: scale(1.08); }
.interest-panel .feature-kicker { color: var(--panel-accent); }
.interest-panel h3 { margin: .8rem 0 .8rem; font-size: clamp(1.7rem, 3.5vw, 2.55rem); }
.interest-panel p { max-width: 34rem; margin: 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: .42rem; margin: 1.5rem 0 2rem; padding: 0; list-style: none; }
.tag-list li { padding: .34rem .5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted); font: 600 .67rem/1.2 var(--font-mono); }
.panel-link { margin-top: auto; min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-soft); color: var(--text); font-weight: 620; }
.panel-link span { color: var(--panel-accent); }

/* Technology */
.technical-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 2rem; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.technical-item { min-height: 9rem; padding: 1.4rem; background: rgba(17, 24, 33, .55); border-right: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.technical-item:nth-child(2n) { border-right: 0; }
.technical-item:nth-last-child(-n + 2) { border-bottom: 0; }
.technical-item span { display: block; margin-bottom: .55rem; color: var(--technical); font: 650 .68rem/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.technical-item strong { display: block; color: var(--text); font-size: 1rem; font-weight: 580; }

/* Digital identity */
.identity-stack { display: grid; gap: .8rem; }
.identity-record { padding: 1.35rem 1.45rem; background: #0c1218; border: 1px solid var(--border); border-radius: var(--radius-md); }
.record-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.record-head h3 { margin: 0; font-size: 1.05rem; letter-spacing: -.01em; }
.record-head span { color: var(--muted); font: 600 .66rem/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.record-grid { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: .5rem 1.2rem; margin: 0; }
.record-grid dt { color: var(--muted); font: 600 .72rem/1.5 var(--font-mono); }
.record-grid dd { margin: 0; color: var(--text-soft); overflow-wrap: anywhere; font: 500 .78rem/1.55 var(--font-mono); }
.record-grid a { color: var(--technical-strong); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.contact-card { min-height: 9rem; padding: 1.3rem; background: rgba(17,24,33,.46); border: 1px solid var(--border-soft); border-radius: var(--radius-md); }
.contact-card h3 { margin: 0 0 .75rem; font: 650 .72rem/1.3 var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .09em; }
.contact-card p { margin: .28rem 0; }
.contact-card a { overflow-wrap: anywhere; }

/* Internal pages */
.subpage { --reading: 50rem; }
.subpage-hero { padding-top: clamp(5rem, 10vw, 8.5rem) !important; }
.subpage-hero__grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(15rem, .55fr); gap: clamp(3rem, 8vw, 7rem); align-items: end; }
.subpage-hero h1 { margin: .8rem 0 1rem; font-size: clamp(3.4rem, 8vw, 6rem); line-height: .96; }
.subpage-hero .lead { max-width: 42rem; margin: 0 0 1.25rem; color: var(--text); font-size: clamp(1.15rem, 2.4vw, 1.45rem); }
.subpage-hero .description { max-width: 47rem; margin: 0; }
.context-panel { padding: 1.25rem; background: linear-gradient(145deg, rgba(22,31,41,.78), rgba(13,19,26,.9)); border: 1px solid var(--border); border-top: 2px solid var(--page-accent); border-radius: var(--radius-md); }
.context-panel dl { margin: 0; }
.context-panel div { display: grid; gap: .2rem; padding: .85rem 0; border-bottom: 1px solid var(--border-soft); }
.context-panel div:last-child { border-bottom: 0; padding-bottom: 0; }
.context-panel div:first-child { padding-top: 0; }
.context-panel dt { color: var(--muted); font: 600 .65rem/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .09em; }
.context-panel dd { margin: 0; color: var(--text); font-size: .94rem; overflow-wrap: anywhere; }
.principle-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-top: 2rem; }
.principle-card { min-height: 15rem; padding: 1.45rem; background: rgba(17,24,33,.56); border: 1px solid var(--border-soft); border-radius: var(--radius-md); }
.principle-card .number { color: var(--page-accent); font: 650 .68rem/1 var(--font-mono); }
.principle-card h3 { margin: 2.6rem 0 .7rem; font-size: 1.25rem; }
.principle-card p { margin: 0; font-size: .94rem; }

/* Footer */
.site-footer { padding: 3rem 0 4rem; border-top: 1px solid var(--border-soft); }
.footer-inner { display: flex; justify-content: space-between; gap: 2rem; align-items: flex-end; color: var(--muted); font-size: .8rem; }
.footer-brand strong { display: block; color: var(--text); font-size: .8rem; letter-spacing: .18em; }
.footer-brand span { display: block; margin-top: .2rem; font-family: var(--font-mono); font-size: .68rem; }
.footer-meta { margin: 0; text-align: right; overflow-wrap: anywhere; }
.footer-meta a { display: inline-block; min-height: 1.75rem; }

/* Landing and 404 */
.language-landing { display: grid; min-height: 100vh; place-items: center; padding: 1.5rem; }
.language-shell { width: min(100%, 46rem); }
.language-brand { margin-bottom: 2rem; }
.language-panel { padding: clamp(2rem, 7vw, 4rem); background: rgba(17,24,33,.86); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.language-panel h1 { max-width: 12ch; margin: .7rem 0 1rem; font-size: clamp(2.5rem, 8vw, 4.7rem); line-height: .98; }
.language-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: 2rem 0 1.4rem; }
.language-choices a { min-height: 2.75rem; padding: .85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); text-align: center; font-weight: 600; }
.language-choices a:hover { border-color: var(--accent); background: rgba(213,154,87,.06); }
.muted { color: var(--muted); }
.error-shell { width: min(100% - 3rem, 58rem); min-height: 78vh; margin-inline: auto; display: grid; place-items: center; }
.error-panel { width: 100%; padding: clamp(2rem, 7vw, 5rem) 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.error-code { margin: 0; color: var(--accent); font: 700 .72rem/1.4 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; }
.error-panel h1 { max-width: 12ch; margin: .7rem 0 1rem; font-size: clamp(3rem, 10vw, 6rem); line-height: .95; }
.error-panel p { max-width: 38rem; }

/* Motion */
.js main section.reveal-ready { opacity: 0; transform: translateY(10px); }
.js main section.reveal-ready.visible { opacity: 1; transform: none; transition: opacity 360ms ease, transform 360ms ease; }

/* Responsive tiers: desktop > 1024px, compact <= 1024px, phone <= 760px, narrow <= 560px. */
@media (max-width: 1024px) {
  .site-header__inner, .footer-inner, .content-shell { width: min(100% - 2.5rem, var(--container)); }
  .site-header__inner { min-height: 64px; gap: 1rem; }
  .header-actions { gap: .45rem; }
  .has-responsive-nav .restricted-link { display: none; }
  .language-nav a { min-width: 2.75rem; min-height: 2.75rem; padding: 0; display: grid; place-items: center; }
  .nav-toggle { display: grid; flex: 0 0 auto; }

  .js .primary-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100vh - 64px);
    margin: 0;
    padding: .75rem max(1.25rem, calc((100vw - var(--container)) / 2)) 1rem;
    overflow-y: auto;
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem;
    background: rgba(10,14,19,.985);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 24px 48px rgba(0,0,0,.32);
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
  }
  .js .primary-nav.is-open { display: grid; }
  .js .primary-nav a { min-height: 2.75rem; padding: .7rem .8rem; display: flex; align-items: center; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--text-soft); }
  .js .primary-nav a:hover, .js .primary-nav a[aria-current="page"] { background: rgba(255,255,255,.025); border-color: var(--border-soft); color: var(--text); }
  .js .primary-nav .mobile-restricted-link { grid-column: 1 / -1; display: flex; margin-top: .35rem; color: var(--accent-strong); border-top-color: var(--border); }
  .js .primary-nav .mobile-restricted-link::before { content: ""; width: .42rem; height: .42rem; margin-right: .6rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(213,154,87,.08); }

  .hero-grid, .subpage-hero__grid, .section-grid { grid-template-columns: 1fr; }
  .section-heading { position: static; }
  .section-heading h2 { max-width: 24ch; }

  .profile-panel { max-width: none; display: grid; grid-template-columns: minmax(11rem, 14rem) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
  .profile-meta { margin: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1rem; }
  .profile-meta div { padding-top: .65rem; }

  .context-panel dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; }
  .context-panel div { padding: .8rem 0; }
  .context-panel div:first-child { padding-top: .8rem; }
  .context-panel div:nth-last-child(-n + 2) { border-bottom: 0; }
}

@media (max-width: 760px) {
  .site-header__inner, .footer-inner, .content-shell { width: min(100% - 2rem, var(--container)); }
  .header-actions { gap: .3rem; }
  .js .primary-nav { grid-template-columns: 1fr; padding-inline: 1rem; }
  .js .primary-nav .mobile-restricted-link { grid-column: auto; }

  .profile-panel { max-width: 24rem; display: block; }
  .profile-meta { margin-top: 1.15rem; grid-template-columns: 1fr; }
  .context-panel dl { display: block; }
  .context-panel div:first-child { padding-top: 0; }
  .context-panel div:nth-last-child(2) { border-bottom: 1px solid var(--border-soft); }
  .context-panel div:last-child { border-bottom: 0; }

  .interest-grid, .technical-grid, .contact-grid, .principle-grid { grid-template-columns: 1fr; }
  .technical-item, .technical-item:nth-child(2n), .technical-item:nth-last-child(-n + 2) { border-right: 0; border-bottom: 1px solid var(--border-soft); }
  .technical-item:last-child { border-bottom: 0; }
  .interest-panel { min-height: 20rem; }
  .record-grid { grid-template-columns: 1fr; gap: .15rem; }
  .record-grid dd { margin-bottom: .65rem; }
  .footer-inner { align-items: flex-start; flex-direction: column; gap: 1.35rem; }
  .footer-meta { text-align: left; line-height: 1.8; }
  .language-choices { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .brand__domain { display: none; }
  .hero-copy h1, .subpage-hero h1 { font-size: clamp(2.45rem, 11vw, 3.8rem); line-height: .98; }
  .content-shell > section { padding-block: 3.5rem; }
  .hero-home, .subpage-hero { padding-top: 4.5rem !important; }
  .site-footer { padding: 2.35rem 0 2.8rem; }
  .footer-meta { font-size: .76rem; }
  .error-shell { width: min(100% - 2rem, 58rem); }
  .error-panel h1 { font-size: clamp(2.5rem, 12vw, 4rem); }
  .site-header:not(.has-responsive-nav) .site-header__inner { flex-wrap: wrap; padding-block: .55rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js main section.reveal-ready { opacity: 1; transform: none; }
}
