:root {
  color-scheme: light;
  --background: #f7f7f5;
  --surface: #ffffff;
  --surface-variant: #f0f0ec;
  --accent: #2f5d62;
  --accent-soft: rgba(47, 93, 98, 0.12);
  --text-primary: #121619;
  --text-secondary: #3f474f;
  --muted: #707984;
  --border: #dcded9;
  --glass-surface: rgba(247, 247, 245, 0.85);
  --shadow: 0 20px 45px rgba(15, 20, 28, 0.1);
  --section-alt-background: #ffffff;
  --footer-surface: rgba(247, 247, 245, 0.92);
  --article-gradient-accent: rgba(47, 93, 98, 0.18);
  --article-gradient-base: rgba(247, 247, 245, 0.85);
  --toggle-surface: #ffffff;
  --toggle-border: rgba(18, 22, 25, 0.12);
  --toggle-active: rgba(47, 93, 98, 0.14);
  --toggle-shadow: 0 10px 18px rgba(18, 22, 25, 0.08);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: all 0.24s ease;
  font-size: clamp(15px, 0.9rem + 0.2vw, 18px);
}

:root,
html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --background: #0f141c;
  --surface: #161c27;
  --surface-variant: #1d2431;
  --accent: #7ed6cb;
  --accent-soft: rgba(126, 214, 203, 0.16);
  --text-primary: #f3f6fb;
  --text-secondary: #c6cdd8;
  --muted: #909bb0;
  --border: rgba(146, 163, 192, 0.25);
  --glass-surface: rgba(15, 20, 28, 0.68);
  --shadow: 0 22px 46px rgba(3, 6, 10, 0.4);
  --section-alt-background: #111823;
  --footer-surface: rgba(9, 13, 20, 0.82);
  --article-gradient-accent: rgba(126, 214, 203, 0.18);
  --article-gradient-base: rgba(16, 22, 31, 0.82);
  --toggle-surface: rgba(21, 27, 38, 0.85);
  --toggle-border: rgba(126, 140, 164, 0.32);
  --toggle-active: rgba(126, 214, 203, 0.18);
  --toggle-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --background: #0f141c;
    --surface: #161c27;
    --surface-variant: #1d2431;
    --accent: #7ed6cb;
    --accent-soft: rgba(126, 214, 203, 0.16);
    --text-primary: #f3f6fb;
    --text-secondary: #c6cdd8;
    --muted: #909bb0;
    --border: rgba(146, 163, 192, 0.25);
    --glass-surface: rgba(15, 20, 28, 0.68);
    --shadow: 0 22px 46px rgba(3, 6, 10, 0.4);
    --section-alt-background: #111823;
    --footer-surface: rgba(9, 13, 20, 0.82);
    --article-gradient-accent: rgba(126, 214, 203, 0.18);
    --article-gradient-base: rgba(16, 22, 31, 0.82);
    --toggle-surface: rgba(21, 27, 38, 0.85);
    --toggle-border: rgba(126, 140, 164, 0.32);
    --toggle-active: rgba(126, 214, 203, 0.18);
    --toggle-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  }
}

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

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

.legend-link {
  display: inline-block;
  font-weight: 600;
  color: #c9a646;
  transition: transform 0.3s ease, text-shadow 0.3s ease;
}

.legend-link:hover,
.legend-link:focus-visible {
  transform: translateY(-1px);
  text-shadow: 0 0 12px rgba(244, 220, 149, 0.55);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .legend-link {
    background-image: linear-gradient(120deg, #cfaa41 0%, #f6e49a 45%, #fff1c1 50%, #cfaa41 100%);
    background-size: 200% 100%;
    background-position: 0 50%;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .legend-link:hover,
  .legend-link:focus-visible {
    animation: legend-shimmer 1.8s linear infinite;
  }
}

@keyframes legend-shimmer {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

img {
  max-width: 100%;
  display: block;
  border-radius: var(--radius-md);
}

.feed-media video {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  background-color: var(--surface);
  display: block;
}

.container {
  width: min(1080px, 92vw);
  margin: 0 auto;
}

.site-header {
  backdrop-filter: saturate(180%) blur(20px);
  background-color: var(--glass-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.2rem 0;
}

.site-toolbar {
  padding: 0.75rem 0 0;
}

.site-toolbar__inner {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .site-toolbar__inner {
    justify-content: center;
  }
}

.brand-name {
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-tagline {
  margin: 0.18rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  font-size: 0.95rem;
}

.site-nav a {
  position: relative;
  padding-bottom: 0.2rem;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background-color: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after {
  transform: scaleX(1);
}

.cv-download {
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.6rem 1.3rem;
  font-size: 0.9rem;
  color: var(--accent);
  transition: var(--transition);
}

.cv-download:hover {
  background-color: var(--accent);
  color: var(--surface);
  box-shadow: var(--shadow);
}

.theme-toggle {
  border: 1px solid var(--toggle-border);
  background: var(--toggle-surface);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 0.4rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--toggle-shadow);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  outline: none;
  background: var(--toggle-active);
}

.theme-toggle__icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 1px solid var(--toggle-border);
  position: relative;
}

.theme-toggle[data-theme-state="dark"] .theme-toggle__icon::before,
.theme-toggle[data-theme-state="light"] .theme-toggle__icon::before,
.theme-toggle[data-theme-state="system"] .theme-toggle__icon::before {
  content: "";
  position: absolute;
  inset: 0.2rem;
  border-radius: inherit;
}

.theme-toggle[data-theme-state="light"] .theme-toggle__icon::before {
  background: linear-gradient(135deg, #ffd777, #ffb347);
}

.theme-toggle[data-theme-state="dark"] .theme-toggle__icon::before {
  background: linear-gradient(135deg, #66b2ff, #a48bff);
}

.theme-toggle[data-theme-state="system"] .theme-toggle__icon::before {
  background: linear-gradient(135deg, #ffb347 0%, #ffb347 45%, #7ed6cb 55%, #7ed6cb 100%);
}

.theme-toggle__label {
  line-height: 1;
}

.hero {
  padding: 6rem 0 4rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 3rem;
}

.hero-text h1 {
  font-size: clamp(2.4rem, 4vw, 3.2rem);
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.hero-text p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin: 0 0 1.2rem;
}

.hero-text p:last-of-type {
  margin-bottom: 0;
}

.hero-prose {
  display: grid;
  gap: 1.2rem;
}

.hero-prose p {
  margin: 0;
}

.hero-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 500;
  transition: var(--transition);
}

.button.primary {
  background-color: var(--accent);
  color: var(--surface);
}

.button.primary:hover {
  filter: brightness(1.05);
  box-shadow: var(--shadow);
}

.button.ghost {
  border-color: var(--accent);
  color: var(--accent);
}

.button.ghost:hover {
  background-color: var(--accent-soft);
}

.hero-highlight {
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-text .hero-highlight {
  margin-top: 2rem;
}

.hero-highlight h2 {
  margin-top: 0;
}

.hero-highlight ul {
  padding-left: 1.2rem;
  margin: 1rem 0 0;
  color: var(--text-secondary);
}

.section {
  padding: 5rem 0;
}

.section-alt {
  background-color: var(--section-alt-background);
}

.section-header {
  max-width: 600px;
  margin-bottom: 2.4rem;
}

.section-header h2 {
  font-size: clamp(2rem, 3vw, 2.6rem);
  margin-bottom: 0.6rem;
}

.section-header p {
  margin: 0;
  color: var(--text-secondary);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
}

.card {
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  border: 1px solid var(--border);
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  border: 2px solid transparent;
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
}

.card:hover::before {
  border-color: var(--accent-soft);
}

.card-label {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background-color: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card h3 {
  margin: 1rem 0 0.8rem;
}

.card p {
  color: var(--text-secondary);
  margin-bottom: 1.4rem;
}

.card-link {
  font-weight: 500;
  color: var(--accent);
  font-size: 0.95rem;
}

.feed-media--doc {
  background: linear-gradient(145deg, var(--surface-variant), var(--surface));
  border: 1px solid var(--border);
  padding: 1rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.feed-media--doc p {
  margin: 0;
}

.feed-media--doc .doc-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.feed-media--doc .doc-title {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.feed {
  display: grid;
  gap: 2rem;
}

.feed-item {
  display: grid;
  gap: 1.6rem;
  grid-template-columns: minmax(0, 320px) 1fr;
  align-items: start;
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.feed-body time {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.feed-body h3 {
  margin: 0 0 0.8rem;
}

.feed-body p {
  margin: 0;
  color: var(--text-secondary);
}

.feed-body p + p {
  margin-top: 1.1rem;
}

.blog-list {
  display: grid;
  gap: 1.8rem;
}

.blog-card {
  background-color: var(--surface-variant);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.8rem;
  transition: var(--transition);
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.blog-card header time {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.blog-card h3 {
  margin: 0 0 0.8rem;
}

.blog-card p {
  margin: 0 0 1.2rem;
  color: var(--text-secondary);
}

.blog-noscript {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.blog-noscript a {
  color: var(--accent);
  font-weight: 500;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  align-items: center;
}

.contact-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.8rem;
}

.contact-links a {
  color: var(--accent);
  font-weight: 500;
  position: relative;
}

.contact-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background-color: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.contact-links a:hover::after {
  transform: scaleX(1);
}

.article-page {
  background-color: var(--surface);
}

.article-header {
  padding: 5rem 0 3rem;
  background: radial-gradient(circle at top left, var(--article-gradient-accent), transparent 55%),
    linear-gradient(140deg, var(--accent-soft), var(--article-gradient-base));
  border-bottom: 1px solid var(--border);
}

.article-header .container {
  max-width: 760px;
}

.article-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
}

.article-kicker {
  margin: 1.8rem 0 0.6rem;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.article-header h1 {
  margin: 0;
  font-size: clamp(2.4rem, 4vw, 3.2rem);
  max-width: 18ch;
}

.article-meta {
  margin-top: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.article-content {
  padding: 3.5rem 0 4.5rem;
}

.article-content .container {
  max-width: 720px;
}

.article-content article {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  display: grid;
  gap: 1.6rem;
}

.article-content article p {
  margin: 0;
}

.article-footer {
  border-top: 1px solid var(--border);
  padding: 2.4rem 0;
  background-color: var(--footer-surface);
}

.article-footer .container {
  max-width: 760px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  background-color: var(--footer-surface);
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 800px) {
  .site-header .container {
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
  }

  .theme-toggle {
    order: 2;
  }

  .site-nav {
    order: 4;
    flex-wrap: wrap;
    justify-content: center;
  }

  .cv-download {
    order: 3;
    width: 100%;
    text-align: center;
  }

  .feed-item {
    grid-template-columns: 1fr;
  }

  .article-top-bar {
    justify-content: flex-start;
  }
}

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