:root {
  color-scheme: light;
  --bg: #f3f4ef;
  --bg-glow-1: rgba(92, 138, 88, 0.15);
  --bg-glow-2: rgba(162, 188, 156, 0.2);

  /* Outer hardware bezel & inner card */
  --shell-bg: rgba(230, 235, 226, 0.55);
  --shell-border: rgba(28, 36, 31, 0.08);
  --card-bg: rgba(255, 255, 255, 0.82);
  --card-border: rgba(28, 36, 31, 0.09);

  /* Surfaces */
  --surface: rgba(255, 255, 255, 0.88);
  --surface-hover: #ffffff;
  --surface-subtle: rgba(236, 241, 233, 0.68);
  --surface-pill: #ffffff;

  /* Typography colors */
  --ink: #141a16;
  --ink-secondary: #3f4942;
  --muted: #6e7870;

  /* Hairlines & accents */
  --line: rgba(28, 36, 31, 0.08);
  --line-strong: rgba(28, 36, 31, 0.16);
  --accent: #497646;
  --accent-bright: #588f54;
  --accent-soft: rgba(73, 118, 70, 0.11);
  --accent-border: rgba(73, 118, 70, 0.28);
  --spotlight: rgba(88, 143, 84, 0.1);

  /* Elevations */
  --shadow-shell:
    0 34px 80px -20px rgba(20, 26, 22, 0.1),
    0 6px 20px -4px rgba(20, 26, 22, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --shadow-card:
    0 12px 32px -10px rgba(20, 26, 22, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --shadow-item:
    0 2px 6px -1px rgba(20, 26, 22, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --shadow-item-hover:
    0 14px 28px -8px rgba(73, 118, 70, 0.16),
    0 2px 6px -1px rgba(20, 26, 22, 0.04),
    inset 0 1px 0 #ffffff;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e0c;
  --bg-glow-1: rgba(114, 170, 110, 0.13);
  --bg-glow-2: rgba(52, 86, 50, 0.15);

  /* Outer hardware bezel & inner card */
  --shell-bg: rgba(255, 255, 255, 0.025);
  --shell-border: rgba(235, 242, 236, 0.075);
  --card-bg: rgba(18, 23, 20, 0.84);
  --card-border: rgba(235, 242, 236, 0.09);

  /* Surfaces */
  --surface: rgba(26, 33, 29, 0.78);
  --surface-hover: rgba(34, 43, 38, 0.96);
  --surface-subtle: rgba(255, 255, 255, 0.035);
  --surface-pill: rgba(255, 255, 255, 0.08);

  /* Typography colors */
  --ink: #eef3ef;
  --ink-secondary: #b0bab2;
  --muted: #758178;

  /* Hairlines & accents */
  --line: rgba(235, 242, 236, 0.075);
  --line-strong: rgba(235, 242, 236, 0.16);
  --accent: #84b880;
  --accent-bright: #96cc92;
  --accent-soft: rgba(132, 184, 128, 0.13);
  --accent-border: rgba(132, 184, 128, 0.32);
  --spotlight: rgba(132, 184, 128, 0.11);

  /* Elevations */
  --shadow-shell:
    0 40px 90px -18px rgba(0, 0, 0, 0.75),
    0 8px 24px -4px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --shadow-card:
    0 14px 36px -10px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --shadow-item:
    0 2px 8px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --shadow-item-hover:
    0 14px 30px -8px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.11);
}

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

html, body {
  height: 100%;
  height: 100svh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  position: relative;
  display: grid;
  place-items: center;
  padding: clamp(12px, 2.8vw, 28px);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 18% 12%, var(--bg-glow-1) 0%, transparent 52%),
    radial-gradient(circle at 84% 88%, var(--bg-glow-2) 0%, transparent 54%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Architectural dot matrix */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse 75% 70% at 50% 50%, rgba(0, 0, 0, 0.55) 10%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 50%, rgba(0, 0, 0, 0.55) 10%, transparent 80%);
  z-index: 0;
}

/* Fine paper grain */
.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.026;
  z-index: 2;
}

/* Double-Bezel Hardware Shell */
.card-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 604px);
  padding: 6px;
  border-radius: 34px;
  background: var(--shell-bg);
  border: 1px solid var(--shell-border);
  box-shadow: var(--shadow-shell);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

/* Inner Precision Card */
main {
  --mx: 50%;
  --my: 0%;
  position: relative;
  width: 100%;
  padding: clamp(20px, 3.8vh, 34px) clamp(18px, 4.2vw, 36px);
  border-radius: 28px;
  background: var(--card-bg);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
  overflow: hidden;
}

/* Cursor-following ambient spotlight */
main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    480px circle at var(--mx) var(--my),
    var(--spotlight),
    transparent 70%
  );
  z-index: 0;
}

main > * {
  position: relative;
  z-index: 1;
}

/* Staggered entry choreography */
.stagger-1 { animation: fadeUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.02s both; }
.stagger-2 { animation: fadeUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both; }
.stagger-3 { animation: fadeUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.14s both; }
.stagger-4 { animation: fadeUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.20s both; }

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Smooth blur-fade on language change */
[data-i18n] {
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.lang-switching [data-i18n] {
  opacity: 0;
  filter: blur(3px);
}

/* Top Bar: Status Pill + Controls */
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(16px, 2.8vh, 24px);
}

.intro-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5.5px 13px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
}

.status-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.status-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-bright);
  opacity: 0;
  animation: pulse 2.6s infinite ease-out;
}

@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.75; }
  100% { transform: scale(2.2); opacity: 0; }
}

.intro {
  margin: 0;
  color: var(--ink-secondary);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
}

.lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 660;
  letter-spacing: 0.05em;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  line-height: 1;
}

.lang-btn:hover {
  color: var(--ink);
}

.lang-btn.active {
  background: var(--surface-pill);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.theme-toggle {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-pill);
  transform: rotate(12deg);
}

.theme-toggle svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

/* Hero Masthead */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: clamp(16px, 2.8vh, 24px);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.hero-main {
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: clamp(44px, 8.5vw, 66px);
  font-weight: 760;
  line-height: 0.95;
  letter-spacing: -0.052em;
  color: var(--ink);
}

h1 .dot {
  color: var(--accent);
}

.role-wrap {
  margin-top: clamp(8px, 1.4vh, 12px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.role {
  margin: 0;
  font-size: clamp(16px, 2.2vw, 19px);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink-secondary);
}

/* Interactive Data Telemetry Widget on Right of Hero */
.hero-telemetry {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.spark-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
  padding: 4px 8px;
  border-radius: 9px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
}

.spark-bars span {
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.75;
  transition: height 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.spark-bars span:nth-child(1) { height: 35%; }
.spark-bars span:nth-child(2) { height: 65%; }
.spark-bars span:nth-child(3) { height: 50%; }
.spark-bars span:nth-child(4) { height: 85%; }
.spark-bars span:nth-child(5) { height: 100%; opacity: 1; }

main:hover .spark-bars span:nth-child(1) { height: 60%; }
main:hover .spark-bars span:nth-child(2) { height: 40%; }
main:hover .spark-bars span:nth-child(3) { height: 95%; opacity: 1; }
main:hover .spark-bars span:nth-child(4) { height: 65%; }
main:hover .spark-bars span:nth-child(5) { height: 80%; }

.telemetry-caption {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 550;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

/* Education Section */
.edu-section {
  margin-top: clamp(14px, 2.5vh, 22px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.section-label {
  margin: 0;
  font-size: 10.5px;
  font-weight: 660;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.edu-primary {
  padding: clamp(14px, 2.2vh, 18px) clamp(15px, 2.6vw, 20px);
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-item);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.edu-primary:hover {
  border-color: var(--line-strong);
}

.edu-top-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.degree {
  margin: 0;
  font-size: clamp(15px, 2.1vw, 17px);
  font-weight: 660;
  line-height: 1.3;
  letter-spacing: -0.016em;
  color: var(--ink);
}

.degree-tag {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 660;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 3.5px 9px;
  border-radius: 999px;
  line-height: 1.1;
}

.partners {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.partner-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 530;
  color: var(--ink-secondary);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 9px;
  line-height: 1.2;
}

.partner-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
}

.partner-x {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Secondary Education Row (Netology) */
.edu-secondary {
  padding: 9px clamp(14px, 2.4vw, 18px);
  border-radius: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.edu-sec-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.edu-sec-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.65;
  flex-shrink: 0;
}

.edu-sec-label {
  margin: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.netology-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 620;
  color: var(--ink);
  text-decoration: none;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-item);
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.netology-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.netology-link .arrow {
  font-size: 11.5px;
  color: var(--muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.netology-link:hover .arrow {
  color: var(--accent);
  transform: translate(1.5px, -1.5px);
}

/* Contacts Dock (3 Columns) */
.contacts-section {
  margin-top: clamp(14px, 2.5vh, 20px);
}

nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.nav-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: clamp(11px, 1.8vh, 14px) 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-item);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.24s ease,
              background-color 0.24s ease,
              box-shadow 0.24s ease;
  text-align: left;
}

.nav-card:hover {
  transform: translateY(-2.5px);
  background: var(--surface-hover);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-item-hover);
}

.nav-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.24s ease, background-color 0.24s ease, color 0.24s ease;
}

.nav-card:hover .nav-icon {
  background: var(--accent);
  color: var(--bg);
  transform: scale(1.05);
}

.nav-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-arrow {
  font-size: 13px;
  color: var(--muted);
  transition: transform 0.22s ease, color 0.22s ease;
  line-height: 1;
}

.nav-card:hover .nav-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

.nav-card-body {
  min-width: 0;
}

.nav-title {
  display: block;
  font-size: 13.5px;
  font-weight: 640;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.25;
}

.nav-sub {
  display: block;
  margin-top: 2px;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}

.nav-card.copied .nav-sub {
  color: var(--accent);
  font-weight: 600;
}

/* Subtle Hardware Bezel Footer Strip */
.shell-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px 2px;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.shortcuts {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.shortcut-item kbd {
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  color: var(--ink-secondary);
  margin-right: 3px;
}

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

/* Responsive adjustments for mobile & short viewports (strictly 0 scroll) */
@media (max-width: 540px) {
  .card-shell {
    padding: 4px;
    border-radius: 28px;
  }
  main {
    padding: 20px 16px;
    border-radius: 24px;
  }
  .hero-telemetry {
    display: none;
  }
  .degree-tag {
    display: none;
  }
  nav {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .nav-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 13px;
  }
  .nav-card-head {
    order: 2;
  }
  .nav-icon {
    display: none;
  }
  .nav-card-body {
    order: 1;
    display: flex;
    align-items: baseline;
    gap: 10px;
  }
  .nav-sub {
    margin-top: 0;
    font-size: 11px;
  }
  .shell-footer {
    display: none;
  }
}

@media (max-height: 680px) {
  .shell-footer {
    display: none;
  }
  main {
    padding: 18px 22px;
  }
  .card-top {
    margin-bottom: 12px;
  }
  .hero {
    padding-bottom: 12px;
  }
  h1 {
    font-size: clamp(36px, 7.5vh, 52px);
  }
  .role-wrap {
    margin-top: 4px;
  }
  .edu-section {
    margin-top: 12px;
    gap: 6px;
  }
  .section-header {
    display: none;
  }
  .edu-primary {
    padding: 11px 14px;
    gap: 6px;
  }
  .edu-secondary {
    padding: 8px 14px;
  }
  .contacts-section {
    margin-top: 10px;
  }
  .nav-card {
    padding: 10px 12px;
    gap: 6px;
  }
  .nav-icon {
    width: 24px;
    height: 24px;
  }
}

@media (max-height: 460px) {
  .card-top { margin-bottom: 8px; }
  .hero { padding-bottom: 8px; }
  .edu-secondary { display: none; }
  nav { grid-template-columns: repeat(3, 1fr); }
  .nav-icon { display: none; }
  .nav-sub { display: none; }
  .nav-card { flex-direction: row; align-items: center; padding: 8px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
