/* Targeted production fixes: theme toggle, orbit geometry, manifesto cards and accessibility. */

/* ------------------------------
   Theme tokens
   ------------------------------ */
html[data-theme="light"] {
  --bg: #f3f6f4;
  --panel: rgba(255, 255, 255, .76);
  --text: #111719;
  --muted: #657177;
  --accent: #087f60;
  --blue: #2d63c8;
  --hot: #d45f42;
  --line: rgba(15, 24, 26, .14);
  color-scheme: light;
}

html[data-theme="dark"] { color-scheme: dark; }

html[data-theme="light"],
html[data-theme="light"] body { background: var(--bg); color: var(--text); }

/* Keep fixed/animated decorative elements from creating a horizontal viewport. */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.theme-icon,
.motion-icon {
  display: block;
  font-size: 17px;
  line-height: 1;
}

.theme-button,
.motion-button { transition: transform .25s var(--ease), background .25s var(--ease), border-color .25s var(--ease); }
.theme-button:hover { transform: rotate(12deg); }

html[data-theme="light"] #ambientCanvas { opacity: .28; filter: saturate(.8) contrast(.88); }
html[data-theme="light"] .grain { opacity: .025; mix-blend-mode: multiply; }
html[data-theme="light"] .topbar {
  background: rgba(248, 251, 249, .82);
  border-color: rgba(15,24,26,.12);
  box-shadow: 0 18px 70px rgba(34,49,45,.12);
}
html[data-theme="light"] .topbar nav a { color: #59646a; }
html[data-theme="light"] .topbar nav a:hover,
html[data-theme="light"] .topbar nav a.active { color: #111719; background: rgba(17,23,25,.07); }
html[data-theme="light"] .icon-button { background: rgba(255,255,255,.66); }
html[data-theme="light"] .glass {
  background: linear-gradient(145deg, rgba(255,255,255,.92), rgba(239,245,241,.68));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.94), 0 30px 90px rgba(40,62,54,.10);
}
html[data-theme="light"] .outline { -webkit-text-stroke-color: rgba(17,23,25,.62); text-stroke-color: rgba(17,23,25,.62); }
html[data-theme="light"] .manifesto-text { color: #20282b; }
html[data-theme="light"] .section-lead,
html[data-theme="light"] .hero-statement,
html[data-theme="light"] .discipline-card p,
html[data-theme="light"] .cap-line p,
html[data-theme="light"] .project-bottom p,
html[data-theme="light"] .job p,
html[data-theme="light"] .edu-card p,
html[data-theme="light"] .cv-copy p,
html[data-theme="light"] .dialog-body p,
html[data-theme="light"] .model-panel > p,
html[data-theme="light"] .contact-kicker,
html[data-theme="light"] .contact footer { color: #5f6b70; }
html[data-theme="light"] .lab-controls label,
html[data-theme="light"] .lab-project .tags span,
html[data-theme="light"] .stack-row span,
html[data-theme="light"] .dialog-stack span { color: #667278; }
html[data-theme="light"] .lab-controls output,
html[data-theme="light"] .model-panel dd { color: var(--text); }
html[data-theme="light"] .button-ghost { background: rgba(17,23,25,.035); }
html[data-theme="light"] .button-ghost:hover { background: rgba(17,23,25,.075); }
html[data-theme="light"] .console-top { background: rgba(17,23,25,.035); }
html[data-theme="light"] .console-top span { background: rgba(17,23,25,.24); }
html[data-theme="light"] .console-top b,
html[data-theme="light"] .code-muted { color: #758087; }
html[data-theme="light"] .hero-console pre { color: #20282b; }
html[data-theme="light"] .code-string { color: #285ebd; }
html[data-theme="light"] .project-card { background: linear-gradient(145deg, rgba(255,255,255,.86), rgba(234,241,237,.56)); }
html[data-theme="light"] .project-card:hover { background: linear-gradient(145deg, rgba(8,127,96,.09), rgba(255,255,255,.78)); }
html[data-theme="light"] .project-dialog { background: rgba(247,250,248,.97); color: var(--text); box-shadow: 0 40px 140px rgba(32,48,43,.22); }
html[data-theme="light"] .project-dialog::backdrop { background: rgba(226,233,229,.72); }
html[data-theme="light"] .dialog-close { background: rgba(17,23,25,.04); }
html[data-theme="light"] .job h3 span { color: #6a7479; }
html[data-theme="light"] .project-order { color: #738087; }
html[data-theme="light"] .timeline-item::before { background: var(--bg); }
html[data-theme="light"] .contact-mail span { -webkit-text-stroke-color: rgba(17,23,25,.58); }
html[data-theme="light"] .cursor-ring { border-color: rgba(8,127,96,.55); }
html[data-theme="light"] body.cursor-hover .cursor-ring { border-color: rgba(17,23,25,.5); }

/* ------------------------------
   Responsive top navigation
   ------------------------------ */
.topbar {
  max-width: calc(100vw - 28px);
}

.topbar .brand,
.topbar .top-actions,
.topbar nav { flex-shrink: 0; }

.topbar .top-actions {
  min-width: 0;
}

@media (max-width: 900px) {
  .topbar {
    left: 14px !important;
    right: 14px !important;
    width: auto !important;
    max-width: none !important;
    transform: none !important;
  }

  .topbar nav {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .topbar {
    top: 8px;
    left: 8px !important;
    right: 8px !important;
    min-height: 52px;
    padding: 6px 7px 6px 12px;
    gap: 8px;
  }

  .top-actions { gap: 4px; }

  .icon-button {
    width: 36px;
    height: 36px;
  }

  .brand { font-size: .98rem; }
}

/* ------------------------------
   Manifesto cards: prevent SOFTWARE clipping
   ------------------------------ */
.discipline-card h2 {
  font-size: clamp(2.05rem, 3.7vw, 4.25rem);
  line-height: .9;
  letter-spacing: -.05em;
  word-break: keep-all;
  overflow-wrap: normal;
}

/* ------------------------------
   Toolbox constellation
   ------------------------------ */
.constellation {
  position: relative;
  width: 100%;
  max-width: 640px;
  min-height: 640px;
  aspect-ratio: 1;
  justify-self: center;
  overflow: visible;
  isolation: isolate;
}

.constellation-core {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 5;
}

.orbit {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  margin: 0 !important;
  border-radius: 50%;
  transform: translate(-50%, -50%) !important;
  transform-origin: center center !important;
  animation: none !important;
}

.orbit-1 { width: 240px !important; height: 240px !important; }
.orbit-2 { width: 390px !important; height: 390px !important; }
.orbit-3 { width: 550px !important; height: 550px !important; }

.orbit button {
  position: absolute !important;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center !important;
  animation: none !important;
  rotate: none !important;
  background: rgba(8,11,16,.94);
  box-shadow: 0 10px 25px rgba(0,0,0,.22);
  will-change: left, top;
}

html[data-theme="light"] .orbit button {
  background: rgba(247,250,248,.96);
  color: #273135;
  box-shadow: 0 10px 25px rgba(35,53,47,.12);
}

/* ------------------------------
   Certifications marquee
   ------------------------------ */
.cert-marquee .marquee-track {
  display: flex;
  width: max-content;
  gap: 0;
  padding: 0;
  animation: certifications-marquee 30s linear infinite;
  will-change: transform;
}

.marquee-set {
  display: flex;
  align-items: center;
  gap: 30px;
  flex: none;
  padding: 22px 30px 22px 0;
}

@keyframes certifications-marquee {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}

body.motion-off .cert-marquee .marquee-track { animation-play-state: paused !important; }

/* ------------------------------
   Custom cursor
   ------------------------------ */
@media (hover: hover) and (pointer: fine) {
  body.cursor-ready,
  body.cursor-ready * {
    cursor: none !important;
  }
}

@media (max-width: 720px) {
  .constellation { max-width: 420px; min-height: 420px; }
  .orbit-1 { width: 170px !important; height: 170px !important; }
  .orbit-2 { width: 270px !important; height: 270px !important; }
  .orbit-3 { width: 370px !important; height: 370px !important; }
  .orbit button { font-size: 8px; padding: 6px 8px; }
  .marquee-set { gap: 22px; padding-right: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .cert-marquee .marquee-track { animation: none !important; }
}

/* ------------------------------
   Visual refinement
   Less template-like / less "AI portfolio": fewer glows, fewer pills,
   quieter surfaces and more editorial geometry without losing the motion.
   ------------------------------ */

/* Status indicators should read as information, not decoration. */
.live-dot {
  width: 5px !important;
  height: 5px !important;
  background: #79c7a8 !important;
  box-shadow: none !important;
}

.pulse {
  width: 5px !important;
  height: 5px !important;
  box-shadow: none !important;
  animation: status-blink 2.8s steps(1, end) infinite !important;
}

@keyframes status-blink {
  0%, 72% { opacity: 1; }
  73%, 100% { opacity: .35; }
}

/* Keep the custom pointer expressive; remove glow language elsewhere. */
.cursor-dot { box-shadow: none !important; }

/* Surfaces: flatter, denser and more intentional. */
.glass {
  background: rgba(255,255,255,.035) !important;
  border-color: rgba(255,255,255,.11) !important;
  box-shadow: none !important;
  backdrop-filter: blur(10px) !important;
}

.topbar {
  border-radius: 16px !important;
  background: rgba(7,10,14,.9) !important;
  box-shadow: 0 8px 26px rgba(0,0,0,.22) !important;
  backdrop-filter: blur(14px) saturate(115%) !important;
}

.icon-button {
  border-radius: 10px !important;
  background: transparent !important;
}

.button {
  border-radius: 10px !important;
  min-height: 46px;
}

.button-primary {
  box-shadow: none !important;
}

.filter,
.pipeline span,
.stack-row span,
.tags span,
.dialog-stack span,
.model-chip {
  border-radius: 6px !important;
}

.discipline-card,
.edu-card,
.project-card {
  border-radius: 18px !important;
}

.lab-shell,
.cv-card,
.project-dialog {
  border-radius: 20px !important;
}

.hero-console {
  transform: none !important;
  border-radius: 14px !important;
}

.project-open,
.dialog-close {
  border-radius: 10px !important;
}

/* Remove the stock neon blob from the manifesto cards. */
.discipline-card::before {
  display: none !important;
}

/* Accent is used for hierarchy, not sprayed over every small label. */
.section-index {
  color: #8ba59b !important;
}

.project-kicker {
  color: #95b7aa !important;
}

/* Project cards feel closer to product case studies than generated glass cards. */
.project-card {
  background: rgba(255,255,255,.022) !important;
}

.project-card:hover {
  background: rgba(255,255,255,.045) !important;
  border-color: rgba(146,247,208,.28) !important;
}

/* Tone down decorative glows while keeping the actual simulations/graphics. */
.earth-visual,
.constellation-core {
  box-shadow: none !important;
}

.hero:before {
  opacity: .45;
}

.grain {
  opacity: .025 !important;
}

/* Light mode gets the same restrained language. */
html[data-theme="light"] .glass {
  background: rgba(255,255,255,.7) !important;
  border-color: rgba(15,24,26,.12) !important;
  box-shadow: none !important;
}

html[data-theme="light"] .topbar {
  background: rgba(248,250,249,.92) !important;
  box-shadow: 0 8px 24px rgba(35,53,47,.08) !important;
}

html[data-theme="light"] .icon-button {
  background: transparent !important;
}

html[data-theme="light"] .project-card {
  background: rgba(255,255,255,.55) !important;
}

html[data-theme="light"] .project-card:hover {
  background: rgba(255,255,255,.82) !important;
  border-color: rgba(8,127,96,.24) !important;
}

@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none !important; }
}
