

/* Controls */
.theme-control { position: relative; display: inline-flex; align-items: center; flex: 0 0 auto; margin-left: -12px; }
.theme-toggle {
  display: inline-grid; place-items: center;
  appearance: none; width: 34px; height: 34px; padding: 5px;
  border: 1px solid transparent; border-radius: 50%;
  color: var(--secondary); background: transparent; cursor: pointer;
  transition: color .22s ease, border-color .22s ease, background-color .22s ease;
}
.theme-toggle:hover, .theme-toggle[aria-expanded="true"] { color: var(--accent-ink); border-color: var(--accent); }
.theme-toggle:focus-visible, .theme-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-icon { display: block; width: 18px; height: 18px; }
.theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: block; }
.theme-menu {
  position: absolute; z-index: 400; top: calc(100% + 10px); right: 0;
  width: 175px; padding: 7px;
  background: var(--surface-light); color: var(--text);
  border: 1px solid var(--theme-rule, #D8D2C8);
  box-shadow: 0 18px 44px rgba(24,22,19,.19);
}
.theme-menu[hidden] { display: none !important; }
.theme-choice {
  width: 100%; min-height: 37px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 9px 10px; border: 0; background: transparent;
  color: var(--text); font: 600 11px/1.3 var(--font-ui); letter-spacing: .035em;
  text-align: left; cursor: pointer;
}
.theme-choice:hover, .theme-choice.is-active { background: var(--sage-background); }
.theme-choice-check { color: var(--accent); opacity: 0; }
.theme-choice.is-active .theme-choice-check { opacity: 1; }


.about-page-signature .signature-night { display: none; }
html[data-theme="dark"] .about-page-signature .signature-day { display: none; }
html[data-theme="dark"] .about-page-signature .signature-night { display: block; }

html[data-theme="dark"] .about-page-signature .signature-night { opacity: .74; }

@media (max-width: 780px) {
  .home-header-actions { column-gap: 12px; }
  .theme-control { margin-left: -8px; }
}
@media (max-width: 480px) {
  .home-header-actions { align-items: center; column-gap: 7px; }
  .theme-control { margin-left: -6px; }
  .theme-toggle { width: 29px; height: 29px; padding: 4px; }
  .theme-icon { width: 17px; height: 17px; }
}
@media (max-width: 360px) {
  .home-header-actions .site-nav { gap: 7px; }
  .home-header-actions { gap: 4px; }
  .theme-control { margin-left: -7px; }
  .theme-toggle { width: 25px; height: 27px; padding: 3px; }
  .theme-icon { width: 15px; height: 15px; }
}

/* Color scheme */
html[data-theme="light"] { color-scheme: only light; }

/* Dark mode */
html[data-theme="dark"] {
  color-scheme: dark;
  --background: #211F1C;
  --surface-light: #292622;
  --sage-background: #2B302A;
  --text: #F0EAE0;
  --accent: #D49B7B;
  --secondary: #C4B8AB;
  --accent-ink: #E0AC8C;
  --body-muted: #D0C4B7;
  --viewer-border: #51483E;
  --viewer-scrollbar: #76675B;
  --viewer-body: #D0C4B7;
  --viewer-shadow: 0 24px 90px rgba(0,0,0,.55);
  --theme-rule: #51483E;
  --night-rule: #51483E;
  --night-panel: #302A25;
  --night-panel-sage: #30362F;
  --night-panel-warm: #342B28;
  --night-micro: #C4B8AB;
}
html[data-theme="dark"] body { background: var(--background); }
html[data-theme="dark"] .site-header { border-bottom-color: var(--night-rule); }
html[data-theme="dark"] .language-switch { border-left-color: var(--night-rule); }
html[data-theme="dark"] .hero-categories { color: #BCB1A2; }
html[data-theme="dark"] .hero-art::before { filter: drop-shadow(0 0 24px rgba(211,160,112,.21)); }
html[data-theme="dark"] .work-card figcaption,
html[data-theme="dark"] .work-toolbar,
html[data-theme="dark"] .work-diploma { border-color: var(--night-rule); }
html[data-theme="dark"] .diploma-description,
html[data-theme="dark"] .work-intro-description,
html[data-theme="dark"] .lightbox-description,
html[data-theme="dark"] .lightbox-footer p { color: var(--body-muted); }
html[data-theme="dark"] .diploma-visual {
  background: radial-gradient(ellipse at center, rgba(145,120,99,.18) 0%, transparent 70%);
}
html[data-theme="dark"] .diploma-book { box-shadow: 3px 3px 0 #40362F, 8px 8px 0 #55483B, 20px 28px 40px rgba(0,0,0,.48); }
html[data-theme="dark"] .work-image { background: #F5F2EA; } 
html[data-theme="dark"] .footer-layout { border-top-color: #505747; }
html[data-theme="dark"] .site-footer p,
html[data-theme="dark"] .site-footer a { color: #B5C0AE; }
html[data-theme="dark"] .site-footer a:hover { color: var(--accent); }
html[data-theme="dark"] .lightbox-nav { border-color: var(--night-rule); background: #2B2723; }
html[data-theme="dark"] .lightbox-nav:hover { border-color: var(--accent); }

/* About */
html[data-theme="dark"] .about-page {
  --about-rule: #51483E;
}
html[data-theme="dark"] .about-page .about-identity-label { color: #A9B99D; }
html[data-theme="dark"] .about-ambient-line--sage { stroke: rgba(160,189,145,.45); }
html[data-theme="dark"] .about-ambient-line--clay { stroke: rgba(212,155,123,.33); }
html[data-theme="dark"] .about-ambient-line--fine { stroke: rgba(160,189,145,.30); }
html[data-theme="dark"] .about-ambient-point--b,
html[data-theme="dark"] .about-ambient-point--c { fill: #B1C4A7; }
html[data-theme="dark"] .about-page-statement-content p,
html[data-theme="dark"] .about-page-specialty p,
html[data-theme="dark"] .about-page-fact p { color: var(--body-muted); }
html[data-theme="dark"] .about-page-specialties {
  background: linear-gradient(180deg, var(--background), #292723 24%, #292723 78%, var(--background));
}
html[data-theme="dark"] .about-page-specialty { background: var(--night-panel); }
html[data-theme="dark"] .about-page-specialty:nth-child(2) { background: var(--night-panel-sage); }
html[data-theme="dark"] .about-page-specialty:nth-child(3) { background: var(--night-panel-warm); }
html[data-theme="dark"] .about-page-specialty:hover { background: #3A322C; }
html[data-theme="dark"] .about-page-background,
html[data-theme="dark"] .about-page-fact { border-color: var(--about-rule); }

html[data-theme="dark"] .about-page-fact {
  background: var(--night-panel);
  border-top-color: var(--about-rule);
}
html[data-theme="dark"] .about-page-fact:nth-child(2) { background: var(--night-panel-sage); }
html[data-theme="dark"] .about-page-fact:nth-child(3) { background: var(--night-panel-warm); }
html[data-theme="dark"] .about-page-fact .about-page-fact-detail {
  color: var(--body-muted);
}
html[data-theme="dark"] .about-page-fact-label,
html[data-theme="dark"] .about-page-next-actions small { color: var(--secondary); }

/* Contact */
html[data-theme="dark"] .contact-page { --contact-rule: #51483E; --contact-sage: #A6B89E; }
html[data-theme="dark"] .contact-intro-label { color: #B1C4A7; }
html[data-theme="dark"] .contact-intro-description,
html[data-theme="dark"] .contact-channel-description,
html[data-theme="dark"] .contact-route-note { color: var(--body-muted); }
html[data-theme="dark"] .contact-status,
html[data-theme="dark"] .contact-copy,
html[data-theme="dark"] .contact-note,
html[data-theme="dark"] .contact-route-index { color: var(--secondary); }
html[data-theme="dark"] .contact-feedback { color: #ADC4A0; }
html[data-theme="dark"] .contact-stroke--sage { stroke: rgba(169,194,154,.53); }
html[data-theme="dark"] .contact-stroke--clay { stroke: rgba(212,155,123,.51); }
html[data-theme="dark"] .contact-orbit--two { fill: #A8B99E; }
html[data-theme="dark"] .contact-continue {
  background: linear-gradient(125deg,#2B302A 0%,#292D29 55%,#302A26 100%);
}
html[data-theme="dark"] .contact-route {
  background: rgba(48,54,47,.94); border-color: rgba(165,184,150,.32);
}
html[data-theme="dark"] .contact-route--about { background: rgba(57,43,38,.90); }
html[data-theme="dark"] .contact-route:hover,
html[data-theme="dark"] .contact-route:focus-visible { background: #3A332C; border-color: var(--accent); }
html[data-theme="dark"] .contact-route--about::before { border-color: rgba(169,194,154,.40); }
html[data-theme="dark"] .contact-route::before { border-color: rgba(212,155,123,.28); }
html[data-theme="dark"] .contact-route-action { color: var(--accent-ink); }

/* Diploma */
html[data-theme="dark"] .diploma-page {
  --diploma-rule: #51483E;
  --diploma-paper: #302A25;
  --diploma-body: #D0C4B7;
}
html[data-theme="dark"] .diploma-page figcaption,
html[data-theme="dark"] .diploma-tags,
html[data-theme="dark"] .diploma-swatch small,
html[data-theme="dark"] .diploma-object-facts dt,
html[data-theme="dark"] .diploma-process-note p,
html[data-theme="dark"] .diploma-spread-primary figcaption small,
html[data-theme="dark"] .diploma-lightbox-caption p,
html[data-theme="dark"] .diploma-credit-text p { color: var(--secondary); }
html[data-theme="dark"] .diploma-process-note > span { color: var(--accent-ink); }
html[data-theme="dark"] .diploma-object-facts,
html[data-theme="dark"] .diploma-process-grid article,
html[data-theme="dark"] .diploma-credit-item { border-top-color: var(--diploma-rule); }
html[data-theme="dark"] .diploma-cover-button {
  box-shadow: 4px 4px 0 #493B30, 9px 9px 0 #594637, 22px 26px 40px rgba(0,0,0,.48);
}
html[data-theme="dark"] .diploma-outro {
  background: linear-gradient(125deg,#2B302A 0%,#292D29 56%,#302A26 100%);
}
html[data-theme="dark"] .diploma-outro-card { background: rgba(48,54,47,.94); border-color: rgba(165,184,150,.32); }
html[data-theme="dark"] .diploma-outro-card--contact { background: rgba(57,43,38,.90); }
html[data-theme="dark"] .diploma-outro-card:hover,
html[data-theme="dark"] .diploma-outro-card:focus-visible { background: #3A332C; border-color: var(--accent); }
html[data-theme="dark"] .diploma-outro-card-title,
html[data-theme="dark"] .diploma-credit-text strong { color: var(--text); }
html[data-theme="dark"] .diploma-outro-index,
html[data-theme="dark"] .diploma-outro-card-description { color: var(--body-muted); }
html[data-theme="dark"] .diploma-outro-action { color: var(--accent-ink); }
html[data-theme="dark"] .diploma-lightbox-stage button { border-color: var(--diploma-rule); }


body, .site-header, .site-footer, .work-lightbox, .diploma-lightbox,
.theme-toggle, .theme-menu {
  transition: background-color .24s ease, color .24s ease, border-color .24s ease;
}
@media (prefers-reduced-motion: reduce) {
  body, .site-header, .site-footer, .work-lightbox, .diploma-lightbox,
  .theme-toggle, .theme-menu { transition: none !important; }
}
