/* Metona V3 — the lunisolar instrument. See adoption DESIGN.md.
   design-exception: ELVN 3.1.0-shiny glass is intentional on workspace,
   navigation, dialogs and action surfaces; records retain their own forms.
   Dense controls never blur inside those surfaces. */
:root {
  --elvn-canvas: #1d171c; --elvn-surface: #2c1d28; --elvn-surface-solid: #2c1d28;
  --elvn-surface-raised: #3a2834; --elvn-field: #20171d;
  --elvn-text: #f4e9d7; --elvn-text-secondary: #dccdbc; --elvn-text-muted: #c0aaae;
  --elvn-border: #a88a74; --elvn-border-quiet: #74585c;
  --night: var(--elvn-canvas); --surface: var(--elvn-surface-solid);
  --field: var(--elvn-field); --wash: #3a2834;
  --ink: var(--elvn-text); --ink-2: #dccdbc; --muted: #c0aaae;
  --rule: #74585c66; --rule-strong: #a88a7480;
  --silver: #e1d8cf; --silver-dim: #b6a19f;
  /* Historical variable names are retained for the native renderer. */
  --blue: #e1bf7d; --violet: #cd8eb9; --indigo: #b79da5;
  --warn: var(--elvn-warning); --critical: var(--elvn-danger);
  --action: #e1bf7d; --action-ink: #21161c;
  --zone-peak: #d3aa66; --zone-steady: #bf80ac; --zone-low: #bcb4ad;
  --elvn-accent: #e1bf7d; --elvn-accent-strong: #cba56b;
  --elvn-accent-rgb: 225, 191, 125; --elvn-series-2: #805276; --elvn-series-3: #926b35;
  --elvn-glass-control-fill: rgba(225,191,125,.08);
  --metona-plane: rgba(44,29,40,.70);
  --metona-edge: inset 0 1px 0 #f4e9d766, inset 0 -1px 0 #cba56b26;
  --metona-field-edge: inset 0 1px 3px #0008, 0 1px 0 #f4e9d70b;
  --metona-radius: 12px;
  color-scheme: dark;
}
body { position: relative; isolation: isolate; background: var(--night); }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
body::after { opacity: .28; }

/* Native lettering: crop only the old caption, without editing its pixels. */
.brand, .signin-brand { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; }
.brand { flex: none; min-width: 132px; min-height: 54px; letter-spacing: normal; }
.metona-lettering, .brand .metona-lettering { display: block; width: 132px; height: 19px; overflow: hidden; mix-blend-mode: screen; }
.metona-lettering img, .brand .metona-lettering img { display: block; width: 100%; max-width: none; height: auto; mix-blend-mode: screen; }
.brand > .metona-lower { width: 28px; height: auto; }
.signin-brand { align-self: center; margin-bottom: 28px; gap: 14px; }
.signin-brand .metona-lettering { width: 244px; height: 35px; }
.signin-brand > .metona-lower { width: 44px; height: auto; filter: none; }

/* One schedule plane, a separate navigation index, and a clear command edge. */
.horizon, .sidebar, .stage, .bk-top, .observatory, #authView .threshold-form {
  position: relative; isolation: isolate; background: var(--metona-plane);
  box-shadow: var(--metona-edge);
  -webkit-backdrop-filter: var(--elvn-glass-standard-blur);
  backdrop-filter: var(--elvn-glass-standard-blur);
}
.horizon { background: rgba(32, 18, 26, .58); border-bottom-color: #d7c4a433; }
.sidebar { background: rgba(30, 16, 24, .42); }
.stage { background: rgba(23, 12, 19, .42); box-shadow: inset 0 1px #f4eee40c; }
.stage-head { background: rgba(37, 20, 30, .40); border-bottom-color: var(--rule-strong); }
.horizon::before, .observatory::before, #authView .threshold-form::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
  background: radial-gradient(70% 22px at 20% 0, #f7f3ec30, transparent 90%);
}
.command { min-width: 0; min-height: 48px; border-radius: var(--elvn-radius-control); background: #1b0f1699; border-color: #d6c2a04f; box-shadow: var(--metona-field-edge); }
.command input { min-width: 0; min-height: 46px; box-shadow: none; }
.command-prompt { color: var(--blue); }
.command-read { z-index: 1; border-radius: 0 0 10px 10px; background: var(--surface); box-shadow: 0 12px 24px #0006; }
.feature-trigger, .menu-toggle { border-radius: var(--elvn-radius-control); min-height: 44px; }
.mini-nav button, .period-nav button, .views a { min-height: 44px; min-width: 44px; }
.mini-nav button { border-radius: 6px; }
.views { border-radius: 8px; overflow: hidden; background: #190d1445; }
.views a { color: var(--ink-2); }
.views a.on { background: #dfceb01a; }
.period-nav button:first-child { border-radius: 8px 0 0 8px; }
.period-nav button:last-child { border-radius: 0 8px 8px 0; }
.side-links a { min-height: 44px; }
.side-links a.on { background: #ddcbad12; color: var(--ink); }
.who, .period-sub, .page-lede, .type-desc { color: var(--ink-2); }
.tg-head, .tg-allday { background: #20121ab3; }
.tg-head .tg-day.today { background: #dfceb00b; }
.tg-col { border-color: var(--rule); }
.tj-day { border-color: var(--rule-strong); }
.tj-row { min-height: 50px; }
.type-entry { padding-block: 26px; }
.type-entry.paused { opacity: 1; }
.type-entry.paused .type-main h2 { color: var(--muted); }
.type-main h2 { font-size: 23px; }
.type-main h2::before { color: var(--blue); }
.page-head { padding-bottom: 22px; }
.crosspoints thead, .booking-ledger thead { color: var(--ink-2); }
.bookings-page a { display: inline-flex; align-items: center; min-height: 44px; }
.bookings-page summary { min-height: 44px; padding-block: 12px; cursor: pointer; }

/* Optical wells: native inputs, no SVG shells or blur inside glass. */
input:not([type=checkbox]):not([type=radio]), select, textarea,
#authView #authForm input {
  min-height: var(--elvn-target-min); color: var(--ink); background: #1b0e16d9;
  border: 1px solid #ac709499; border-radius: 8px; box-shadow: var(--metona-field-edge);
  padding: 10px 12px; font: inherit; color-scheme: dark;
}
input::placeholder, textarea::placeholder { color: #cebfa6; opacity: 1; }
#quickInput { min-height: 46px; padding: 0 12px 0 4px; background: transparent; border: 0; box-shadow: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
select option { background: var(--surface); color: var(--ink); }
label > span, legend { color: var(--ink-2); }
.metona-v2-well-frame { margin-inline: 24px; }
.metona-v2-well input { width: 100%; }
.quiet { border-radius: 6px; }
.quiet.small, .quiet.tiny { min-height: 44px; }
.primary, .feature-trigger, .dock-add, .mail-button {
  min-height: 44px; padding-inline: 18px; color: var(--ink);
  background: var(--elvn-glass-control-fill); border: 1px solid #e6d8c166;
  border-radius: var(--elvn-radius-control); box-shadow: var(--metona-edge);
  font-weight: 500; text-shadow: none;
}
.primary { background: rgba(var(--elvn-accent-rgb), .17); }
.primary:hover, .feature-trigger:hover, .mail-button:hover { background: rgba(var(--elvn-accent-rgb), .24); }
.primary:disabled { opacity: .55; }
.primary.danger-fill { background: #a6353659; color: var(--critical); border-color: #ffb9ad80; }
.specular > .sp-halo { opacity: .32; }
.specular { --sp-rim: 1px; }
.segment span { min-height: 44px; }

/* One raised sheet; no second blur on its backdrop or inset fields. */
dialog.sheet, dialog.feature-search {
  position: relative; isolation: isolate; color: var(--ink);
  border: 1px solid #d3be9959; border-radius: var(--elvn-radius-overlay);
  background: rgba(31, 16, 25, .78); box-shadow: var(--metona-edge), var(--elvn-glass-depth);
  -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
}
dialog.sheet::backdrop, dialog.feature-search::backdrop { background: #080507ad; -webkit-backdrop-filter: none; backdrop-filter: none; }
.sheet .sheet-actions { position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--rule-strong); padding-top: 12px; padding-bottom: 12px; }
.sheet input.title-field { padding: 10px 12px; font-size: 22px; }
.strips { background: #1e10184d; border-radius: 6px; }
.feature-search-results { scrollbar-width: thin; }
.feature-result { color: var(--ink); }
.feature-result-hint { color: var(--muted); }
.feature-empty, .metona-load-state, .metona-empty-state { margin: 16px 0; padding: 24px; min-height: 120px; color: var(--ink-2); border-block: 1px solid var(--rule); background: #381e2e33; }
.metona-load-state { display: flex; align-items: center; gap: 16px; margin: 28px; }
.metona-load-ring { width: 28px; height: 28px; border: 2px solid var(--rule-strong); border-top-color: var(--blue); border-radius: 50%; flex: none; animation: metona-v3-load 1s linear infinite; }
.metona-load-error { display: block; }
@keyframes metona-v3-load { to { transform: rotate(360deg); } }
.notice { background: #2b1723e6; box-shadow: var(--metona-edge), 0 16px 40px #0006; border-radius: 14px; backdrop-filter: blur(8px); }
.notice::before, .notice::after { display: none; }
.notice-icon { background: #3f2233; color: #c0f3db; border-color: #9ecfb977; box-shadow: none; }
.notice.error .notice-icon { background: #5c2630; color: var(--critical); box-shadow: none; }

/* Sign-in keeps the shared V3 Google/ELVNverse/email/hold behavior. */
#authView { padding: 40px 20px; }
#authView .threshold-form {
  --elvn-font-body: var(--font-ui); --elvn-text: #faf8f4; --elvn-text-muted: #d8cbb4;
  --elvn-accent: #dfceb0; --elvn-accent-rgb: 225,191,125; --elvn-radius-control: 11px;
  --elvn-field-height: 48px;
  max-width: 560px; padding: 40px; border: 1px solid #dfceb14d; border-radius: 22px; background: #1e101873;
}
#authView h1 { font-size: 31px; }
#authView .lede { font-size: 14px; color: var(--ink-2); line-height: 1.6; }
#authView .signin-brand img { filter: none; }
#authView .mail-button, #authView .hold { background: #efe7d812; border: 1px solid #dfceb066; border-radius: 11px; box-shadow: var(--metona-edge); }
#authView .mail-button { text-decoration: none; }
#authView .hold { min-height: 60px; letter-spacing: .14em; }
#authView #authGoogleNote { line-height: 1.5; margin-top: 18px; color: var(--muted); }
#authView .hold-help { font-size: 12px; }

/* The public observatory remains a three-column booking instrument. */
.bk-top { min-height: 74px; }
.observatory { margin: 32px auto; max-width: 1180px; flex: none; padding: 32px; border: 1px solid #d7c29e3b; border-radius: 16px; }
.bk-host h1 { font-size: 34px; }
.bk-slot { min-height: 48px; padding-inline: 10px; }
.bk-day[aria-pressed=true] { border-color: var(--blue); background: #dbc8a724; border-radius: 6px; }
.bk-type-link { padding-inline: 8px; }
.bk-host, .bk-sky, .bk-times { min-width: 0; }
.bk-manage-line { flex-wrap: wrap; }

@media (max-width: 760px) {
  .brand { min-width: 94px; min-height: 46px; gap: 5px; }
  .brand .metona-lettering { width: 94px; height: 14px; }
  .brand > .metona-lower { width: 24px; }
  .horizon { gap: 8px; }
  .feature-trigger { margin-left: auto; padding-inline: 10px; font-size: 12px; }
  .menu-toggle { margin-left: 0; padding-inline: 12px; font-size: 13px; }
  body[data-mobile-nav] .sidebar { top: calc(66px + env(safe-area-inset-top)); }
  body[data-mobile-surface=glass] .sidebar { background: #281621ed; box-shadow: var(--metona-edge), 0 20px 48px #0009; backdrop-filter: blur(14px); }
  body[data-mobile-surface=solid] :is(.horizon,.stage,.sidebar,.dock) { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .metona-v2-well-frame { margin-inline: 16px; }
  .dock { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); height: auto; padding: 7px; border: 1px solid #e7dbc552; border-radius: 16px; }
  .dock a { border-top: 0; border-radius: 8px; min-height: 48px; font-size: 12px; }
  .dock a.on { background: #e5d7bf20; }
  .dock-add { width: 48px; padding: 0; }
  body[data-mobile-nav=dropdown] .notification-dock { bottom: calc(12px + env(safe-area-inset-bottom)); }
  .quiet.small, .quiet.tiny, .type-actions > *, .bk-manage-actions > * { min-height: 44px; }
  dialog.sheet, dialog.sheet.narrow { position: fixed; inset: auto 0 0; width: 100%; max-width: none; margin: 0; max-height: calc(100dvh - 12px); border-radius: 20px 20px 0 0; border-bottom: 0; }
  dialog.sheet .sheet-actions { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  dialog input:not([type=checkbox]):not([type=radio]), dialog textarea, dialog select { font-size: 16px !important; }
  #authView { padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); }
  #authView .threshold-form { padding: 28px 20px; }
  #authView h1 { font-size: 27px; }
  .signin-brand .metona-lettering { width: 210px; height: 30px; }
  .observatory { width: calc(100% - 24px); margin: 16px 12px; padding: 22px 16px 28px; }
  .bk-host h1 { font-size: 28px; }
}

/* V3 remains dark under a light OS setting; solid is an accessible material. */
@media (prefers-color-scheme: light) { :root { color-scheme: dark; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :is(.horizon,.sidebar,.stage,.bk-top,.observatory,dialog.sheet,dialog.feature-search,.notice), #authView .threshold-form, body[data-mobile-surface=glass] .sidebar { background: var(--surface); }
}
@media (prefers-reduced-transparency: reduce) {
  :is(.horizon,.sidebar,.stage,.bk-top,.observatory,dialog.sheet,dialog.feature-search,.notice,.dock), #authView .threshold-form, body[data-mobile-surface=glass] .sidebar { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
  body::before, body::after, .horizon::before, .observatory::before, #authView .threshold-form::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; scroll-behavior: auto !important; }
  .metona-load-ring { animation: none; border-color: var(--blue); }
}
@media (forced-colors: active) {
  body::before, body::after, .horizon::before, .observatory::before, #authView .threshold-form::before { display: none; }
  :is(.horizon,.sidebar,.stage,.bk-top,.observatory,dialog.sheet,dialog.feature-search,.notice,.dock), #authView .threshold-form, body[data-mobile-surface=glass] .sidebar { color: CanvasText; background: Canvas; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; border-color: CanvasText; }
  :is(button,a,input,select,textarea,.primary,.feature-trigger,.mail-button) { color: ButtonText; border-color: ButtonText; box-shadow: none; }
  :focus-visible { outline: 2px solid Highlight; }
}

/* User-requested hold-to-move cue. The event's own calendar color lights only
   its edges after the 2.5-second hold; a visible word also names the mode. */
.slab.drag-ready, .slab.dragging {
  opacity: 1; z-index: 5; cursor: grabbing; outline: 2px solid var(--c); outline-offset: 1px;
  box-shadow: 0 0 4px var(--c), 0 0 14px var(--c), 0 0 26px color-mix(in srgb, var(--c) 75%, transparent);
}
.slab-move-state { position: absolute; right: 3px; bottom: 2px; padding: 1px 3px; background: var(--surface); color: var(--ink); font: 600 10px/1.2 var(--font-ui); pointer-events: none; }
@media (forced-colors: active) {
  .slab.drag-ready, .slab.dragging { outline: 3px solid Highlight; box-shadow: none; }
  .slab-move-state { background: Canvas; color: CanvasText; }
}

/* Wordmark matte correction: apply alpha to the existing pixels at render time.
   Cropping creates an isolated layer, so screen blending alone leaves an opaque
   matte on the translucent panel. This filter changes alpha, never RGB/artwork.
   Apply to sign-in and owner/public headers; the separate ELVN mark is untouched. */
#authView .signin-brand .metona-lettering, .brand .metona-lettering { mix-blend-mode: normal; }
#authView .signin-brand .metona-lettering img, .brand .metona-lettering img {
  mix-blend-mode: normal;
  filter: url("#metona-wordmark-alpha");
}
