@import url("./tokens.css");

/*
  Dark theme (file-swappable).
  Note: selectors intentionally target body.theme-light because theme switching is done by swapping
  this CSS file, not by changing body classes.
*/

body.theme-light {
  /* Invert core surfaces + text */
  --color-surface-primary: #141414;
  --color-surface-secondary: #141414;
  --color-text-primary: #ffffff;
  --color-text-secondary: rgba(255, 255, 255, 0.72);

  /* Borders and hover surfaces */
  --color-border-subtle: rgba(255, 255, 255, 0.18);
  --color-hover-surface: rgba(255, 255, 255, 0.08);

  /* Accent defaults (can be overridden by sub-theme files) */
  --color-accent: #ffffff;
  --color-focus-ring: #ffffff;

  /* Button + chip tokens (sub-theme friendly) */
  --color-button-bg: transparent;
  --color-button-text: #ffffff;
  --color-button-border: #ffffff;
  --color-button-hover-bg: rgba(255, 255, 255, 0.08);
  --color-button-hover-text: #ffffff;
  --color-button-hover-border: #ffffff;
  --color-chip-active-bg: #ffffff;
  --color-chip-active-text: #121212;

  background-color: var(--color-surface-primary);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-weight: 400;
}

body.theme-light h1,
body.theme-light h2,
body.theme-light h3,
body.theme-light h4,
body.theme-light h5,
body.theme-light h6 {
  font-family: var(--font-heading);
  color: var(--color-text-primary);
  font-weight: 600;
}

body.theme-light h1 {
  font-weight: 700;
}

body.theme-light h1.fw-semibold {
  font-weight: 700 !important;
}

/* Bootstrap utilities: force muted text to follow dark tokens */
body.theme-light .text-muted {
  color: var(--color-text-secondary) !important;
}

/* Text links */
body.theme-light .text-block a:not([class*="btn"]),
body.theme-light .text-link {
  font-family: var(--font-heading);
  font-weight: 400;
  color: var(--color-text-primary);
  text-decoration: underline;
}

body.theme-light .text-block a:not([class*="btn"]):hover,
body.theme-light .text-block a:not([class*="btn"]):active,
body.theme-light .text-block a:not([class*="btn"]):focus-visible,
body.theme-light .text-link:hover,
body.theme-light .text-link:active,
body.theme-light .text-link:focus-visible {
  color: var(--color-text-primary);
  text-decoration: none;
}

body.theme-light .text-block a:not([class*="btn"]):focus-visible,
body.theme-light .text-link:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

body.theme-light .text-block a.text-decoration-none {
  text-decoration: underline !important;
}

body.theme-light .text-block a.text-decoration-none:hover,
body.theme-light .text-block a.text-decoration-none:focus-visible {
  text-decoration: none !important;
}

body.theme-light .project-detail-read-more-btn {
  font-family: var(--font-heading);
  font-weight: 400;
  color: var(--color-text-primary);
}

body.theme-light .project-detail-read-more-btn .project-detail-read-more-label {
  text-decoration: underline;
}

body.theme-light .project-detail-read-more-btn:hover .project-detail-read-more-label,
body.theme-light .project-detail-read-more-btn:focus-visible .project-detail-read-more-label {
  text-decoration: none !important;
}

/* Project detail: "Read more" expandable section */
.project-detail-more.is-closed {
  display: none;
}

.project-detail-more:not(.is-closed) {
  display: block;
}

/* Toggle icon: + for read more, − for show less */
.project-detail-read-more-btn .project-detail-read-more-label::before {
  content: "+ ";
}

.project-detail-read-more-btn.is-expanded .project-detail-read-more-label::before {
  content: "− ";
}

/* Links inside headings */
body.theme-light .text-block h1 a:not([class*="btn"]),
body.theme-light .text-block h2 a:not([class*="btn"]),
body.theme-light .text-block h3 a:not([class*="btn"]),
body.theme-light .text-block h4 a:not([class*="btn"]),
body.theme-light .text-block h5 a:not([class*="btn"]),
body.theme-light .text-block h6 a:not([class*="btn"]) {
  font-family: inherit;
  font-weight: inherit;
  text-decoration: none !important;
}

body.theme-light .text-block h1 a:not([class*="btn"]):hover,
body.theme-light .text-block h2 a:not([class*="btn"]):hover,
body.theme-light .text-block h3 a:not([class*="btn"]):hover,
body.theme-light .text-block h4 a:not([class*="btn"]):hover,
body.theme-light .text-block h5 a:not([class*="btn"]):hover,
body.theme-light .text-block h6 a:not([class*="btn"]):hover,
body.theme-light .text-block h1 a:not([class*="btn"]):focus-visible,
body.theme-light .text-block h2 a:not([class*="btn"]):focus-visible,
body.theme-light .text-block h3 a:not([class*="btn"]):focus-visible,
body.theme-light .text-block h4 a:not([class*="btn"]):focus-visible,
body.theme-light .text-block h5 a:not([class*="btn"]):focus-visible,
body.theme-light .text-block h6 a:not([class*="btn"]):focus-visible {
  text-decoration: none !important;
}

/* Buttons */
body.theme-light .btn {
  font-family: var(--font-heading);
  font-weight: 400;
}

body.theme-light .btn-primary,
body.theme-light .btn-outline-secondary:not(.projects-filter-chip) {
  color: var(--color-button-text);
  background-color: var(--color-button-bg);
  border-color: var(--color-button-border);
  border-radius: 24px;
}

body.theme-light .btn-primary:hover,
body.theme-light .btn-primary:active,
body.theme-light .btn-outline-secondary:not(.projects-filter-chip):hover,
body.theme-light .btn-outline-secondary:not(.projects-filter-chip):active {
  color: var(--color-button-hover-text);
  background-color: var(--color-button-hover-bg);
  border-color: var(--color-button-hover-border);
  border-radius: 8px;
}

body.theme-light .btn-primary:focus-visible,
body.theme-light .btn-outline-secondary:not(.projects-filter-chip):focus-visible {
  color: var(--color-button-hover-text);
  background-color: var(--color-button-hover-bg);
  border-color: var(--color-button-hover-border);
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

/* Filter chips */
body.theme-light .projects-filter-chip {
  font-family: var(--font-heading);
  font-weight: 400;
  color: var(--color-button-text);
  background-color: var(--color-button-bg);
  border-color: var(--color-button-border);
  border-radius: 24px;
}

body.theme-light .projects-filter-chip:hover {
  color: var(--color-button-hover-text);
  background-color: var(--color-button-hover-bg);
  border-color: var(--color-button-hover-border);
  border-radius: 8px;
}

body.theme-light .projects-filter-chip.active {
  color: var(--color-chip-active-text);
  background-color: var(--color-chip-active-bg);
  border-color: var(--color-chip-active-bg);
}

body.theme-light .projects-filter-chip:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

body.theme-light .projects-filter-chip.active:focus-visible {
  color: var(--color-chip-active-text);
  background-color: var(--color-chip-active-bg);
  border-color: var(--color-chip-active-bg);
}

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

/* Media placeholders: dark surfaces */
.media-placeholder {
  background-color: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.35);
  overflow: hidden;
  position: relative;
}

.media-placeholder--square {
  aspect-ratio: 1 / 1;
  min-height: 0;
}

.media-placeholder.hero-media {
  min-height: 280px;
}

.media-placeholder img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-list-item .media-placeholder {
  overflow: hidden;
}

/* Hero/section slabs: keep existing behaviour */
.hero-media-slab--hero {
  aspect-ratio: 3 / 1;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.hero-media-slab--hero .media-placeholder,
.hero-media-slab--hero img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

.hero-media-slab--section {
  aspect-ratio: 2400 / 1475;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.hero-media-slab--section .media-placeholder,
.hero-media-slab--section img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

/* Header/footer: keep as-is (forced black backgrounds already) */
.site-header .navbar.bg-black {
  background-color: #000000 !important;
}

.navbar-dark .navbar-nav .nav-link {
  color: #f9fafb;
  font-family: var(--font-heading);
  font-weight: 500;
}

.navbar-dark .navbar-nav .nav-link.active {
  color: #ffffff;
  border-bottom: 2px solid #ffffff;
}

.site-footer {
  background-color: var(--color-surface-footer);
  color: #f9fafb;
}

body.theme-light .site-footer h1,
body.theme-light .site-footer h2,
body.theme-light .site-footer h3,
body.theme-light .site-footer h4,
body.theme-light .site-footer h5,
body.theme-light .site-footer h6 {
  color: #ffffff;
}

.footer-link {
  color: inherit;
  text-decoration: underline;
  font-family: var(--font-heading);
  font-weight: 400;
}

.footer-link:hover,
.footer-link:focus-visible {
  text-decoration: none;
}

/* Ensure HRs render white (including footer <hr class="border-secondary">) */
hr,
hr.border-secondary {
  opacity: 1;
  border-color: #ffffff !important;
}

/* Project detail: keep the details box dark (already matches design) */
.project-details-box {
  background-color: var(--color-surface-footer);
  color: #f9fafb;
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  max-width: var(--content-max-width);
}

.project-details-box h3,
.project-details-box .h5 {
  color: #ffffff;
  font-family: var(--font-heading);
}

.project-details-dl {
  display: grid;
  gap: 0.5rem 1rem;
}

.project-details-dl dt {
  font-weight: 600;
  margin: 0;
  color: rgba(249, 250, 251, 0.9);
}

.project-details-dl dd {
  margin: 0;
  color: #f9fafb;
}

@media (min-width: 576px) {
  .project-details-dl {
    grid-template-columns: auto 1fr;
  }

  .project-details-dl dt {
    grid-column: 1;
  }

  .project-details-dl dd {
    grid-column: 2;
  }
}

/* Prev/Next: bold only the label + chevron */
body.theme-light .prev-next-nav .prev-next-label,
body.theme-light .prev-next-nav .prev-next-chevron {
  font-weight: 600;
}

/* ---- Profile accordions (match light-theme behaviour, but with dark text) ---- */
body.theme-light .profile-accordion .accordion-item,
body.theme-light .profile-accordion .accordion-item:first-child,
body.theme-light .profile-accordion .accordion-item:last-child,
body.theme-light .profile-accordion .accordion-item:first-child .accordion-button,
body.theme-light .profile-accordion .accordion-item:last-child .accordion-button {
  border-radius: 0 !important;
}

body.theme-light .profile-accordion .accordion-item {
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  background-color: transparent;
}

body.theme-light .profile-accordion .accordion-item:last-child {
  border-bottom: 1px solid var(--color-border-subtle);
}

body.theme-light .profile-accordion .accordion-button {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  background-color: transparent;
  padding: 1rem 4px;
  border-radius: 0 !important;
  box-shadow: none !important;
  width: 100%;
  overflow: hidden;
}

body.theme-light .profile-accordion .accordion-button:hover,
body.theme-light .profile-accordion .accordion-button:focus,
body.theme-light .profile-accordion .accordion-button:not(.collapsed) {
  color: var(--color-text-primary);
  background-color: transparent;
  box-shadow: none !important;
}

body.theme-light .profile-accordion .accordion-button::after {
  content: "+";
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1;
  background-image: none !important;
  width: auto;
  height: auto;
  flex-shrink: 0;
  margin-left: auto;
  transform: none !important;
}

body.theme-light .profile-accordion .accordion-button:not(.collapsed)::after {
  content: "−";
  transform: none !important;
}

body.theme-light .profile-accordion .accordion-button:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

body.theme-light .profile-accordion .accordion-body {
  padding: 0 4px 1rem;
  font-family: var(--font-body);
  color: var(--color-text-primary);
}

