/* Armeria — language + theme controls */
.site-header {
  grid-template-columns: 1fr auto auto auto;
}

.site-controls {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  justify-self: end;
  margin-left: 6px;
}

.site-control {
  color: inherit;
  transition: opacity .22s ease, background .22s ease, border-color .22s ease, transform .22s ease;
}

.language-toggle {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 1px;
  border: 0;
  background: transparent;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .11em;
}

.language-toggle .lang-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  opacity: .38;
  transition: opacity .2s ease;
}

.language-toggle .lang-option::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 1px;
  left: 0;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(.45);
  transition: opacity .2s ease, transform .22s ease;
}

.language-toggle .lang-option.is-active {
  opacity: .96;
}

.language-toggle .lang-option.is-active::after {
  opacity: .58;
  transform: scaleX(1);
}

.language-toggle:hover .lang-option {
  opacity: .7;
}

.language-toggle:hover .lang-option.is-active {
  opacity: 1;
}

.language-toggle .lang-divider {
  opacity: .18;
  font-style: normal;
  font-weight: 400;
}

.theme-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(23,48,60,.14);
  border-radius: 50%;
  background: rgba(255,255,255,.28);
}

.theme-toggle:hover {
  background: rgba(23,48,60,.055);
  border-color: rgba(23,48,60,.26);
  transform: translateY(-1px);
}

.theme-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Dark mode — charcoal / Atlantic palette rather than a simple inversion */
html[data-theme="dark"] {
  --paper: #101619;
  --off-white: #151d21;
  --ink: #edf1ef;
  --muted: #91a0a6;
  --line: #2a3439;
  --dark: #294858;
  --warm: #1d2528;
  color-scheme: dark;
  background: #101619;
}

html[data-theme="dark"] body {
  background: #101619;
  color: #edf1ef;
}

html[data-theme="dark"] ::selection {
  background: #dfe6e2;
  color: #13232a;
}

html[data-theme="dark"] .site-header {
  background: rgba(16,22,25,.94);
  color: #edf1ef;
  border-bottom-color: rgba(255,255,255,.07);
  box-shadow: 0 10px 35px rgba(0,0,0,.16);
  backdrop-filter: blur(16px);
}

html[data-theme="dark"] .language-toggle .lang-divider {
  opacity: .2;
}

html[data-theme="dark"] .theme-toggle {
  background: rgba(255,255,255,.025);
  border-color: rgba(255,255,255,.14);
}

html[data-theme="dark"] .theme-toggle:hover {
  background: rgba(255,255,255,.065);
  border-color: rgba(255,255,255,.25);
}

html[data-theme="dark"] .mobile-menu {
  background: #101619;
  color: #edf1ef;
}

html[data-theme="dark"] .intro {
  background: #101619;
}

html[data-theme="dark"] .intro-text {
  color: #a2adb1;
}

html[data-theme="dark"] .stats {
  border-color: #2a3439;
}

html[data-theme="dark"] .apartments,
html[data-theme="dark"] .contact-page,
html[data-theme="dark"] .contact-main {
  background: #151d21;
}

html[data-theme="dark"] .apartments-toolbar,
html[data-theme="dark"] .contact-location {
  border-color: #303b40;
}

html[data-theme="dark"] .filter {
  color: #dce3e1;
}

html[data-theme="dark"] .filter:hover {
  background: rgba(255,255,255,.045);
}

html[data-theme="dark"] .filter.active {
  background: #294858;
  color: #fff;
}

html[data-theme="dark"] .floor-filter select,
html[data-theme="dark"] .floor-filter select option,
html[data-theme="dark"] .contact-field select,
html[data-theme="dark"] .contact-field select option {
  background: #151d21;
  color: #edf1ef;
}

html[data-theme="dark"] .unit-card {
  background: #192226;
  border-color: #2a353a;
  color: #edf1ef;
}

/* Keep architectural imagery on a light neutral surface for readability. */
html[data-theme="dark"] .unit-card-media {
  background: #e9ece8;
  border-color: #dfe4df;
}

html[data-theme="dark"] .unit-card.in-view:hover {
  border-color: #3b4b51;
  box-shadow: 0 20px 48px rgba(0,0,0,.23);
}

html[data-theme="dark"] .unit-card:focus-visible {
  box-shadow: 0 0 0 2px #668697;
}

html[data-theme="dark"] .unit-badge {
  background: rgba(255,255,255,.9);
  color: #17303c;
  border-color: rgba(23,48,60,.08);
}

html[data-theme="dark"] .unit-type-chip {
  background: #243036;
  color: #dce4e2;
  border-color: #35454c;
}

html[data-theme="dark"] .apartments-note,
html[data-theme="dark"] .unit-subtitle,
html[data-theme="dark"] .unit-meta-item,
html[data-theme="dark"] .dialog-spec-row span {
  color: #91a0a6;
}

html[data-theme="dark"] .unit-dialog,
html[data-theme="dark"] .dialog-body,
html[data-theme="dark"] .dialog-info,
html[data-theme="dark"] .unit-gallery,
html[data-theme="dark"] .plan-switcher {
  color: #edf1ef;
}

html[data-theme="dark"] .unit-dialog,
html[data-theme="dark"] .dialog-info,
html[data-theme="dark"] .unit-gallery {
  background: #141c20;
}

html[data-theme="dark"] .unit-dialog::backdrop {
  background: rgba(4,8,10,.78);
}

html[data-theme="dark"] .dialog-media {
  background: #e9ece8;
}

html[data-theme="dark"] .plan-tab {
  color: #9eaaae;
  border-color: #344148;
}

html[data-theme="dark"] .plan-tab.active {
  color: #edf1ef;
  border-color: #78909b;
}

html[data-theme="dark"] .dialog-close {
  background: rgba(16,22,25,.88);
  color: #edf1ef;
  border-color: rgba(255,255,255,.13);
}

html[data-theme="dark"] .image-lightbox {
  background: rgba(5,8,10,.97);
}

html[data-theme="dark"] .final-cta {
  background: #182328;
  color: #edf1ef;
}

html[data-theme="dark"] .final-btn,
html[data-theme="dark"] .hero-btn {
  background: #f1f3ef;
  color: #17303c;
}

html[data-theme="dark"] .final-btn:hover,
html[data-theme="dark"] .hero-btn:hover {
  background: #e3e8e4;
}

html[data-theme="dark"] .contact-card {
  box-shadow: 0 28px 85px rgba(0,0,0,.26);
}

html[data-theme="dark"] .contact-form-wrap {
  background: #192226;
}

html[data-theme="dark"] .contact-field label {
  color: #9ba8ad;
}

html[data-theme="dark"] .contact-field input,
html[data-theme="dark"] .contact-field select,
html[data-theme="dark"] .contact-field textarea {
  color: #edf1ef;
  border-bottom-color: #3a474d;
}

html[data-theme="dark"] .contact-field input:focus,
html[data-theme="dark"] .contact-field select:focus,
html[data-theme="dark"] .contact-field textarea:focus {
  border-color: #78909b;
}

html[data-theme="dark"] .contact-submit {
  background: #294858;
  color: #fff;
}

html[data-theme="dark"] .contact-submit:hover {
  background: #34596b;
}

html[data-theme="dark"] footer {
  border-top-color: rgba(255,255,255,.07);
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr auto auto;
    gap: 14px;
  }

  .site-header > .nav,
  .site-header > .header-cta {
    display: none;
  }

  .site-controls {
    grid-column: 2;
    margin-left: 0;
    gap: 10px;
  }

  .menu-toggle {
    grid-column: 3;
  }
}

@media (max-width: 520px) {
  .site-header {
    gap: 10px;
  }

  .site-controls {
    gap: 8px;
  }

  .language-toggle {
    min-height: 30px;
    gap: 6px;
    font-size: 9px;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
  }
}
