/* ==========================================================================
   Shared dark theme: dark navy, blue/purple glows, dot/grid texture,
   Poppins headings, frosted header, gradient pill buttons, glass cards.
   Applied to any page whose <body> has class "theme-dark" (every page
   except skills.html, which uses skills.css). Home-only hero pieces live
   in home.css.
   ========================================================================== */

.theme-dark {
  --dk-bg: #070b1f;
  --dk-bg-2: #0c1230;
  --dk-text: #ffffff;
  --dk-muted: #b9c1dc;        /* 10.9:1 on --dk-bg, 6:1 on the glass card */
  --dk-link: #a9c6ff;         /* 11.3:1 on --dk-bg */
  --dk-link-hover: #d4e2ff;
  --dk-line: rgba(255, 255, 255, 0.14);
  --dk-glass: rgba(255, 255, 255, 0.06);
  --dk-blue: #3451e8;
  --dk-purple: #7c3aed;
  --dk-font: "Poppins", "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --focus-ring: 0.1875rem solid #a9c6ff;

  color: var(--dk-text);
  background-color: var(--dk-bg);
  background-image:
    radial-gradient(ellipse 60rem 38rem at 85% -5%, rgba(87, 70, 255, 0.38), transparent 60%),
    radial-gradient(ellipse 48rem 32rem at 0% 20%, rgba(36, 104, 255, 0.28), transparent 62%),
    radial-gradient(ellipse 40rem 30rem at 60% 55%, rgba(150, 60, 255, 0.14), transparent 65%),
    linear-gradient(180deg, var(--dk-bg) 0%, var(--dk-bg-2) 55%, var(--dk-bg) 100%);
  background-repeat: no-repeat;
  font-family: var(--dk-font);
  position: relative;
  overflow-x: hidden;
}

/* Subtle grid + dot texture over the top of the page (decorative). */
.theme-dark::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 70rem;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.16) 0.0625rem, transparent 0.0625rem),
    linear-gradient(rgba(255, 255, 255, 0.035) 0.0625rem, transparent 0.0625rem),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0.0625rem, transparent 0.0625rem);
  background-size: 1.5rem 1.5rem, 4.5rem 4.5rem, 4.5rem 4.5rem;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.6) 45%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.6) 45%, transparent 100%);
}

.theme-dark .site-main {
  overflow-x: hidden; /* fallback */
  overflow-x: clip;   /* keep glows and the tilted tile from causing sideways scroll */
}

.theme-dark .site-main,
.theme-dark .site-footer,
.theme-dark .site-header {
  position: relative;
  z-index: 1;
}

.theme-dark h1,
.theme-dark h2,
.theme-dark h3 {
  font-family: var(--dk-font);
  color: var(--dk-text);
}

.theme-dark a {
  color: var(--dk-link);
}

.theme-dark a:hover {
  color: var(--dk-link-hover);
}

.theme-dark .skip-link {
  background: var(--dk-bg);
  color: var(--dk-text);
  border-color: var(--dk-link);
}

/* ---------- Header ---------- */

.theme-dark .site-header {
  position: sticky;
  z-index: 100;
  background: rgba(7, 11, 31, 0.72);
  -webkit-backdrop-filter: blur(0.75rem);
  backdrop-filter: blur(0.75rem);
  border-bottom: 0.0625rem solid var(--dk-line);
}

.theme-dark .site-logo {
  color: var(--dk-text);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.theme-dark .site-logo__text {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.theme-dark .site-logo:hover {
  color: var(--dk-link-hover);
}

.theme-dark .nav-toggle {
  background: transparent;
  color: var(--dk-text);
  border-color: var(--dk-line);
  border-radius: 999px;
}

.theme-dark .nav-toggle:hover {
  border-color: var(--dk-text);
}

.theme-dark .site-nav a {
  color: var(--dk-muted);
  border-bottom-color: var(--dk-line);
}

.theme-dark .site-nav a:hover {
  color: var(--dk-text);
  background: rgba(255, 255, 255, 0.06);
}

.theme-dark .site-nav a[aria-current="page"] {
  color: var(--dk-text);
  box-shadow: inset 0.25rem 0 0 #8b7bff;
}

.theme-dark .header-cta {
  display: none;
}

@media (min-width: 48rem) {
  .theme-dark .site-header__inner {
    gap: var(--space-lg);
  }

  .theme-dark .site-nav {
    margin-left: auto;
  }

  .theme-dark .site-nav a {
    font-size: 0.95rem;
  }

  .theme-dark .site-nav a[aria-current="page"] {
    box-shadow: inset 0 -0.125rem 0 #8b7bff;
  }

  .theme-dark .header-cta {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0 1.1rem;
    border: 0.0625rem solid rgba(169, 198, 255, 0.6);
    border-radius: 999px;
    color: var(--dk-text);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease;
  }

  .theme-dark .header-cta:hover {
    color: var(--dk-text);
    border-color: var(--dk-text);
    background: rgba(255, 255, 255, 0.08);
  }
}

/* ---------- Sections below the hero ---------- */

.theme-dark .section h2 {
  font-size: clamp(1.6rem, 2.5vw + 1rem, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.theme-dark .section-label {
  margin-bottom: var(--space-sm);
  color: #c4b5fd; /* 10.6:1 on --dk-bg */
}

.theme-dark .section > p {
  color: var(--dk-muted);
}

.theme-dark .service-list li,
.theme-dark .project-card,
.theme-dark .callout {
  background: var(--dk-glass);
  border: 0.0625rem solid var(--dk-line);
  border-radius: 1rem;
  box-shadow: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.theme-dark .service-list li:hover {
  border-color: rgba(169, 198, 255, 0.45);
  background: rgba(255, 255, 255, 0.08);
}

.theme-dark .service-list h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.theme-dark .service-list p,
.theme-dark .project-card__desc,
.theme-dark .project-card__category {
  color: var(--dk-muted);
}

.theme-dark .callout {
  border-left: 0.25rem solid #8b7bff;
  color: #e6e9f5;
}

.theme-dark .project-card__media {
  background:
    radial-gradient(circle at 30% 30%, rgba(110, 90, 255, 0.45), transparent 60%),
    linear-gradient(135deg, #18214d, #0e1433);
  border-bottom-color: var(--dk-line);
  color: #e6e9f5;
}

.theme-dark .project-card__title {
  color: var(--dk-text);
}

.theme-dark .button {
  border-radius: 999px;
  border: 0.0625rem solid transparent;
  background: linear-gradient(100deg, var(--dk-blue), var(--dk-purple));
  color: #fff;
  box-shadow: 0 0 1.25rem rgba(92, 84, 255, 0.4);
}

.theme-dark .button:hover {
  color: #fff;
  box-shadow: 0 0 2rem rgba(92, 84, 255, 0.65);
}

.theme-dark .button--secondary {
  background: transparent;
  border-color: rgba(169, 198, 255, 0.6);
  color: var(--dk-text);
  box-shadow: none;
}

.theme-dark .button--secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--dk-text);
  box-shadow: none;
}

/* ---------- Footer ---------- */

.theme-dark .site-footer {
  background: rgba(3, 6, 20, 0.6);
  border-top-color: var(--dk-line);
}

.theme-dark .site-footer__inner {
  color: var(--dk-muted);
}


/* ---------- Page headers + wave accent (inner pages) ---------- */

.theme-dark .page-header {
  position: relative;
  padding-bottom: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.theme-dark .page-header h1,
.theme-dark .error-page h1 {
  font-weight: 800;
  font-size: clamp(2.25rem, 6vw + 0.5rem, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.theme-dark .page-header p,
.theme-dark .lede,
.theme-dark .prose p,
.theme-dark .error-page p {
  color: var(--dk-muted);
}

/* Decorative pink → purple → blue → teal wave under page headers */
.theme-dark .page-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.75rem;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 40' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1'%3E%3Cstop offset='0' stop-color='%23ff4fa3'/%3E%3Cstop offset='.35' stop-color='%239b5cff'/%3E%3Cstop offset='.7' stop-color='%233d7bff'/%3E%3Cstop offset='1' stop-color='%232ee6c9'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 28 C 90 6, 180 38, 290 22 S 470 4, 600 20' fill='none' stroke='url(%23g)' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  filter: drop-shadow(0 0 0.35rem rgba(124, 92, 255, 0.6));
  opacity: 0.9;
}

.theme-dark .section h2,
.theme-dark .prose h2,
.theme-dark .skills-category h2 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.theme-dark .prose strong,
.theme-dark .callout strong {
  color: var(--dk-text);
}

/* ---------- Breadcrumb ---------- */

.theme-dark .breadcrumb {
  color: var(--dk-muted);
}

.theme-dark .breadcrumb li + li::before {
  color: #7f89ad; /* decorative separator */
}

.theme-dark .breadcrumb [aria-current="page"] {
  color: var(--dk-text);
}

/* ---------- Service pages: lists, tool chips, badges ---------- */

.theme-dark .skills-category h3 {
  color: var(--dk-text);
}

.theme-dark .skills-category h3.tool-group-heading {
  color: #c4b5fd;
}

.theme-dark .skills-category li {
  color: #e2e6f3;
}

.theme-dark .skills-category ul:not(.tool-list) li::marker {
  color: #8b7bff;
}

.theme-dark .tool-list li,
.theme-dark .skills-category .tool-list li + li {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--dk-line);
  color: #e2e6f3;
}

.theme-dark .project-card__badge {
  background: rgba(196, 181, 253, 0.14);
  border-color: rgba(196, 181, 253, 0.45);
  color: #ddd3ff; /* 6.2:1 worst case on the card */
}

/* ---------- Projects: filter + cards ---------- */

.theme-dark .project-filter button {
  background: rgba(255, 255, 255, 0.04);
  border: 0.0625rem solid rgba(169, 198, 255, 0.45);
  color: var(--dk-text);
}

.theme-dark .project-filter button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--dk-text);
  color: var(--dk-text);
}

.theme-dark .project-filter button[aria-pressed="true"],
.theme-dark .project-filter button.is-active {
  background: linear-gradient(100deg, var(--dk-blue), var(--dk-purple));
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 0 1.25rem rgba(92, 84, 255, 0.45);
}

.theme-dark .filter-status,
.theme-dark .project-empty {
  color: var(--dk-muted);
}

.theme-dark .project-card {
  overflow: hidden;
}

.theme-dark .project-card:hover {
  border-color: rgba(169, 198, 255, 0.45);
}

/* ---------- Contact: methods + form ---------- */

.theme-dark .contact-methods dt {
  color: var(--dk-muted);
}

.theme-dark .contact-methods dd {
  color: var(--dk-text);
}

.theme-dark .form {
  background: var(--dk-glass);
  border: 0.0625rem solid var(--dk-line);
  border-radius: 1rem;
  box-shadow: none;
}

.theme-dark .form-note {
  color: var(--dk-muted);
}

.theme-dark .form-field label {
  color: var(--dk-text);
}

.theme-dark .form-field input,
.theme-dark .form-field textarea {
  background: rgba(3, 6, 20, 0.55);
  border: 0.0625rem solid rgba(185, 193, 220, 0.45);
  border-radius: 0.75rem;
  color: var(--dk-text);
  font-family: inherit;
}

.theme-dark .form-field input::placeholder,
.theme-dark .form-field textarea::placeholder {
  color: #9aa3c2;
}

.theme-dark .form-field input:hover,
.theme-dark .form-field textarea:hover {
  border-color: rgba(185, 193, 220, 0.75);
}

.theme-dark .form-field input:focus-visible,
.theme-dark .form-field textarea:focus-visible {
  border-color: var(--dk-link);
}

.theme-dark .form-field input:user-invalid,
.theme-dark .form-field textarea:user-invalid,
.theme-dark .form-field input[aria-invalid="true"],
.theme-dark .form-field textarea[aria-invalid="true"] {
  border-color: #ff8a9a;
}

.theme-dark .field-error,
.theme-dark .form-status.is-error {
  color: #ffadb8; /* 6.5:1 worst case on the glass form */
}

.theme-dark .form-status {
  color: var(--dk-muted);
}

.theme-dark .form-status.is-success {
  color: #86efac; /* 8.2:1 worst case */
}

.theme-dark .form .button,
.theme-dark .form button[type="submit"] {
  font-family: inherit;
}

/* ---------- Particle background: readability + frosted glass ---------- */

.theme-dark.has-particles .page-header > h1,
.theme-dark.has-particles .page-header > p,
.theme-dark.has-particles .section > h2,
.theme-dark.has-particles .section > p,
.theme-dark.has-particles .prose > p,
.theme-dark.has-particles .skills-category > h2,
.theme-dark.has-particles .skills-category > p,
.theme-dark.has-particles .skills-category li,
.theme-dark.has-particles .breadcrumb,
.theme-dark.has-particles .error-page > p,
.theme-dark.has-particles .contact-methods,
.theme-dark.has-particles .filter-status {
  text-shadow: 0 0 0.75rem rgba(7, 11, 31, 0.9);
}

.theme-dark .service-list li,
.theme-dark .project-card,
.theme-dark .callout,
.theme-dark .form {
  -webkit-backdrop-filter: blur(0.5rem);
  backdrop-filter: blur(0.5rem);
}

.theme-dark .button--secondary,
.theme-dark .project-filter button:not([aria-pressed="true"]) {
  -webkit-backdrop-filter: blur(0.375rem);
  backdrop-filter: blur(0.375rem);
}

/* ---------- Motion and fallbacks ---------- */

@media (prefers-reduced-motion: reduce) {
  .theme-dark .header-cta,
  .theme-dark .service-list li,
  .theme-dark .project-card,
  .theme-dark .callout,
  .theme-dark .button {
    transition: none;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .theme-dark .site-header {
    background: var(--dk-bg);
  }
}

@media (forced-colors: active) {
  .theme-dark .button,
  .theme-dark .project-filter button {
    border: 0.125rem solid ButtonText;
  }

  .theme-dark .page-header::after {
    display: none;
  }
}
