/* Original reading colours are explicit fallbacks; the default palette is unchanged. */
:root {
  --text-strong-rgb: 255 255 255;
  --text-reading-rgb: 241 243 249;
  --text-soft-rgb: 226 232 240;
  --text-muted-rgb: 203 213 225;
  --text-subtle-rgb: 148 163 184;
}
.appearance-moon { display: none; }
[data-appearance="light"] .appearance-sun { display: none; }
[data-appearance="light"] .appearance-moon { display: block; }
.appearance-control:disabled { opacity: 0.5; cursor: not-allowed; }
.appearance-control[aria-pressed="true"] { box-shadow: 0 0 0 2px rgb(var(--accent-primary-rgb) / 0.18), 0 0 14px rgb(var(--accent-secondary-rgb) / 0.25); }
@media (min-width: 640px) and (max-width: 1099px) {
  .header-brand > a { max-width: 10rem; }
}
/* Keep the existing 80px header: name above the four controls on small phones. */
@media (max-width: 639px) {
  header .header-brand { display: grid; grid-template-columns: repeat(4, 32px); column-gap: 8px; row-gap: 2px; }
  .header-brand > a { grid-column: 1 / -1; max-width: 7rem; }
  .header-brand .text-headline-sm { font-size: 1rem; }
}
/* Keep the fourth circular control clear of the CTA on narrow phones. */
@media (max-width: 359px) {
  header .header-actions { align-self: flex-start; margin-top: 6px; }
}
@media (prefers-reduced-motion: no-preference) {
  .appearance-transition :is(body, header, main, section, footer, a, button, input, textarea, .neon-border-box, #theme-menu) {
    transition: background-color 220ms ease, color 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
  }
}

/* Light mode: ink accents on pearl surfaces, with subtle palette-tinted atmosphere. */
:root[data-appearance="light"]:not([data-developer="on"]) {
  color-scheme: light;
  --text-strong-rgb: 19 29 48;
  --text-reading-rgb: 31 43 60;
  --text-soft-rgb: 43 56 75;
  --text-muted-rgb: 57 70 88;
  --text-subtle-rgb: 74 87 105;
  --canvas-rgb: 247 249 252;
  --surface-low-rgb: 255 255 255;
  --surface-card-rgb: 253 254 255;
  --surface-raised-rgb: 243 246 251;
  --surface-photo-top-rgb: 246 248 252;
  --surface-photo-bottom-rgb: 235 240 247;
  --surface-photo-end-rgb: 232 238 247;
  --surface-secondary-ink-rgb: 255 255 255;
  --surface-highest-rgb: 220 229 240;
  --surface-variant-rgb: 231 237 246;
  --surface-bright-rgb: 255 255 255;
  --surface-container-rgb: 238 243 249;
  --surface-high-rgb: 229 236 245;
  --border-muted-rgb: 163 176 193;
  --border-strong-rgb: 123 141 163;
  --ink-rgb: 255 255 255;
  --primary-ink-rgb: 255 255 255;
  --primary-fixed-ink-rgb: 255 255 255;
  --primary-container-ink-rgb: 255 255 255;
  --accent-primary-glow-rgb: var(--accent-primary-rgb);
  --accent-bridge-rgb: var(--accent-primary-rgb);
  --accent-hover-rgb: var(--accent-secondary-rgb);
  --accent-secondary-soft-rgb: var(--accent-secondary-rgb);
  --accent-tertiary-soft-rgb: var(--accent-tertiary-rgb);
  --accent-pale-primary-rgb: var(--accent-primary-rgb);
  --accent-pale-secondary-rgb: var(--accent-secondary-rgb);
  --accent-pale-tertiary-rgb: var(--accent-tertiary-rgb);
  --accent-mist-rgb: var(--accent-secondary-rgb);
}
:root[data-appearance="light"][data-theme="original"]:not([data-developer="on"]) {
  --accent-primary-rgb: 0 100 110;
  --accent-primary-legacy-rgb: 0, 100, 110;
  --accent-secondary-rgb: 108 55 158;
  --accent-secondary-legacy-rgb: 108, 55, 158;
  --accent-tertiary-rgb: 165 37 72;
  --accent-tertiary-legacy-rgb: 165, 37, 72;
  --accent-warm-rgb: 155 72 0;
  --accent-warm-legacy-rgb: 155, 72, 0;
  --accent-primary-glow-legacy-rgb: 0, 100, 110;
}

:root[data-appearance="light"][data-theme="orange"]:not([data-developer="on"]) {
  --accent-primary-rgb: 146 68 0;
  --accent-primary-legacy-rgb: 146, 68, 0;
  --accent-secondary-rgb: 150 58 7;
  --accent-secondary-legacy-rgb: 150, 58, 7;
  --accent-tertiary-rgb: 145 51 36;
  --accent-tertiary-legacy-rgb: 145, 51, 36;
  --accent-warm-rgb: 130 68 22;
  --accent-warm-legacy-rgb: 130, 68, 22;
  --accent-primary-glow-legacy-rgb: 146, 68, 0;
}

:root[data-appearance="light"][data-theme="red"]:not([data-developer="on"]) {
  --accent-primary-rgb: 166 34 57;
  --accent-primary-legacy-rgb: 166, 34, 57;
  --accent-secondary-rgb: 149 35 71;
  --accent-secondary-legacy-rgb: 149, 35, 71;
  --accent-tertiary-rgb: 149 54 31;
  --accent-tertiary-legacy-rgb: 149, 54, 31;
  --accent-warm-rgb: 156 48 56;
  --accent-warm-legacy-rgb: 156, 48, 56;
  --accent-primary-glow-legacy-rgb: 166, 34, 57;
}

:root[data-appearance="light"][data-theme="blue"]:not([data-developer="on"]) {
  --accent-primary-rgb: 17 89 152;
  --accent-primary-legacy-rgb: 17, 89, 152;
  --accent-secondary-rgb: 61 72 157;
  --accent-secondary-legacy-rgb: 61, 72, 157;
  --accent-tertiary-rgb: 0 98 120;
  --accent-tertiary-legacy-rgb: 0, 98, 120;
  --accent-warm-rgb: 40 81 143;
  --accent-warm-legacy-rgb: 40, 81, 143;
  --accent-primary-glow-legacy-rgb: 17, 89, 152;
}

:root[data-appearance="light"][data-theme="pink-purple"]:not([data-developer="on"]) {
  --accent-primary-rgb: 146 37 105;
  --accent-primary-legacy-rgb: 146, 37, 105;
  --accent-secondary-rgb: 104 50 156;
  --accent-secondary-legacy-rgb: 104, 50, 156;
  --accent-tertiary-rgb: 152 36 93;
  --accent-tertiary-legacy-rgb: 152, 36, 93;
  --accent-warm-rgb: 105 57 130;
  --accent-warm-legacy-rgb: 105, 57, 130;
  --accent-primary-glow-legacy-rgb: 146, 37, 105;
}

:root[data-appearance="light"][data-theme="green"]:not([data-developer="on"]) {
  --accent-primary-rgb: 17 98 60;
  --accent-primary-legacy-rgb: 17, 98, 60;
  --accent-secondary-rgb: 9 95 76;
  --accent-secondary-legacy-rgb: 9, 95, 76;
  --accent-tertiary-rgb: 67 93 24;
  --accent-tertiary-legacy-rgb: 67, 93, 24;
  --accent-warm-rgb: 57 99 37;
  --accent-warm-legacy-rgb: 57, 99, 37;
  --accent-primary-glow-legacy-rgb: 17, 98, 60;
}

:root[data-appearance="light"]:not([data-developer="on"]) ::selection { color: white; }
:root[data-appearance="light"]:not([data-developer="on"]) :is(.blur-\[150px\], .blur-\[160px\], .blur-\[130px\], [class*="blur-["]) { opacity: 0.18; }
:root[data-appearance="light"]:not([data-developer="on"]) .text-gradient-aurora { filter: none; }
:root[data-appearance="light"]:not([data-developer="on"]) :is(.hero-photo-card, .neon-border-box, #contact .lg\:col-span-7) {
  box-shadow: 0 8px 28px rgb(26 45 70 / 0.07), 0 0 20px rgb(var(--accent-secondary-rgb) / 0.04);
}
:root[data-appearance="light"]:not([data-developer="on"]) :is(input, textarea) { box-shadow: inset 0 1px 3px rgb(26 45 70 / 0.06); }
:root[data-appearance="light"]:not([data-developer="on"]) .neon-btn-gradient { box-shadow: 0 4px 16px rgb(var(--accent-primary-rgb) / 0.18); }
:root[data-appearance="light"]:not([data-developer="on"]) .neon-btn-gradient:hover { box-shadow: 0 6px 22px rgb(var(--accent-primary-rgb) / 0.28); }
:root[data-appearance="light"]:not([data-developer="on"]) .neon-border-box:hover { box-shadow: 0 8px 28px rgb(var(--accent-primary-rgb) / 0.16); }
:root[data-appearance="light"]:not([data-developer="on"]) #theme-menu { box-shadow: 0 8px 24px rgb(26 45 70 / 0.15); }

/* Developer Mode is an independent, temporary layer. Images never receive effects. */
.developer-decoration, .developer-boot { display: none; }
#developer-status:empty { display: none; }
:root[data-developer="on"] {
  color-scheme: dark;
  --text-strong-rgb: 218 255 231;
  --text-reading-rgb: 199 224 207;
  --text-soft-rgb: 182 215 194;
  --text-muted-rgb: 164 199 177;
  --text-subtle-rgb: 143 180 155;
  --canvas-rgb: 5 12 9;
  --surface-low-rgb: 8 19 13;
  --surface-card-rgb: 9 23 15;
  --surface-raised-rgb: 10 25 17;
  --surface-photo-top-rgb: 10 25 17;
  --surface-photo-bottom-rgb: 6 16 10;
  --surface-photo-end-rgb: 13 31 21;
  --surface-secondary-ink-rgb: 3 12 7;
  --surface-highest-rgb: 22 48 31;
  --surface-variant-rgb: 16 37 24;
  --surface-bright-rgb: 30 61 40;
  --surface-container-rgb: 12 29 19;
  --surface-high-rgb: 18 41 27;
  --border-muted-rgb: 48 88 60;
  --border-strong-rgb: 69 117 82;
  --ink-rgb: 3 12 7;
  --accent-primary-rgb: 97 255 150;
  --accent-secondary-rgb: 84 221 155;
  --accent-tertiary-rgb: 181 239 130;
  --accent-warm-rgb: 132 217 112;
  --accent-primary-glow-rgb: 115 255 167;
  --accent-bridge-rgb: 85 237 159;
  --accent-hover-rgb: 166 255 194;
  --accent-secondary-soft-rgb: 153 240 189;
  --accent-tertiary-soft-rgb: 207 246 173;
  --accent-pale-primary-rgb: 190 255 213;
  --accent-pale-secondary-rgb: 178 242 205;
  --accent-pale-tertiary-rgb: 223 255 195;
  --accent-mist-rgb: 207 255 225;
  --accent-primary-legacy-rgb: 97, 255, 150;
  --accent-primary-glow-legacy-rgb: 115, 255, 167;
  --accent-secondary-legacy-rgb: 84, 221, 155;
  --accent-tertiary-legacy-rgb: 181, 239, 130;
  --accent-warm-legacy-rgb: 132, 217, 112;
}
:root[data-developer="on"] :where(body, body *):not(.material-symbols-outlined) {
  font-family: 'JetBrains Mono', monospace !important;
}
:root[data-developer="on"] ::selection { color: rgb(var(--ink-rgb)); }
:root[data-developer="on"] main section {
  background-image: linear-gradient(rgb(97 255 150 / 0.025) 1px, transparent 1px), linear-gradient(90deg, rgb(97 255 150 / 0.025) 1px, transparent 1px), repeating-linear-gradient(0deg, transparent 0 3px, rgb(97 255 150 / 0.015) 3px 4px);
  background-size: 40px 40px, 40px 40px, 100% 4px;
}
:root[data-developer="on"] [class*="blur-["] { opacity: 0.12; }
:root[data-developer="on"] :is(.neon-border-box, .hero-photo-card, input, textarea, #theme-menu) {
  border-radius: 0;
  border-color: rgb(var(--accent-primary-rgb) / 0.4);
  box-shadow: 0 0 0 1px rgb(var(--accent-primary-rgb) / 0.06);
}
:root[data-developer="on"] .neon-border-box { border-style: dashed; }
:root[data-developer="on"] .neon-border-box:hover { border-style: solid; box-shadow: 0 0 24px rgb(var(--accent-primary-rgb) / 0.12); }
:root[data-developer="on"] .neon-btn-gradient {
  color: rgb(var(--accent-primary-rgb)) !important;
  background: linear-gradient(135deg, #102b1b, #08170f);
  box-shadow: inset 0 0 0 1px rgb(var(--accent-primary-rgb) / 0.7), 0 0 14px rgb(var(--accent-primary-rgb) / 0.1);
}
:root[data-developer="on"] .neon-btn-gradient:hover {
  background: #183b26;
  box-shadow: inset 0 0 0 1px rgb(var(--accent-primary-rgb)), 0 0 24px rgb(var(--accent-primary-rgb) / 0.18);
}
:root[data-developer="on"] :is(.hero-copy h1, #about h2, #contact h2) { position: relative; }
:root[data-developer="on"] .developer-decoration {
  display: block; position: absolute; pointer-events: none;
  font-size: 10px; line-height: 1.8; font-weight: 400; letter-spacing: 0.04em;
  color: rgb(var(--text-subtle-rgb));
  -webkit-text-fill-color: rgb(var(--text-subtle-rgb));
  text-transform: none;
}
.developer-section-label { top: 12px; right: max(24px, calc((100% - 1152px) / 2)); }
.developer-section-label::before { content: '</> '; color: rgb(var(--accent-primary-rgb)); }
.developer-lines { top: 4px; left: -22px; white-space: pre; }
:root[data-developer="on"] .hero-copy h1::after {
  content: '_'; color: rgb(var(--accent-primary-rgb)); animation: terminal-cursor 1.8s ease-in-out infinite;
}
:root[data-developer="on"] #developer-status {
  position: fixed; bottom: 12px; right: 12px; z-index: 55; pointer-events: none;
  padding: 7px 10px; border: 1px solid rgb(var(--accent-primary-rgb) / 0.45);
  color: rgb(var(--accent-primary-rgb)); background: rgb(var(--canvas-rgb) / 0.96);
  font-size: 10px; line-height: 1.5; letter-spacing: 0.05em;
}
#developer-status:not(:empty)::before { content: '● '; }
:root[data-developer="on"] .developer-boot {
  display: block; position: fixed; top: calc(var(--header-height) + 12px); right: 16px; z-index: 55;
  max-width: calc(100vw - 32px); padding: 12px 16px; pointer-events: none;
  border: 1px solid rgb(var(--accent-primary-rgb) / 0.6);
  background: #08130df5; color: rgb(var(--accent-primary-rgb));
  font-size: 11px; line-height: 1.8; white-space: pre-wrap;
  box-shadow: 0 8px 30px #0005; animation: terminal-boot 1.4s ease both;
}
@keyframes terminal-boot {
  0% { opacity: 0; transform: translateY(-6px); }
  15%, 80% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-3px); }
}
@keyframes terminal-cursor { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  :root[data-developer="on"] .developer-boot { display: none; }
  :root[data-developer="on"] .hero-copy h1::after { animation: none; }
}
