/* Shared finishing layer for all public portfolio themes. */
:root {
  --content-gutter: clamp(16px, 4vw, 48px);
  --focus-ring: #2563eb;
}

html { scroll-padding-top: 84px; }
body { overflow-x: hidden; }
button, input, textarea { font: inherit; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.floating-nav {
  isolation: isolate;
  min-width: 0;
}
.floating-nav .brand { flex: 0 0 auto; }
.header-live-status {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-left: 16px;
  font-variant-numeric: tabular-nums;
}
.header-status-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, currentColor 4%, transparent);
  white-space: nowrap;
}
.header-status-item .status-icon { font-size: 15px; line-height: 1; text-align: center; }
.header-status-item strong,
.header-status-item small { display: block; line-height: 1.15; }
.header-status-item strong { font-size: 10.5px; font-weight: 750; letter-spacing: 0; }
.header-status-item small { max-width: 116px; margin-top: 3px; overflow: hidden; color: currentColor; font-size: 8px; font-weight: 500; letter-spacing: 0; opacity: .62; text-overflow: ellipsis; text-transform: none; }
.header-live-status[aria-busy="true"] { opacity: .65; }
.live-data-attribution { display: block; margin-top: 8px; font-size: 9px; opacity: .72; }
.live-data-attribution a { text-decoration: underline; text-underline-offset: 2px; }
.floating-nav nav { min-width: 0; }
.floating-nav nav a { white-space: nowrap; }
.floating-nav nav .nav-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding-inline: 13px;
  border: 1px solid currentColor;
  font-weight: 750;
}
.theme-button,
.menu-button {
  flex: 0 0 40px;
  width: 40px !important;
  height: 40px !important;
  max-width: 40px;
  max-height: 40px;
  padding: 0;
  font-size: 18px !important;
  line-height: 1;
}
.floating-nav nav a,
.theme-button,
.menu-button,
.button,
.social-btn { -webkit-tap-highlight-color: transparent; }
.floating-nav a:focus-visible,
.theme-button:focus-visible,
.menu-button:focus-visible,
.button:focus-visible,
.social-btn:focus-visible,
.text-link:focus-visible,
.project-links a:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}
.hero-inner { position: relative; }
.hero-kicker { align-items: center; }
.hero-kicker span { white-space: nowrap; }
.hero-copy { margin-top: 20px; }
.content-section,
.contact-section { scroll-margin-top: 84px; }
.hero h1,
.section-heading h2,
.contact-intro h2 { text-wrap: balance; }
.hero-copy,
.project-copy > p,
.post-card p { text-wrap: pretty; }
.project-copy,
.contact-intro,
.contact-form { min-width: 0; }
.project-copy h3,
.project-copy > p,
.post-card h3,
.post-card p { overflow-wrap: anywhere; }
.portrait-wrap {
  box-sizing: border-box;
  line-height: 0;
  isolation: isolate;
}
.portrait-image,
.portrait-fallback {
  display: block;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center 22%;
}
.portrait-fallback {
  place-items: center;
  line-height: 1;
}
.social-btn {
  display: inline-grid !important;
  place-items: center;
  flex: 0 0 44px;
  width: 44px !important;
  height: 44px !important;
  max-width: 44px;
  max-height: 44px;
  padding: 0 !important;
  line-height: 0;
  overflow: hidden;
}
.social-btn svg {
  display: block;
  flex: 0 0 18px;
  width: 18px !important;
  height: 18px !important;
  max-width: 18px;
  max-height: 18px;
  fill: currentColor;
}
.footer-social .social-btn {
  flex-basis: 38px;
  width: 38px !important;
  height: 38px !important;
}
.footer-social .social-btn svg {
  width: 16px !important;
  height: 16px !important;
}
.contact-form input,
.contact-form textarea { max-width: 100%; }
.contact-form textarea { resize: vertical; }

/* Every visual theme supports the same explicit light/dark toggle contract. */
body {
  transition: background-color .2s ease, color .2s ease;
}

html[data-theme="brutalist-editorial"] body:not(.dark) {
  --black: #0a0a0a;
  --white: #ffffff;
  --gray: #4b4b4b;
  --gray-light: #efefef;
  --line: #0a0a0a;
  color-scheme: light;
}
html[data-theme="brutalist-editorial"] body.dark {
  --black: #f5f5f5;
  --white: #0a0a0a;
  --gray: #b8b8b8;
  --gray-light: #202020;
  --line: #f5f5f5;
  --accent: #ff6533;
  color-scheme: dark;
}
html[data-theme="brutalist-editorial"] body.dark .contact-intro p,
html[data-theme="brutalist-editorial"] body.dark .contact-form label,
html[data-theme="brutalist-editorial"] body.dark .site-footer,
html[data-theme="brutalist-editorial"] body.dark .footer-social .social-btn,
html[data-theme="brutalist-editorial"] body.dark .project-card:hover .project-copy > p,
html[data-theme="brutalist-editorial"] body.dark .blog-row > a:hover p { color: #404040; }
html[data-theme="brutalist-editorial"] body.dark .contact-form,
html[data-theme="brutalist-editorial"] body.dark .contact-form label { border-color: #b8b8b8; }
html[data-theme="brutalist-editorial"] body.dark .site-footer .copyright { color: #666; }
html[data-theme="brutalist-editorial"] body.dark .hero-actions .button.primary {
  color: var(--white);
  background: var(--black);
  border-color: var(--black);
}

html[data-theme="terminal-native"] body:not(.dark) {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface2: #ebe9e4;
  --ink: #1b1919;
  --muted: #625f5f;
  --faint: #858181;
  --line: rgba(27, 25, 25, .14);
  --line-strong: rgba(27, 25, 25, .34);
  --accent: #087c2c;
  color-scheme: light;
}
html[data-theme="terminal-native"] body.dark {
  --bg: #161313;
  --surface: #1e1a1a;
  --surface2: #262121;
  --ink: #fdfcfc;
  --muted: #aaa7a7;
  --faint: #777272;
  --line: rgba(253, 252, 252, .1);
  --line-strong: rgba(253, 252, 252, .24);
  --accent: #30d158;
  color-scheme: dark;
}
html[data-theme="terminal-native"] body:not(.dark) .project-placeholder {
  background: repeating-linear-gradient(-45deg, var(--surface2) 0 10px, #ddd9d2 10px 20px);
}
html[data-theme="terminal-native"] body:not(.dark) .article-content { color: var(--ink); }

html[data-theme="modern-gradient"] body:not(.dark) {
  --bg: #faf9f7;
  --surface: #ffffff;
  --ink: #20201f;
  --muted: #6f6d68;
  --line: #e4e1dc;
  --accent: #6d5dfc;
  --accent-soft: #efedff;
  --shadow: 0 18px 50px rgba(31, 29, 25, .08);
  color-scheme: light;
}
html[data-theme="modern-gradient"] body.dark {
  --bg: #101010;
  --surface: #181818;
  --ink: #f5f3ef;
  --muted: #aaa69f;
  --line: #343431;
  --accent: #a99fff;
  --accent-soft: #292547;
  --shadow: 0 20px 60px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
html[data-theme="modern-gradient"] body.dark .ambient { opacity: .16; }

html[data-theme="editorial-serif"] body:not(.dark) {
  --bg: #faf9f5;
  --surface: #ffffff;
  --ink: #1f1e1a;
  --muted: #6b6960;
  --faint: #98968c;
  --line: #e8e6df;
  --line-strong: #1f1e1a;
  --accent: #c15f3c;
  --accent-soft: #f6ebe5;
  color-scheme: light;
}
html[data-theme="editorial-serif"] body.dark {
  --bg: #171512;
  --surface: #211f1b;
  --ink: #f5f0e8;
  --muted: #b7afa4;
  --faint: #8f867a;
  --line: #3a352f;
  --line-strong: #f5f0e8;
  --accent: #ed936f;
  --accent-soft: #3a251f;
  color-scheme: dark;
}
html[data-theme="editorial-serif"] body.dark .button.primary {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
}
html[data-theme="editorial-serif"] body.dark .skill-cloud span,
html[data-theme="editorial-serif"] body.dark .tags span,
html[data-theme="editorial-serif"] body.dark .project-placeholder strong,
html[data-theme="editorial-serif"] body.dark .post-cover { color: var(--accent); }
html[data-theme="editorial-serif"] body.dark .project-placeholder,
html[data-theme="editorial-serif"] body.dark .post-cover {
  background: linear-gradient(145deg, var(--accent-soft), var(--surface));
}

html[data-theme="minimal-swiss"] body:not(.dark) {
  --bg: #ffffff;
  --surface: #fafafa;
  --ink: #171717;
  --muted: #666666;
  --faint: #a3a3a3;
  --line: #ebebeb;
  --line-strong: #171717;
  --accent: #0057ff;
  color-scheme: light;
}
html[data-theme="minimal-swiss"] body.dark .hero-actions .button.primary {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
}

html[data-theme="dark-neon"] body:not(.dark) {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface2: #ececf5;
  --ink: #161621;
  --muted: #5d5d70;
  --faint: #85859a;
  --line: rgba(30, 30, 60, .14);
  --line-strong: rgba(30, 30, 60, .34);
  --accent: #007b8a;
  --accent2: #6241d4;
  --pink: #c21867;
  --grad: linear-gradient(90deg, var(--accent), var(--accent2));
  color-scheme: light;
}
html[data-theme="dark-neon"] body.dark {
  --bg: #08080c;
  --surface: #101018;
  --surface2: #181826;
  --ink: #f2f2fa;
  --muted: #a1a1b4;
  --faint: #6f6f84;
  --line: rgba(140, 140, 255, .14);
  --line-strong: rgba(140, 140, 255, .36);
  --accent: #00e5ff;
  --accent2: #8b65ff;
  --pink: #ff4ba5;
  --grad: linear-gradient(90deg, var(--accent), var(--accent2));
  color-scheme: dark;
}
html[data-theme="dark-neon"] body:not(.dark)::before { opacity: .45; }
html[data-theme="dark-neon"] body:not(.dark) .floating-nav {
  background: rgba(247, 247, 251, .86);
}
html[data-theme="dark-neon"] body:not(.dark) .button.secondary,
html[data-theme="dark-neon"] body:not(.dark) .social-btn { background: var(--surface); }
html[data-theme="dark-neon"] body:not(.dark) .about-card,
html[data-theme="dark-neon"] body:not(.dark) .skills-card,
html[data-theme="dark-neon"] body:not(.dark) .contact-section {
  background: linear-gradient(180deg, var(--surface), var(--surface2));
}
html[data-theme="dark-neon"] body:not(.dark) .skill-cloud span,
html[data-theme="dark-neon"] body:not(.dark) .tags span { color: var(--accent2); }
html[data-theme="dark-neon"] body:not(.dark) .article-content { color: var(--ink); }
@media (max-width: 800px) {
  html[data-theme="dark-neon"] body:not(.dark) .floating-nav nav {
    background: rgba(247, 247, 251, .98);
  }
}

/* Brutalist Editorial: portrait becomes part of the bold poster composition. */
[data-theme="brutalist-editorial"] .floating-nav {
  padding-inline: max(var(--content-gutter), calc((100vw - 1200px) / 2));
}
[data-theme="brutalist-editorial"] .hero {
  padding-block: clamp(38px, 4vw, 52px) clamp(42px, 4vw, 52px);
}
[data-theme="brutalist-editorial"] .hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(220px, 24vw, 290px);
  column-gap: clamp(28px, 4vw, 56px);
  align-items: start;
}
[data-theme="brutalist-editorial"] .hero-kicker,
[data-theme="brutalist-editorial"] .hero-meta {
  grid-column: 1 / -1;
}
[data-theme="brutalist-editorial"] .portrait-wrap {
  display: block;
  position: relative;
  grid-column: 2;
  grid-row: 2 / span 4;
  width: 100%;
  margin: clamp(24px, 2.5vw, 34px) 13px 0 0;
  padding: 9px;
  background: var(--white);
  border: 3px solid var(--black);
  box-shadow: 13px 13px 0 var(--accent);
  transform: rotate(1.5deg);
}
[data-theme="brutalist-editorial"] .portrait-image,
[data-theme="brutalist-editorial"] .portrait-fallback {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  background: var(--gray-light);
  filter: saturate(.88) contrast(1.04);
}
[data-theme="brutalist-editorial"] .portrait-fallback {
  display: grid;
  font-size: 44px;
  font-weight: 900;
}
[data-theme="brutalist-editorial"] .status-dot { display: none; }
[data-theme="brutalist-editorial"] .hero h1 {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  max-width: 100%;
  padding-right: 0;
  font-size: clamp(58px, 8.6vw, 130px);
  overflow-wrap: anywhere;
}
[data-theme="brutalist-editorial"] .hero h1 .outline { display: block; }
[data-theme="brutalist-editorial"] .hero-copy,
[data-theme="brutalist-editorial"] .hero-actions,
[data-theme="brutalist-editorial"] .hero-social { grid-column: 1; }
[data-theme="brutalist-editorial"] .hero-copy { grid-row: 3; }
[data-theme="brutalist-editorial"] .hero-copy { margin-top: 20px; }
[data-theme="brutalist-editorial"] .hero-actions { grid-row: 4; margin-top: 28px; }
[data-theme="brutalist-editorial"] .hero-social { grid-row: 5; margin-top: 28px; }
[data-theme="brutalist-editorial"] .hero-meta {
  grid-row: 6;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: clamp(28px, 3vw, 38px);
}

/* Terminal Native: restrained avatar presented like a verified user record. */
[data-theme="terminal-native"] .floating-nav {
  padding-inline: max(20px, calc((100vw - 880px) / 2));
}
[data-theme="terminal-native"] .portrait-wrap {
  display: block;
  position: relative;
  width: 122px;
  margin: 28px 0 18px;
  padding: 4px;
  background: var(--surface2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
[data-theme="terminal-native"] .portrait-image,
[data-theme="terminal-native"] .portrait-fallback {
  width: 112px;
  height: 112px;
  border: 0;
  border-radius: 2px;
  background: var(--surface2);
}
[data-theme="terminal-native"] .portrait-fallback {
  display: grid;
  color: var(--accent);
  font-size: 26px;
  font-weight: 700;
}
[data-theme="terminal-native"] .status-dot {
  display: block;
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 14px;
  height: 14px;
  border: 3px solid var(--bg);
  border-radius: 2px;
  background: var(--accent);
}

/* Modern Gradient: soft editorial portrait with controlled depth. */
[data-theme="modern-gradient"] .floating-nav {
  position: sticky !important;
  top: 12px;
  left: auto;
  transform: none;
  width: min(1120px, calc(100% - 28px));
  margin: 12px auto 0;
}
[data-theme="modern-gradient"] .brand:not(.has-logo) {
  overflow: hidden;
  font-size: 0;
}
[data-theme="modern-gradient"] .brand:not(.has-logo)::before {
  content: attr(data-initials);
  font: 800 13px Manrope, sans-serif;
}
[data-theme="modern-gradient"] .portrait-wrap {
  display: block;
  position: relative;
  width: 132px;
  margin: 26px auto 22px;
  padding: 5px;
  border-radius: 24px;
  background: linear-gradient(145deg, var(--surface), var(--accent-soft));
  box-shadow: var(--shadow);
}
[data-theme="modern-gradient"] .portrait-image,
[data-theme="modern-gradient"] .portrait-fallback {
  width: 122px;
  height: 122px;
  border: 0;
  border-radius: 19px;
}
[data-theme="modern-gradient"] .portrait-fallback {
  display: grid;
  color: #fff;
  background: var(--accent);
  font: 800 30px Manrope, sans-serif;
}
[data-theme="modern-gradient"] .status-dot { right: 5px; bottom: 5px; }

/* Editorial Serif: classic portrait frame, warm and understated. */
[data-theme="editorial-serif"] .floating-nav {
  padding-inline: max(20px, calc((100vw - 920px) / 2));
}
[data-theme="editorial-serif"] .portrait-wrap {
  display: block;
  position: relative;
  width: 150px;
  margin: 34px auto 24px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 14px 40px rgba(31, 30, 26, .12);
}
[data-theme="editorial-serif"] .portrait-image,
[data-theme="editorial-serif"] .portrait-fallback {
  width: 134px;
  height: 134px;
  border: 0;
  border-radius: 50%;
}
[data-theme="editorial-serif"] .portrait-fallback {
  display: grid;
  color: var(--accent);
  background: var(--accent-soft);
  font: 600 34px var(--serif);
}

/* Minimal Swiss: editorial grid with precise rhythm and no title overlap. */
[data-theme="minimal-swiss"] .floating-nav {
  padding-inline: max(24px, calc((100vw - 1040px) / 2));
}
[data-theme="minimal-swiss"] .hero {
  width: min(100% - 48px, 1040px);
  max-width: none;
  padding: clamp(88px, 10vw, 128px) 0 clamp(84px, 9vw, 112px);
}
[data-theme="minimal-swiss"] .hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  grid-template-rows: auto auto auto auto auto auto;
  column-gap: clamp(48px, 7vw, 96px);
  align-items: start;
}
[data-theme="minimal-swiss"] .hero-kicker {
  grid-column: 1 / -1;
  margin-bottom: clamp(30px, 4vw, 54px);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}
[data-theme="minimal-swiss"] .hero h1 {
  grid-column: 1;
  grid-row: 2;
  max-width: 720px;
  margin: 0;
  font-size: clamp(58px, 7vw, 92px);
  font-weight: 800;
  line-height: .94;
  letter-spacing: -.065em;
}
[data-theme="minimal-swiss"] .hero h1 .outline { display: block; }
[data-theme="minimal-swiss"] .hero-copy {
  grid-column: 1;
  grid-row: 3;
  max-width: 620px;
  margin: 28px 0 0 !important;
  color: var(--muted);
  font-size: clamp(16px, 1.55vw, 18px);
  line-height: 1.65;
}
[data-theme="minimal-swiss"] .hero-actions { grid-column: 1; grid-row: 4; margin-top: 30px; }
[data-theme="minimal-swiss"] .hero-social { grid-column: 1; grid-row: 5; margin-top: 30px; }
[data-theme="minimal-swiss"] .hero-meta {
  grid-column: 1;
  grid-row: 6;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  max-width: 620px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
[data-theme="minimal-swiss"] .hero-meta small,
[data-theme="minimal-swiss"] .hero-meta strong { display: block; }
[data-theme="minimal-swiss"] .hero-meta small {
  margin: 0 0 4px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
[data-theme="minimal-swiss"] .hero-meta small::after { content: none; }
[data-theme="minimal-swiss"] .hero-meta strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
}
[data-theme="minimal-swiss"] .portrait-wrap {
  display: block;
  position: relative;
  grid-column: 2;
  grid-row: 2 / span 5;
  width: 100%;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(23, 23, 23, .1);
}
[data-theme="minimal-swiss"] .portrait-image,
[data-theme="minimal-swiss"] .portrait-fallback {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
}
[data-theme="minimal-swiss"] .portrait-fallback {
  display: grid;
  color: var(--accent);
  background: var(--surface);
  font-size: 34px;
  font-weight: 800;
}
[data-theme="minimal-swiss"] .status-dot { display: none; }
html[data-theme="minimal-swiss"] body.dark {
  --bg: #0a0a0a;
  --surface: #141414;
  --ink: #f5f5f5;
  --muted: #a3a3a3;
  --faint: #737373;
  --line: #2a2a2a;
  --line-strong: #f5f5f5;
  --accent: #5b8cff;
  color-scheme: dark;
}
html[data-theme="minimal-swiss"] body.dark .floating-nav {
  background: rgba(10, 10, 10, .82);
}
html[data-theme="minimal-swiss"] body.dark .project-card:hover,
html[data-theme="minimal-swiss"] body.dark .post-card:hover {
  border-color: #404040;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}

/* Dark Neon: luminous frame, while keeping the face clear and natural. */
[data-theme="dark-neon"] .floating-nav {
  padding-inline: max(22px, calc((100vw - 1020px) / 2));
}
[data-theme="dark-neon"] .portrait-wrap {
  display: block;
  position: relative;
  width: 132px;
  margin: 32px auto 24px;
  padding: 3px;
  border-radius: 50%;
  background: var(--grad);
}
[data-theme="dark-neon"] .portrait-image,
[data-theme="dark-neon"] .portrait-fallback {
  width: 126px;
  height: 126px;
  border: 4px solid var(--bg);
  border-radius: 50%;
}
[data-theme="dark-neon"] .portrait-fallback {
  display: grid;
  color: var(--accent);
  background: var(--surface);
  font: 700 30px var(--mono);
}

@media (min-width: 861px) {
  .hero-inner,
  .about-grid > *,
  .project-card > *,
  .post-grid > * { min-width: 0; }
  .hero-actions {
    align-items: center;
    flex-wrap: wrap;
  }
  .hero-actions .button {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 164px;
    max-width: 280px;
  }
  .hero-social {
    align-items: center;
    flex-wrap: wrap;
  }
  .hero-meta {
    align-items: flex-start;
    row-gap: 20px;
  }
  .identity-row { flex-wrap: wrap; }
  [data-theme="modern-gradient"] .hero,
  [data-theme="editorial-serif"] .hero,
  [data-theme="dark-neon"] .hero {
    width: min(100% - 48px, 960px);
  }
  [data-theme="modern-gradient"] .hero-actions,
  [data-theme="editorial-serif"] .hero-actions,
  [data-theme="dark-neon"] .hero-actions,
  [data-theme="modern-gradient"] .hero-social,
  [data-theme="editorial-serif"] .hero-social,
  [data-theme="dark-neon"] .hero-social,
  [data-theme="modern-gradient"] .hero-meta,
  [data-theme="editorial-serif"] .hero-meta,
  [data-theme="dark-neon"] .hero-meta {
    justify-content: center;
  }
  [data-theme="modern-gradient"] .hero-meta,
  [data-theme="editorial-serif"] .hero-meta,
  [data-theme="dark-neon"] .hero-meta {
    margin-inline: auto;
  }
  [data-theme="modern-gradient"] .hero { min-height: calc(100vh - 110px); }
  [data-theme="terminal-native"] .hero { min-height: calc(100vh - 88px); }
}

@media (max-width: 860px) {
  .floating-nav { padding-inline: 16px !important; }
  .floating-nav nav { max-height: calc(100vh - 58px); overflow-y: auto; }
  .hero-kicker { flex-wrap: wrap; }
  [data-theme="brutalist-editorial"] .portrait-wrap,
  [data-theme="minimal-swiss"] .portrait-wrap {
    position: relative;
    inset: auto;
    margin: 28px 0 24px;
  }
  [data-theme="brutalist-editorial"] .portrait-wrap { width: min(190px, 52vw); }
  [data-theme="brutalist-editorial"] .hero h1 { padding-right: 0; }
  [data-theme="minimal-swiss"] .hero { padding-right: 0; }
  [data-theme="minimal-swiss"] .hero-inner { display: block; }
  [data-theme="brutalist-editorial"] .hero-inner { display: block; }
  [data-theme="minimal-swiss"] .portrait-image,
  [data-theme="minimal-swiss"] .portrait-fallback { width: 100%; height: auto; }
  [data-theme="minimal-swiss"] .portrait-wrap {
    width: min(220px, 62vw);
    margin: 0 0 30px;
  }
  [data-theme="minimal-swiss"] .hero h1 { font-size: clamp(46px, 13vw, 70px); }
  [data-theme="brutalist-editorial"] .hero h1 {
    font-size: clamp(52px, 15.5vw, 92px);
    overflow-wrap: normal;
  }
  [data-theme="brutalist-editorial"] .hero-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  [data-theme="minimal-swiss"] .hero-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  [data-theme="modern-gradient"] .floating-nav { top: 8px; margin-top: 8px; }
}

@media (max-width: 560px) {
  .marquee { display: none; }
  .hero-kicker span { white-space: normal; }
  .hero h1 .outline { display: block; }
  .hero-actions { width: 100%; flex-wrap: wrap; }
  .hero-actions .button { flex: 1 1 100%; }
  .hero-social { flex-wrap: wrap; }
  .identity-row { min-width: 0; }
  .identity-row > div { min-width: 0; }
  .identity-row strong { overflow-wrap: anywhere; }
  .section-heading { margin-bottom: 32px; }
  .section-heading,
  .section-heading.split { align-items: flex-start; gap: 10px; }
  .section-heading p { margin-left: 0; max-width: 100%; text-align: left; }
  .contact-form .button { width: 100%; justify-content: center; }
  [data-theme="minimal-swiss"] .hero { width: min(100% - 32px, 1040px); padding-top: 72px; }
  [data-theme="brutalist-editorial"] .hero h1 { font-size: clamp(42px, 14vw, 72px); }
  [data-theme="brutalist-editorial"] .portrait-wrap { width: min(160px, 46vw); margin-block: 20px; }
  [data-theme="minimal-swiss"] .hero-meta { grid-template-columns: 1fr; gap: 12px; }
  [data-theme="brutalist-editorial"] .hero-meta { grid-template-columns: 1fr; gap: 12px; }
  [data-theme="modern-gradient"] .floating-nav {
    width: calc(100% - 24px);
    margin-inline: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portrait-wrap { transform: none !important; }
}

/* Home rhythm and resilient above-the-fold content. */
.hero .reveal {
  opacity: 1 !important;
  transform: none !important;
}
[data-theme="terminal-native"] .hero,
[data-theme="modern-gradient"] .hero {
  min-height: auto;
  justify-content: flex-start;
  padding-top: clamp(56px, 7vw, 88px);
}
.brand.has-logo::before,
.brand.has-logo::after {
  content: none !important;
  display: none !important;
}
.brand.has-logo img {
  display: block;
  width: auto;
  height: 34px;
  max-width: 132px;
  object-fit: contain;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.menu-icon {
  width: 19px;
  display: grid;
  gap: 4px;
}
.menu-icon i {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .18s ease, opacity .18s ease;
}
.floating-nav.open .menu-icon i:first-child { transform: translateY(6px) rotate(45deg); }
.floating-nav.open .menu-icon i:nth-child(2) { opacity: 0; }
.floating-nav.open .menu-icon i:last-child { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 1120px) {
  .header-status-item { grid-template-columns: 18px minmax(0, 1fr); gap: 4px; padding-inline: 6px; }
  .header-status-item .status-meta { display: none; }
}

@media (max-width: 860px) {
  .floating-nav .brand { min-width: 0; margin-right: 0; }
  .floating-nav .brand.has-logo img { height: 32px; max-width: 116px; }
  .header-live-status { gap: 2px; margin-left: auto; }
  .floating-nav .nav-actions { margin-left: auto !important; }
  .header-status-item { min-height: 34px; padding: 3px 5px; border-color: transparent; background: transparent; }
  .header-status-item strong { font-size: 10px; }
  .floating-nav .nav-actions { margin-left: 3px; }
  .floating-nav .theme-button,
  .floating-nav .menu-button { display: grid; place-items: center; margin: 0; }
  .floating-nav nav .nav-login {
    justify-content: space-between;
    width: 100%;
    min-height: 46px;
    margin-top: 6px;
    padding: 12px;
  }
  [data-theme="terminal-native"] .hero,
  [data-theme="brutalist-editorial"] .hero { padding-top: 32px; }
  [data-theme="terminal-native"] .floating-nav.open nav,
  [data-theme="brutalist-editorial"] .floating-nav.open nav {
    top: calc(100% + 8px);
    left: 12px;
    right: 12px;
    padding: 8px;
    border-radius: 10px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .18);
  }
  [data-theme="terminal-native"] .floating-nav.open nav {
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    border: 1px solid var(--line-strong);
  }
  [data-theme="terminal-native"] .floating-nav nav a {
    padding: 12px;
    border: 0;
    border-radius: 6px;
  }
  [data-theme="terminal-native"] .floating-nav nav a:hover { background: var(--surface2); }
  [data-theme="terminal-native"] .floating-nav nav .nav-login {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--bg);
  }
  [data-theme="brutalist-editorial"] .floating-nav.open nav {
    background: var(--white);
    border: 2px solid var(--black);
    border-radius: 0;
    box-shadow: 7px 7px 0 var(--accent);
  }
  [data-theme="brutalist-editorial"] .floating-nav nav a {
    padding: 13px 10px;
    border-top: 1px solid var(--gray-light);
  }
  [data-theme="brutalist-editorial"] .floating-nav nav .nav-login {
    border: 2px solid var(--black);
    background: var(--black);
    color: var(--white);
  }
}

@media (max-width: 350px) {
  .header-status-item { display: block; padding-inline: 3px; }
  .header-status-item .status-icon { display: none; }
  .header-status-item strong { font-size: 9px; }
}

/* Share buttons: official brand icons */
.article-share { display:flex; flex-wrap:wrap; align-items:center; gap:.6rem; margin:1rem 0 1.75rem; }
.article-share-label { font-size:.85rem; opacity:.7; margin-right:.25rem; }
.share-btn {
  width:42px; height:42px; padding:0;
  display:inline-flex; align-items:center; justify-content:center;
  border:0; border-radius:50%; background:#333;
  color:#fff; cursor:pointer;
  transition:transform .12s ease, box-shadow .12s ease;
}
.share-btn svg { width:20px; height:20px; fill:currentColor; display:block; }
.share-btn:hover { transform:translateY(-2px); box-shadow:0 4px 10px rgba(0,0,0,.25); }
/* Official brand colors */
.share-btn[aria-label^="Bagikan ke WhatsApp"] { background:#25d366; }
.share-btn[aria-label^="Bagikan ke Facebook"] { background:#1877f2; }
.share-btn[aria-label="Bagikan ke X (Twitter)"] { background:#000; }
.share-btn[aria-label^="Bagikan ke Telegram"] { background:#26a5e4; }
.share-btn.share-copy { background:var(--black, #111); }
body.dark .share-btn.share-copy { background:var(--gray-light, #222); color:var(--black, #eee); }

/* Blog article: YouTube embed */
.article-content .yt-embed { max-width:100%; }

/* Blog article content: follow theme + light/dark strictly */
.article-content { color: var(--black, var(--ink, inherit)); }
body.dark .article-content { color: var(--black, var(--ink, #eee)); }
body.dark .article-content code { background: var(--gray-light, #222); color: var(--black, #eee); }
.article-content img { max-width:100%; height:auto; }
.article-content a { word-break: break-word; }

/* Admin blog editor: dark mode support */
html[data-admin-theme="dark"] .editor-wrap { background:#111827; border-color:#374151; }
html[data-admin-theme="dark"] .editor-area { color:#e5e7eb; }
html[data-admin-theme="dark"] .editor-area:focus { box-shadow: inset 0 0 0 2px #1e3a8a; }
html[data-admin-theme="dark"] .editor-area:empty:before { color:#6b7280; }
html[data-admin-theme="dark"] .editor-area blockquote { background:#1f2937; color:#d1d5db; border-left-color:var(--blue); }
html[data-admin-theme="dark"] .editor-toolbar button { color:#e5e7eb; }
html[data-admin-theme="dark"] .editor-toolbar button:hover { background:#1f2937; border-color:#374151; }

/* Tighter vertical rhythm on article & hero pages (all themes) */
.article { padding-top: 48px !important; padding-bottom: 64px !important; }
.article header { margin: 24px 0 24px !important; }
.article-cover { margin-bottom: 28px !important; }
.page-hero { padding-top: 64px !important; padding-bottom: 44px !important; }

/* ── 404 page: theme-aware, works in every theme + dark/light ── */
.not-found { min-height: 78vh; display: grid; place-content: center; text-align: center; }
.not-found .nf-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  max-width: 560px;
  padding: clamp(28px, 5vw, 56px) clamp(22px, 4vw, 48px);
  border: 1px solid var(--line, #ddd);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface, transparent) 70%, transparent);
}
.not-found .nf-code {
  font-size: clamp(88px, 22vw, 170px);
  font-weight: 800;
  line-height: .95;
  letter-spacing: -.05em;
  color: var(--ink, currentColor);
}
.not-found .nf-zero {
  color: transparent;
  -webkit-text-stroke: clamp(2px, .4vw, 4px) var(--accent, currentColor);
}
.not-found .nf-kicker {
  margin: 10px 0 0;
  color: var(--accent, currentColor);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
}
.not-found h1 {
  margin: 4px 0 0 !important;
  font-size: clamp(24px, 4.5vw, 38px) !important;
  line-height: 1.15;
  color: var(--ink, inherit);
}
.not-found .nf-desc {
  margin: 8px 0 0;
  max-width: 40ch;
  color: var(--muted, inherit);
  font-size: 15px;
  line-height: 1.6;
}
.not-found .nf-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}
@media (max-width: 560px) {
  .not-found .nf-actions { width: 100%; }
  .not-found .nf-actions .button { flex: 1 1 100%; }
}

/* Tighter section rhythm on home page sections (all themes) */
.content-section { padding-top: 56px !important; padding-bottom: 56px !important; }
@media (max-width: 760px) {
  .content-section { padding-top: 40px !important; padding-bottom: 40px !important; }
}

/* Compact hero stack on mobile: buttons → socials → meta closer together */
@media (max-width: 860px) {
  .hero-social { margin-top: 16px !important; }
  [data-theme="minimal-swiss"] .hero-meta { margin-top: 14px !important; padding-top: 14px !important; }
  .hero-meta { gap: 10px !important; }
}
@media (max-width: 560px) {
  .hero-meta { margin-top: 12px !important; }
}

/* ── Projects: mobile 2-col compact cards + detail sheet ── */
.project-mobile-grid { display:none; }
@media (max-width: 860px) {
  /* Hide the big desktop rows on phones; show compact 2-per-row cards */
  .project-list { display:none; }
  .project-mobile-grid {
    display:grid;
    grid-template-columns:repeat(2, minmax(0,1fr));
    gap:12px;
  }
  .pm-card {
    min-width:0;
    display:flex; flex-direction:column; align-items:flex-start; gap:8px;
    padding:10px;
    border:2px solid var(--black);
    background:var(--white);
    color:var(--black);
    text-align:left;
    cursor:pointer;
    font:inherit;
  }
  .pm-card:active { transform:scale(.98); }
  .pm-thumb {
    width:100%; aspect-ratio:4/3; overflow:hidden;
    border-bottom:2px solid var(--black);
    background:repeating-linear-gradient(-45deg,var(--gray-light) 0 10px,var(--white) 10px 20px);
    display:grid; place-items:center;
    margin:-10px -10px 0; width:calc(100% + 20px); max-width:none;
  }
  .pm-thumb img { width:100%; height:100%; object-fit:cover; display:block; filter:grayscale(1) contrast(1.05); }
  .pm-thumb i { font-style:normal; font-weight:800; letter-spacing:.08em; font-size:12px; }
  .pm-title {
    font-size:14px; font-weight:800; text-transform:uppercase; letter-spacing:-.01em;
    line-height:1.25;
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  }
  .pm-hint { font-size:11px; font-weight:700; color:var(--gray); }

  /* Bottom sheet detail: strict theme-token styling (light & dark) */
  .pm-sheet[hidden] { display:none; }
  .pm-sheet { position:fixed; inset:0; z-index:90; }
  .pm-sheet-backdrop { position:absolute; inset:0; background:rgba(0,0,0,.6); backdrop-filter:blur(3px); }
  .pm-sheet-dialog {
  position:absolute; left:0; right:0; bottom:0;
  max-height:86vh; overflow-y:auto;
  background:var(--surface, var(--white, var(--bg, #fff)));
  color:var(--black, var(--ink, #111));
  border-top:3px solid var(--line-strong, var(--black, var(--ink, #111)));
  border-radius:18px 18px 0 0;
  animation:pm-up .22s ease;
  overscroll-behavior:contain;
}
@keyframes pm-up { from{transform:translateY(40%);opacity:.4} to{transform:none;opacity:1} }
.pm-sheet-dialog > header {
  position:sticky; top:0; z-index:1;
  display:flex; align-items:center; justify-content:space-between; gap:14px;
  padding:16px 20px;
  background:var(--surface, var(--white, var(--bg, #fff)));
  border-bottom:2px solid var(--line-strong, var(--black, var(--ink, #111)));
}
.pm-sheet-dialog h2 {
  margin:0; font-size:20px; font-weight:900;
  color:var(--black, var(--ink, #111));
  text-transform:uppercase; letter-spacing:-.02em; line-height:1.15;
}
.pm-sheet-dialog > header button {
  flex:none; width:38px; height:38px;
  border:2px solid var(--black, #111); border-radius:50%;
  background:var(--surface, var(--white, var(--bg, #fff))); color:var(--black, var(--ink, #111));
  font-size:20px; line-height:1; cursor:pointer;
}
.pm-sheet-body { padding:20px; color:var(--black, var(--ink, #111)); }
.pm-sheet-body .pm-sheet-photo {
  width:calc(100% + 40px); margin:-20px -20px 18px;
  height:auto; max-height:none; object-fit:contain; display:block;
  background:transparent;
  border-bottom:2px solid var(--line-strong, var(--black, var(--ink, #111)));
}
.pm-sheet-body .project-number {
  display:block; margin-bottom:10px;
  font-size:12px; font-weight:800; letter-spacing:.12em;
  color:var(--accent, #ff6533);
}
.pm-sheet-body p { color:var(--gray, #444); font-size:15px; line-height:1.7; }
body.dark .pm-sheet-body p,
html[data-theme-mode="dark"] .pm-sheet-body p { color:var(--black, var(--ink, #eee)); }
.pm-sheet-body .tags { display:flex; flex-wrap:wrap; gap:8px; margin:16px 0 22px; }
.pm-sheet-body .tags span {
  padding:6px 12px;
  border:2px solid currentColor;
  font-size:11px; font-weight:800; letter-spacing:.08em; text-transform:uppercase;
  color:var(--black, var(--ink, #111));
}
.pm-sheet-body .project-links { display:flex; gap:24px; font-weight:800; font-size:13px; text-transform:uppercase; letter-spacing:.06em; }
.pm-sheet-body .project-links a {
  color:var(--black, var(--ink, #111));
  border-bottom:3px solid var(--accent, #ff6533);
  padding-bottom:2px;
}
.pm-sheet-body .project-links a:hover { background:var(--accent, #ff6533); color:var(--white, #fff); }

/* Fullscreen photo viewer: original image at full size */
.pm-lightbox[hidden] { display:none; }
.pm-lightbox {
  position:fixed; inset:0; z-index:120;
  background:rgba(0,0,0,.92);
  display:flex; align-items:center; justify-content:center;
  padding:16px;
  animation:pm-fade .18s ease;
}
@keyframes pm-fade { from{opacity:0} to{opacity:1} }
.pm-lightbox img {
  max-width:100%; max-height:100%;
  width:auto; height:auto;
  object-fit:contain;
  cursor:zoom-out;
  touch-action:pinch-zoom;
}
.pm-lightbox-close {
  position:absolute; top:12px; right:14px; z-index:1;
  width:42px; height:42px;
  border:2px solid rgba(255,255,255,.85); border-radius:50%;
  background:rgba(0,0,0,.45); color:#fff;
  font-size:22px; line-height:1; cursor:pointer;
}
.pm-lightbox-close:focus-visible { outline:3px solid #fff; outline-offset:2px; }

/* Mobile compact cards: also follow theme inversion */
@media (max-width: 860px) {
  .pm-card {
    border-color:var(--black, var(--ink, #111));
    background:var(--surface, var(--white, var(--bg, #fff)));
    color:var(--black, var(--ink, #111));
  }
  .pm-thumb { border-bottom-color:var(--black, var(--ink, #111)); background:repeating-linear-gradient(-45deg,var(--gray-light,#eee) 0 10px,var(--surface,var(--white,#fff)) 10px 20px); }
  .pm-hint { color:var(--gray, #666); }
}

/* Footer: readable in dark mode across ALL themes */
/* Brutalist: footer uses --black as bg + hardcoded light-gray text; in dark mode bg flips light but text stays gray */
html[data-theme="brutalist-editorial"] body.dark .site-footer {
  background: var(--white, #0a0a0a);
  color: var(--gray, #b8b8b8);
}
html[data-theme="brutalist-editorial"] body.dark .site-footer strong { color: var(--black, #f5f5f5); }
html[data-theme="brutalist-editorial"] body.dark .footer-social .social-btn { color: var(--gray, #b8b8b8); }
html[data-theme="brutalist-editorial"] body.dark .footer-social .social-btn:hover { background: var(--black, #f5f5f5); color: var(--white, #0a0a0a); }
html[data-theme="brutalist-editorial"] body.dark .site-footer .copyright { color: var(--faint, #777); }

/* Other themes: ensure muted text lifts on dark surfaces */
body.dark .site-footer { color: var(--muted, var(--faint, #aaa)); }
body.dark .site-footer strong { color: var(--ink, var(--black, #eee)); }
body.dark .site-footer a { color: inherit; }
body.dark .site-footer .social-btn { color: var(--muted, var(--faint, #aaa)); }
body.dark .live-data-attribution { color: var(--faint, #888); }
body.dark .live-data-attribution a { color: var(--muted, #bbb); }
