:root {
  --navy: #1a2340;
  --ink: #1a2340;
  --muted: #5c667a;
  --bg: #f7f5f8;
  --bg-soft: #ffffff;
  --bg-elevated: #ffffff;
  --line: rgba(26, 35, 64, 0.1);
  --orange: #f58220;
  --magenta: #9e2a8c;
  --purple: #662d91;
  --accent: var(--orange);
  --accent-2: var(--purple);
  --brand-grad: linear-gradient(120deg, #f58220 0%, #c43a7a 48%, #662d91 100%);
  --card: #ffffff;
  --shadow: 0 28px 70px rgba(26, 35, 64, 0.1);
  --header-bg: rgba(255, 255, 255, 0.86);
  --footer-bg: #ffffff;
  --chip-bg: #ffffff;
  --input-bg: #ffffff;
  --nav-panel: rgba(255, 255, 255, 0.98);
  --nav-link-bg: #f7f5f8;
  --hero-wash: linear-gradient(180deg, #ffffff 0%, #f6f1f8 55%, #efe8f5 100%);
  --close-bg: #ffffff;
  --admin-bg: #f4f2f7;
  --admin-side: #ffffff;
  --flash-bg: rgba(245, 130, 32, 0.1);
  --flash-border: rgba(245, 130, 32, 0.28);
  --danger-bg: rgba(220, 60, 60, 0.08);
  --danger-border: rgba(220, 60, 60, 0.28);
  --danger-text: #8a1f1f;
  --font-display: "Sora", sans-serif;
  --font-body: "Manrope", sans-serif;
  --radius: 22px;
  --logo-filter: none;
}

html[data-theme="dark"] {
  --navy: #f3eef8;
  --ink: #f0eaf7;
  --muted: #a79bb8;
  --bg: #0b0a10;
  --bg-soft: #100e16;
  --bg-elevated: #17141f;
  --line: rgba(243, 238, 248, 0.12);
  --card: #17141f;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(11, 10, 16, 0.88);
  --footer-bg: #100e16;
  --chip-bg: #17141f;
  --input-bg: #12101a;
  --nav-panel: rgba(16, 14, 22, 0.98);
  --nav-link-bg: #1a1624;
  --hero-wash: linear-gradient(180deg, #0b0a10 0%, #120e1a 55%, #0b0a10 100%);
  --close-bg: #100e16;
  --admin-bg: #0b0a10;
  --admin-side: #12101a;
  --flash-bg: rgba(245, 130, 32, 0.14);
  --flash-border: rgba(245, 130, 32, 0.35);
  --danger-bg: rgba(255, 107, 107, 0.12);
  --danger-border: rgba(255, 107, 107, 0.35);
  --danger-text: #ffb4b4;
  --logo-filter: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(900px 420px at 0% -5%, rgba(245, 130, 32, 0.12), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(102, 45, 145, 0.1), transparent 50%),
    var(--bg);
  line-height: 1.55;
  overflow-x: hidden;
}
body.page-home { background: var(--bg-soft); }
body.page-dev {
  background:
    radial-gradient(800px 420px at 10% -10%, rgba(102, 45, 145, 0.18), transparent 55%),
    var(--bg);
}
body.page-design {
  background:
    radial-gradient(800px 420px at 90% -10%, rgba(245, 130, 32, 0.16), transparent 55%),
    var(--bg);
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
main, .site-header, .site-footer { position: relative; z-index: 1; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 3rem);
  padding-left: max(clamp(1rem, 4vw, 3rem), env(safe-area-inset-left));
  padding-right: max(clamp(1rem, 4vw, 3rem), env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
}
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
}
.brand-mark {
  height: 44px;
  width: auto;
  max-width: 48px;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
  display: block;
}
html[data-theme="dark"] .brand-mark,
html[data-theme="dark"] .px-hero-mark,
html[data-theme="dark"] .px-stage-mark,
html[data-theme="dark"] .px-close-mark,
html[data-theme="dark"] .footer-mark,
html[data-theme="dark"] .admin-brand-img {
  filter: brightness(0.96) contrast(1.08) saturate(1.05);
}
html[data-theme="dark"] .brand-mark,
html[data-theme="dark"] .px-hero-mark,
html[data-theme="dark"] .px-stage-mark,
html[data-theme="dark"] .px-close-mark,
html[data-theme="dark"] .footer-mark,
html[data-theme="dark"] .admin-brand-img {
  filter: contrast(1.12) saturate(1.06) brightness(0.96);
}
.brand-text {
  display: grid;
  line-height: 1.05;
  font-family: var(--font-display);
  color: var(--ink);
}
.brand-text strong { font-weight: 800; }
.brand-text small {
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-top: 0.15rem;
}
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elevated);
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  z-index: 50;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.theme-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--ink);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  font: inherit;
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; width: 18px; height: 18px; }
html[data-theme="light"] .theme-toggle .icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}
.site-header .nav {
  margin-left: auto;
  margin-right: 0.75rem;
}
body.nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}
.nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.nav a { color: var(--muted); font-weight: 600; }
.nav a.active, .nav a:hover { color: var(--navy); }
.nav-cta {
  border: 1px solid var(--line);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: var(--bg-elevated);
}
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 2rem clamp(1.2rem, 4vw, 3rem) 3rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 0;
  background: var(--footer-bg);
}
.footer-brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.footer-mark {
  width: auto;
  height: 36px;
  object-fit: contain;
}
.footer-brand strong {
  display: block;
  color: var(--navy);
  font-family: var(--font-display);
}
.footer-brand p { margin: 0.15rem 0 0; font-size: 0.8rem; }

/* —— Home: PayPal-like sticky / parallax scrollytelling —— */
.px-hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}
.px-hero-bg {
  position: absolute;
  inset: -12% -8%;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 30%, rgba(245, 130, 32, 0.22), transparent 40%),
    radial-gradient(circle at 78% 35%, rgba(102, 45, 145, 0.2), transparent 42%),
    var(--hero-wash);
  will-change: transform;
}
.px-hero-inner {
  width: min(920px, calc(100% - 2.4rem));
  text-align: center;
  padding: 4rem 0 5rem;
}
.px-hero-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.9rem, 3vw, 1.6rem);
  flex-wrap: wrap;
  margin: 0 auto 1.5rem;
  animation: logoIn 0.9s ease both;
}
.px-hero-mark {
  width: min(148px, 32vw);
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
}
.px-hero-wordmark {
  text-align: left;
}
.px-hero-title {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  font-family: var(--font-display);
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--ink);
}
.px-hero-title strong { font-weight: 800; }
.px-hero-tag {
  margin: 0.45rem 0 0;
  font-size: clamp(0.72rem, 2vw, 0.9rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
@keyframes logoIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.px-hero-line {
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  max-width: 34rem;
  margin: 0 auto;
}
.px-hero-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.6rem;
}
.px-scroll-hint {
  margin-top: 3rem;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  animation: hintPulse 2.2s ease-in-out infinite;
}
.px-scroll-hint span {
  width: 1px;
  height: 34px;
  background: var(--brand-grad);
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.45; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(6px); }
}

.px-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(1rem, 3vw, 2.5rem);
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 10vh 0 18vh;
}
.px-stage-pin {
  position: sticky;
  top: 12vh;
  align-self: start;
  height: 76vh;
}
.px-stage-visual {
  position: relative;
  height: 100%;
  border-radius: 32px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(1.4rem, 3vw, 2.4rem);
  color: #fff;
  box-shadow: var(--shadow);
  will-change: transform;
}
.design-visual {
  background:
    linear-gradient(160deg, rgba(26, 35, 64, 0.15), rgba(26, 35, 64, 0.55)),
    var(--brand-grad);
}
.develop-visual {
  background:
    linear-gradient(160deg, rgba(26, 35, 64, 0.2), rgba(26, 35, 64, 0.7)),
    linear-gradient(135deg, #2a1a4a, #4a1f6b 40%, #1a2340 100%);
}
.px-stage-mark {
  position: absolute;
  top: 8%;
  right: 6%;
  width: min(180px, 38%);
  height: auto;
  object-fit: contain;
  opacity: 0.92;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.25));
  will-change: transform;
}
.px-stage-glow {
  position: absolute;
  inset: auto auto 10% -10%;
  width: 55%;
  height: 45%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 70%);
  pointer-events: none;
}
.px-stage-kicker {
  margin: 0 0 0.6rem;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.9;
}
.px-stage-visual h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  max-width: 10ch;
  color: #fff;
}
.px-stage-rail {
  display: grid;
  gap: 1.25rem;
  padding-top: 8vh;
  padding-bottom: 20vh;
}
.px-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1.5rem 1.4rem;
  box-shadow: var(--shadow);
}
.px-card h3 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  margin: 0 0 0.55rem;
}
.px-card p { color: var(--muted); margin: 0 0 0.85rem; }
.accent-card {
  background: linear-gradient(160deg, var(--card), color-mix(in srgb, var(--purple) 12%, var(--card)));
  border-color: rgba(158, 42, 140, 0.28);
}
.px-stage.invert .px-stage-pin { order: 2; }
.px-stage.invert .px-stage-rail { order: 1; }

.code-orbit {
  position: absolute;
  inset: 12% auto auto 10%;
  width: 160px;
  height: 160px;
}
.code-orbit span {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  inset: 0;
  animation: orbitSpin 12s linear infinite;
}
.code-orbit span:nth-child(2) { inset: 18%; animation-duration: 9s; }
.code-orbit span:nth-child(3) { inset: 36%; animation-duration: 6s; }
@keyframes orbitSpin {
  to { transform: rotate(360deg); }
}

.px-close {
  padding: 8vh 1.2rem 12vh;
  background:
    radial-gradient(600px 280px at 50% 0%, rgba(245, 130, 32, 0.12), transparent 60%),
    var(--close-bg);
  border-top: 1px solid var(--line);
}
.px-close-inner {
  width: min(720px, 100%);
  margin: 0 auto;
  text-align: center;
}
.px-close-inner img,
.px-close-mark {
  width: auto;
  height: 72px;
  max-width: 80px;
  object-fit: contain;
  margin: 0 auto 1rem;
}
.px-close-inner h2 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin-bottom: 0.6rem;
}
.px-close-inner > p { color: var(--muted); }

.page-intro, .detail, .card-grid, .masonry, .login-wrap {
  width: min(1120px, calc(100% - 2.4rem));
  margin-inline: auto;
}
.page-intro { padding: 3rem 0 1.5rem; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
  margin: 0 0 0.75rem;
}
h1, h2 {
  font-family: var(--font-display);
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin: 0 0 1rem;
  color: var(--navy);
}
.lede { font-size: 1.1rem; color: var(--muted); max-width: 38rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.75rem 1.2rem;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
}
.btn.primary {
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 12px 28px rgba(158, 42, 140, 0.25);
}
.btn.ghost {
  border-color: var(--line);
  background: var(--bg-elevated);
  color: var(--navy);
}
.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  color: var(--muted);
  font-size: 0.9rem;
  background: var(--chip-bg);
}
.chip.active, .chip:hover {
  color: #fff;
  background: var(--brand-grad);
  border-color: transparent;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding-bottom: 3rem;
}
.project-card, .work-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.project-card h2, .work-card h2 { font-size: 1.35rem; }
.project-card p, .work-card p, .muted { color: var(--muted); }
.card-meta { display: flex; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.8rem; }
.demo-pill {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: #fff;
  background: var(--brand-grad);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-weight: 700;
}
.tech-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tech-row span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--chip-bg);
}
.text-link {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}

.masonry {
  columns: 3 260px;
  gap: 1rem;
  padding-bottom: 3rem;
}
.work-card {
  break-inside: avoid;
  margin-bottom: 1rem;
  padding: 0;
  overflow: hidden;
}
.work-body { padding: 1rem 1.1rem 1.2rem; }
.work-cover { display: block; aspect-ratio: 4/3; overflow: hidden; background: color-mix(in srgb, var(--purple) 18%, var(--bg)); }
.work-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-fallback {
  height: 100%;
  min-height: 180px;
  display: grid;
  place-content: center;
  gap: 0.4rem;
  text-align: center;
  padding: 1.5rem;
  color: #fff;
  background: var(--brand-grad);
}
.cover-fallback.large { min-height: 320px; border-radius: var(--radius); }
.cover-fallback strong { font-family: var(--font-display); font-size: 1.5rem; }

.detail { padding: 2.5rem 0 3rem; }
.back { color: var(--muted); display: inline-block; margin-bottom: 1rem; }
.prose { max-width: 46rem; color: var(--muted); margin: 1.5rem 0 2rem; }
.demo-panel, .code-demo {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #151821;
  color: #e8eef8;
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.demo-panel h2, .demo-head h2 { color: #fff; }
.demo-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.embed-frame {
  margin-top: 1rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  aspect-ratio: 16/9;
}
.embed-frame iframe { width: 100%; height: 100%; border: 0; }
.playground { display: grid; gap: 0.75rem; margin-top: 1rem; }
.playground label { color: #c9d2e3; }
.playground textarea,
.admin-form input,
.admin-form textarea,
.admin-form select,
.login-card input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--navy);
  padding: 0.75rem 0.9rem;
  font: inherit;
}
.playground textarea {
  background: #0f131c;
  color: #e8eef8;
  border-color: rgba(255,255,255,0.1);
}
.playground-output {
  margin: 0;
  border-radius: 12px;
  overflow: auto;
  background: #0b1010;
  border: 1px solid rgba(255,255,255,0.08);
}
.code-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.code-tab {
  border: 1px solid rgba(255,255,255,0.14);
  background: transparent;
  color: #c9d2e3;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font: inherit;
}
.code-tab.active {
  background: var(--brand-grad);
  color: #fff;
  border-color: transparent;
}
.code-pane { display: none; }
.code-pane.active { display: block; }
.code-pane pre { margin: 0; border-radius: 12px; overflow: auto; }
.gallery { display: grid; gap: 1rem; }
.gallery figure { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }

.login-wrap { min-height: 70vh; display: grid; place-items: center; padding: 2rem 0; }
.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1.75rem;
  background: var(--card);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.9rem;
}
.login-card form { display: grid; gap: 0.9rem; }
.login-card label, .admin-form label { display: grid; gap: 0.35rem; font-weight: 600; }
.creds { color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); padding-top: 0.8rem; }
.flash {
  width: min(1120px, calc(100% - 2.4rem));
  margin: 1rem auto 0;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: var(--flash-bg);
  border: 1px solid var(--flash-border);
}
.flash.error {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.admin-body { background: var(--admin-bg); color: var(--navy); }
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-sidebar {
  border-right: 1px solid var(--line);
  padding: 1.5rem 1.1rem;
  background: var(--admin-side);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.admin-brand-img {
  width: auto;
  height: 40px;
  max-width: 44px;
  object-fit: contain;
  margin-bottom: 0.4rem;
  display: block;
}
.admin-role {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 0.72rem;
  margin: 1rem 0 0;
  font-weight: 700;
}
.admin-user { margin: 0 0 1rem; color: var(--muted); }
.admin-sidebar nav { display: grid; gap: 0.35rem; }
.admin-sidebar a {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
}
.admin-sidebar a.active, .admin-sidebar a:hover {
  background: rgba(158, 42, 140, 0.08);
  color: var(--navy);
}
.logout-form { margin-top: auto; }
.logout-form button, .actions button {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  font: inherit;
}
.admin-main { padding: 1.5rem clamp(1rem, 3vw, 2rem); }
.admin-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 16px; overflow: hidden; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.admin-table th { color: var(--muted); font-weight: 600; }
.actions { display: flex; gap: 0.6rem; align-items: center; }
.actions form { margin: 0; }
.status { font-size: 0.8rem; padding: 0.2rem 0.55rem; border-radius: 999px; }
.status.on { background: rgba(245, 130, 32, 0.12); color: #f0a35a; }
html[data-theme="light"] .status.on { color: #b85a00; }
.status.off { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--muted); }
.admin-form { display: grid; gap: 0.9rem; max-width: 820px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.checkbox { display: flex !important; align-items: center; gap: 0.55rem; }
.snippet-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: var(--card);
}
.snippet-row { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.empty { color: var(--muted); }

/* —— Responsive —— */
@media (max-width: 1100px) {
  .px-stage {
    width: min(100% - 1.5rem, 960px);
    gap: 1.25rem;
    padding: 6vh 0 12vh;
  }
  .px-stage-visual h2 { max-width: 12ch; }
}

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.admin-nav-toggle { display: none; }

@media (max-width: 900px) {
  .px-stage,
  .px-stage.invert,
  .admin-shell,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .px-stage.invert .px-stage-pin,
  .px-stage.invert .px-stage-rail { order: initial; }
  .px-stage {
    width: calc(100% - 1.25rem);
    padding: 3vh 0 6vh;
  }
  .px-stage-pin {
    position: relative;
    top: auto;
    height: auto;
    min-height: 280px;
  }
  .px-stage-visual {
    min-height: 280px;
    height: auto;
    aspect-ratio: 16 / 11;
    border-radius: 22px;
  }
  .px-stage-rail {
    padding-top: 1rem;
    padding-bottom: 2rem;
    gap: 0.9rem;
  }
  .px-stage-mark { width: min(120px, 30%); }
  .admin-shell { display: block; }
  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .masonry { columns: 2 220px; }
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .admin-nav-toggle { display: inline-flex; }
  .admin-sidebar nav,
  .admin-sidebar .logout-form,
  .admin-sidebar .admin-user,
  .admin-sidebar .admin-role {
    display: none;
  }
  .admin-sidebar.is-open nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
  }
  .admin-sidebar.is-open .logout-form,
  .admin-sidebar.is-open .admin-user,
  .admin-sidebar.is-open .admin-role {
    display: block;
  }
  .admin-sidebar.is-open .admin-role { margin-top: 0.75rem; }
}

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .site-header .nav { margin-left: 0; margin-right: 0; }
  .nav {
    position: fixed;
    inset: 0 0 auto 0;
    top: 0;
    padding: calc(4.6rem + env(safe-area-inset-top)) 1.25rem 1.25rem;
    background: var(--nav-panel);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    box-shadow: var(--shadow);
  }
  body.nav-open .nav {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  body.nav-open { overflow: hidden; }
  .nav a {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: var(--nav-link-bg);
  }
  .nav-cta {
    text-align: center;
    background: var(--brand-grad) !important;
    color: #fff !important;
    border: 0;
  }
  .brand-text small { display: none; }
  .px-hero {
    min-height: auto;
    padding: 2.5rem 0 3rem;
  }
  .px-hero-inner {
    width: min(920px, calc(100% - 1.5rem));
    padding: 1rem 0 2rem;
  }
  .px-hero-brand {
    flex-direction: column;
    text-align: center;
  }
  .px-hero-wordmark { text-align: center; }
  .px-hero-mark { width: min(120px, 36vw); }
  .px-hero-line { font-size: 1rem; }
  .px-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .px-hero-actions .btn { width: 100%; }
  .px-scroll-hint { margin-top: 2rem; }
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem clamp(1rem, 4vw, 2rem) 2.5rem;
  }
  .page-intro,
  .detail,
  .card-grid,
  .masonry,
  .login-wrap {
    width: min(1120px, calc(100% - 1.5rem));
  }
  .page-intro { padding: 2rem 0 1rem; }
  .page-intro h1,
  .detail-header h1 {
    font-size: clamp(1.8rem, 8vw, 2.4rem);
  }
  .admin-header {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-header .btn { width: 100%; text-align: center; }
  .admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
  }
  .admin-table { min-width: 560px; }
  .actions {
    flex-wrap: wrap;
  }
  .demo-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .code-tabs { gap: 0.35rem; }
  .code-tab { font-size: 0.82rem; }
  .px-close { padding: 5vh 1rem 8vh; }
  .px-close-inner h2 { font-size: clamp(1.7rem, 7vw, 2.4rem); }
  .flash {
    width: min(1120px, calc(100% - 1.5rem));
  }
}

@media (max-width: 560px) {
  .brand-mark { height: 38px; max-width: 40px; }
  .brand-text { font-size: 0.95rem; }
  .masonry { columns: 1; }
  .card-grid { grid-template-columns: 1fr; }
  .px-stage-visual {
    aspect-ratio: 5 / 4;
    min-height: 240px;
    border-radius: 18px;
    padding: 1.1rem;
  }
  .px-stage-visual h2 { font-size: 1.55rem; }
  .px-card { padding: 1.15rem 1rem; border-radius: 18px; }
  .login-card { padding: 1.25rem; border-radius: 18px; }
  .detail-actions { flex-direction: column; align-items: stretch; }
  .detail-actions .btn { width: 100%; justify-content: center; }
  .embed-frame { aspect-ratio: 4 / 3; }
  .chip-row { gap: 0.4rem; }
  .chip { font-size: 0.82rem; }
  .form-grid { grid-template-columns: 1fr; }
  .snippet-box { padding: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .px-hero-brand, .px-scroll-hint, .code-orbit span { animation: none; }
  [data-parallax] { transform: none !important; }
  .nav { transition: none; }
}
