/* Theme control: stays deliberately small and out of the reading flow. */
.theme-picker{position:relative;display:inline-flex;align-items:center}
.theme-trigger{border:1px solid var(--border);background:transparent;color:var(--muted);border-radius:50%;height:33px;width:33px;display:grid;place-items:center;transition:color .2s,border-color .2s}
.theme-trigger:hover,.theme-trigger[aria-expanded="true"]{color:var(--accent);border-color:var(--accent)}
.theme-trigger svg{height:16px;width:16px}
.theme-menu{position:absolute;right:0;bottom:calc(100% + 12px);z-index:30;min-width:180px;border:1px solid var(--border);background:var(--panel);box-shadow:0 15px 42px #0003;border-radius:12px;padding:7px;color:var(--paper)}
.theme-menu[hidden]{display:none}
.theme-menu-title{color:var(--muted);font-size:10px;letter-spacing:.11em;text-transform:uppercase;font-weight:800;padding:8px 11px 6px}
.theme-option{width:100%;display:flex;align-items:center;gap:10px;border:0;background:transparent;color:var(--paper);border-radius:7px;font-size:12px;padding:10px 12px;text-align:left;font-weight:650}
.theme-option:hover,.theme-option[aria-pressed="true"]{background:var(--panel2)}
.theme-option[aria-pressed="true"]:after{content:"✓";color:var(--accent);font-size:13px;margin-left:auto;font-weight:900}
.theme-option-icon{width:19px;text-align:center;color:var(--muted);font-size:16px;font-weight:400}

/* All visitors default to OS preference; explicit user choice overrides it. */
html[data-palette="light"]{
  color-scheme:light;
  --bg:#f6f7f2;
  --panel:#ffffff;
  --panel2:#edf2ea;
  --paper:#1c2820;
  --muted:#536355;
  --subtle:#607369;
  --border:#d7e0d6;
  --accent:#2e6746;
  --accent-dark:#22543a;
  --black:#ffffff;
  --shadow:0 28px 70px rgba(23,46,28,.17)
}
html[data-palette="dark"]{color-scheme:dark}

/* Public page – retain the original design language in daylight. */
html[data-palette="light"] .hero-topline,
html[data-palette="light"] .hero-bio,
html[data-palette="light"] .metric span,
html[data-palette="light"] .scroll-hint,
html[data-palette="light"] .year-marker,
html[data-palette="light"] .year-rail p,
html[data-palette="light"] .card-date,
html[data-palette="light"] .footer{color:#627469}
html[data-palette="light"] .hero-overline{color:var(--accent)}
html[data-palette="light"] .quiet-action{color:#223d2b}
html[data-palette="light"] .age-chip{border-color:#acc9b3;color:var(--accent)}
html[data-palette="light"] .hero-avatar{background:#e7ece5}
html[data-palette="light"] .metric-divider{background:var(--border)}
html[data-palette="light"] .scroll-hint-icon{border-color:#adc4b0}
html[data-palette="light"] .hero-visual-inner{background:#e5ebdf;box-shadow:30px 24px 0 -7px #e1e9db,30px 24px 0 -6px #cedaca}
html[data-palette="light"] .hero-visual-overlay{color:#f3f4ec}
html[data-palette="light"] .hero-visual-overlay .mini-label{color:#c9f47a}
html[data-palette="light"] .post-card{border-color:var(--border);box-shadow:0 5px 24px #1a33260a}
html[data-palette="light"] .post-card:hover{border-color:#a9c7b0;background:#fafffa}
html[data-palette="light"] .card-image-wrap{background:#edf1eb}
html[data-palette="light"] .card-no-image{background:radial-gradient(circle at 50% 35%,#d5e3d3,#edf3eb);color:var(--accent)}
html[data-palette="light"] .card-excerpt{color:#63746b}
html[data-palette="light"] .card-bottom{color:#314b39;border-color:var(--border)}
html[data-palette="light"] .card-image-action{background:#fff;color:#233e2c}
html[data-palette="light"] .image-count{color:#f6f7f2}
html[data-palette="light"] .closing-inner{background:#285e3f;color:#fff}
html[data-palette="light"] .closing-inner:after{color:#36734e}
html[data-palette="light"] .closing-back{border-color:#aac9b1}
html[data-palette="light"] .admin-entry{border-color:var(--border);color:#647568}
html[data-palette="light"] .admin-entry:hover{color:var(--accent);border-color:var(--accent)}
html[data-palette="light"] .detail-dialog{background:#fff;border-color:var(--border)}
html[data-palette="light"] .detail-media{background:#e7eee7}
html[data-palette="light"] .detail-description{color:#405d48}
html[data-palette="light"] .detail-kicker{color:var(--accent)}
html[data-palette="light"] .auth-dialog{background:#fff;border-color:var(--border)}
html[data-palette="light"] .auth-box>p{color:#536a59}
html[data-palette="light"] .auth-box input{background:#f4f7f1;color:#1c2820;border-color:#d0ddd1}
html[data-palette="light"] .auth-box input::placeholder{color:#718475}
html[data-palette="light"] .primary-action{color:#fff}
html[data-palette="light"] .primary-action:hover{background:#22543a}
html[data-palette="light"] .dialog-close:hover{background:#2e6746;color:#fff}

/* The administrator is also dark in night mode; day mode keeps the airy editor. */
html[data-palette="dark"] .admin-dialog{background:#171e19;color:#eef4e9;border-color:#3b4b3f}
html[data-palette="dark"] .admin-top{border-color:#3b4b3f}
html[data-palette="dark"] .admin-top .admin-kicker,
html[data-palette="dark"] .admin-panel-intro p,
html[data-palette="dark"] .form-intro,
html[data-palette="dark"] .field-hint,
html[data-palette="dark"] .admin-list-info span{color:#a7baa9}
html[data-palette="dark"] .admin-top-close{background:#29362b;color:#eef4e9;border-color:#506151}
html[data-palette="dark"] .admin-top-close:hover{background:#3a4d3e}
html[data-palette="dark"] .admin-list-card,
html[data-palette="dark"] .photo-thumb{background:#212c24;border-color:#445748}
html[data-palette="dark"] .admin-list-photo,
html[data-palette="dark"] .photo-thumb img{background:#2b392e}
html[data-palette="dark"] .admin-list-actions button,
html[data-palette="dark"] .secondary-button{background:#2a372e;color:#edf4e9;border-color:#526657}
html[data-palette="dark"] .admin-list-actions button:hover,
html[data-palette="dark"] .secondary-button:hover{background:#344738}
html[data-palette="dark"] .admin-empty{color:#a5b8a6;border-color:#506251}
html[data-palette="dark"] .admin-empty strong{color:#eef4e9}
html[data-palette="dark"] .admin-form label:not(.upload-zone):not(.checkline){color:#e8f2e8}
html[data-palette="dark"] .admin-form input:not([type=file]):not([type=checkbox]),
html[data-palette="dark"] .admin-form textarea{background:#222e26;border-color:#506354;color:#edf5ed}
html[data-palette="dark"] .admin-form input::placeholder,
html[data-palette="dark"] .admin-form textarea::placeholder{color:#91a392}
html[data-palette="dark"] .upload-zone{background:#243429;border-color:#58735d}
html[data-palette="dark"] .upload-zone:hover,
html[data-palette="dark"] .upload-zone.dragover{background:#2c4333}
html[data-palette="dark"] .upload-zone>span:last-of-type,
html[data-palette="dark"] .photo-thumb>span{color:#b4c7b7}
html[data-palette="dark"] .upload-icon{color:#c9f47a}
html[data-palette="dark"] .avatar-section,
html[data-palette="dark"] .form-actions{border-color:#485d4c}
html[data-palette="dark"] .profile-avatar-preview{background:#273b2c}

@media(max-width:540px){.footer-right{gap:9px}}

/* V4: project action contrast in both themes. */
html[data-palette="light"] .project-actions .secondary-button{background:#fff;color:#28523a;border-color:#b4cdb9}
html[data-palette="dark"] .project-actions .secondary-button{background:#273228;color:#e9f2e6;border-color:#596c56}
html[data-palette="dark"] .project-actions .secondary-button:hover{background:#344336}
