/* plancia.css — "Plancia di studio" theme layer for /app (concept 2a).
 * Loaded AFTER style2.css: it retunes palette, typography and layout of the
 * app shell without touching the engine (app2.js) or the mobile shell logic
 * (responsive.js — #rail drawer, #detail bottom sheet and #m-tabbar keep
 * working; only their skin changes). /chart does NOT load this file.
 */

:root {
  --bg: #0E0D14;
  --glass: rgba(14, 13, 22, 0.72);
  --glass-2: rgba(16, 15, 24, 0.86);
  --line: rgba(214, 184, 121, 0.18);
  --gold: #D6B879;
  --text: #E8E2D2;
  --muted: #8F8A7E;
}

html, body { font-family: "Spectral", serif; }

/* site header: FULL-WIDTH in the app (stays boxed at 1100px on /chart and the site pages,
   which don't load this file). Padding aligned with the app top bar. */
.site-header .sh-inner { max-width: none; padding-left: 22px; padding-right: 22px; }

/* ============ grid: icon rail · topbar / stage+detail / clockbar ============ */
@media (min-width: 980px) {
  #app {
    grid-template-columns: 54px 1fr 448px;
    grid-template-rows: 54px 1fr 42px;
    grid-template-areas:
      "irail topbar topbar"
      "irail stage  detail"
      "bottombar bottombar bottombar";
  }
}
@media (min-width: 980px) and (max-width: 1320px) {
  #app { grid-template-columns: 54px 1fr 396px; }
}

/* ============ top bar: view tabs left · natal form + account right ============ */
#topbar { justify-content: flex-start; gap: 20px; padding: 0 22px; background: none;
  border-bottom: 1px solid var(--line); min-width: 0; }
#topbar .view-switch { position: static; display: flex; gap: 22px; padding: 0; background: none;
  border: none; backdrop-filter: none; border-radius: 0; flex: none; }
#topbar .view-switch button { padding: 2px 0; border-radius: 0; color: var(--muted);
  font-family: "Spectral", serif; font-size: 11.5px; font-weight: 600; letter-spacing: 2.5px;
  text-transform: uppercase; }
#topbar .view-switch button.active { color: var(--gold); background: none; }
#topbar .view-switch .vi { display: none; } /* desktop: text only; the icon appears on mobile */
#topbar .natal-form { margin-left: auto; }
.m-natal-cta { display: none; }

/* natal form: dark pills + gold outline CALCOLA */
.field { background: #17161F; border: 1px solid #3A3846; border-radius: 8px; padding: 4px 12px; }
.field small { display: none; }
.field input { font-family: "Spectral", serif; font-size: 13px; }
.natal-go { height: 36px; padding: 0 20px; background: none; border: 1px solid var(--gold);
  border-radius: 999px; color: var(--gold); font-family: "Spectral", serif; font-size: 12px;
  font-weight: 600; letter-spacing: 2px; text-transform: uppercase; }
.natal-go:hover { box-shadow: 0 0 16px rgba(214,184,121,.25); }

/* auth entry (injected by auth.js into .actions) -> plain ACCEDI / account wordmark */
.actions { gap: 6px; flex: none; }
.actions button, #auth-open { width: auto; height: auto; padding: 6px 4px 6px 12px; background: none;
  border: none; color: var(--muted); font-family: "Spectral", serif; font-size: 12px; font-weight: 500;
  letter-spacing: 2px; text-transform: uppercase; box-shadow: none;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions button:hover, #auth-open:hover { color: var(--text); border: none; }
#auth-open.signed { color: var(--gold); border: none; box-shadow: none; }

/* ============ icon rail (desktop only) ============ */
#icon-rail { grid-area: irail; display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 6px; border-right: 1px solid var(--line); background: var(--bg); z-index: 46; }
#icon-rail button { width: 38px; height: 38px; border-radius: 10px; background: none;
  border: 1px solid transparent; color: var(--muted); font-size: 16px; cursor: pointer;
  box-shadow: none; padding: 0; }
#icon-rail button:hover { color: var(--text); border-color: #3A3846; }
#icon-rail button.on { color: var(--gold); border-color: rgba(214,184,121,.4);
  background: rgba(214,184,121,.06); }
#icon-rail .sp { flex: 1; }
#icon-rail .lamp { color: var(--gold); border-color: transparent; box-shadow: none; }
@media (max-width: 979px) { #icon-rail { display: none; } }

/* ============ lessons: #rail becomes a slide-over panel on desktop ============ */
@media (min-width: 980px) {
  #rail { position: absolute; top: 0; bottom: 42px; left: 54px; z-index: 45; width: 302px;
    background: #12111A; border-right: 1px solid var(--line);
    box-shadow: 24px 0 60px rgba(0,0,0,.5); backdrop-filter: none;
    transform: translateX(-110%); transition: transform .28s cubic-bezier(.4,0,.2,1); }
  body.d-rail #rail { transform: none; }
  #rail-scrim { position: absolute; inset: 0 0 42px 54px; z-index: 40; background: rgba(5,6,12,.45);
    opacity: 0; visibility: hidden; transition: opacity .25s; }
  body.d-rail #rail-scrim { opacity: 1; visibility: visible; }
}
@media (max-width: 979px) { #rail-scrim { display: none; } #rail { background: #12111A; } }

.rail-title { font-family: "Spectral", serif; font-size: 11px; font-weight: 500; letter-spacing: 2.5px;
  color: var(--muted); }
.acc { border: none; border-radius: 0; background: none; }
.acc-head { font-family: "Spectral", serif; font-size: 11px; letter-spacing: 2.5px; color: var(--muted);
  padding: 10px 6px 7px; border-bottom: 1px solid rgba(214,184,121,.1); }
.acc-head:hover { color: var(--gold); }
.lesson { font-family: "Cormorant Garamond", serif; font-size: 15.5px; letter-spacing: .4px;
  color: var(--text); border-radius: 0; padding: 9px 8px; border-bottom: 1px solid rgba(214,184,121,.08); }
.lesson:hover { color: var(--gold); background: none; }
.lesson.active { color: var(--gold); background: none; }

/* ============ stage: column labels + tighter top ============ */
.collabel { position: absolute; top: 12px; z-index: 5; pointer-events: none;
  font-family: "Spectral", serif; font-size: 11px; font-weight: 500; letter-spacing: 3px;
  color: var(--gold); display: flex; align-items: center; gap: 14px; }
/* legends: exclusive switches stacked VERTICALLY under the column labels.
   Tree legend follows #lab-tree (tree views only); wheel legend follows #lab-wheel. */
#lab-tree { flex-direction: column; align-items: flex-start; gap: 10px; }
#lab-wheel { flex-direction: column; align-items: flex-end; gap: 10px; }
#lettering-flags, #wheel-flags, #wheel-toggles, #tree-toggles { pointer-events: auto; display: flex;
  flex-direction: column; align-items: stretch; gap: 6px; }
/* toggles below the flags, separated by a divider bar (they ADD, don't switch) */
#wheel-toggles, #tree-toggles { margin-top: 6px; padding-top: 8px; border-top: 1px solid rgba(214,184,121,.14); }
#lettering-flags button, #wheel-flags button, #wheel-toggles button, #tree-toggles button {
  background: none; border: 1px solid #3A3846; border-radius: 999px;
  padding: 4px 10px; min-width: 88px; text-align: center; cursor: pointer; color: var(--muted);
  font-family: "Spectral", serif; font-size: 9px; font-weight: 600; letter-spacing: 1.4px;
  text-transform: uppercase; }
#lettering-flags button:hover, #wheel-flags button:hover, #wheel-toggles button:hover, #tree-toggles button:hover { color: var(--text); }
#lettering-flags button.on, #wheel-flags button.on, #wheel-toggles button.on, #tree-toggles button.on {
  color: var(--gold); border-color: rgba(214,184,121,.45); background: rgba(214,184,121,.06); }

/* "Entrambi" with the body pane on: tight triptych — tree close to the body,
   wheel bigger, thin dividers (same line as the reading panel) between the three */
@media (min-width: 980px) {
  /* keep the figure clear of the left legend column */
  body.show-corpo #stage[data-view="entrambi"] #stage-canvas { gap: 0; padding-left: 140px; }
  /* tree stretched to FULL canvas height: its side borders become full-height
     dividers; generous inner padding gives the tree air on both sides */
  body.show-corpo #stage[data-view="entrambi"] #tree-svg {
    align-self: stretch; height: auto; max-height: none;
    border-left: 1px solid var(--line); border-right: 1px solid var(--line);
    padding: 0 3%; margin: 0 1.4%; box-sizing: content-box; }
  body.show-corpo #stage[data-view="entrambi"] #wheel { width: min(40%, 78vh); height: auto; }
}

/* "Entrambi": the wheel as tall as the tree (square, width-capped to stay in the stage) */
@media (min-width: 980px) {
  #stage[data-view="entrambi"] #wheel { height: auto; width: min(44%, 84vh); }
}
.collabel small { color: var(--muted); letter-spacing: 2px; font-size: 10px; }
#lab-tree { left: 22px; }
#lab-wheel { right: 22px; }
#stage[data-view="albero"] #lab-wheel { display: none; }
#stage[data-view="zodiaco"] #lab-tree { display: none; }
@media (min-width: 980px) { #stage-canvas { padding: 26px 2% 6px; } }
@media (max-width: 979px) {
  .collabel { display: none; }
  #stage-canvas { padding: 10px 3% 8px; } /* the view switch no longer floats over the stage */
}

/* mobile pill: swap tree <-> body inside the Albero tab */
#m-corpo { display: none; }
@media (max-width: 979px) {
  #stage[data-view="albero"] #m-corpo,
  #stage[data-view="entrambi"] #m-corpo { display: block; position: absolute; top: 10px; left: 12px;
    z-index: 6; background: rgba(14,13,20,.82); cursor: pointer;
    border: 1px solid #3A3846; border-radius: 999px; padding: 5px 16px; color: var(--muted);
    font-family: "Spectral", serif; font-size: 9.5px; font-weight: 600; letter-spacing: 1.8px;
    text-transform: uppercase; }
  #m-corpo.on { color: var(--gold); border-color: rgba(214,184,121,.45); background: rgba(214,184,121,.1); }
}

/* ============ detail (reading) panel — dynamic, wider, 2a skin ============ */
@media (min-width: 980px) {
  #detail { margin: 0; padding: 22px 28px 22px; background: var(--glass);
    border: none; border-left: 1px solid var(--line); border-radius: 0; }
}
/* typography (applies in the mobile sheet too) */
.dt-title { font-family: "Cormorant Garamond", serif; font-size: 25px; font-weight: 500;
  letter-spacing: .5px; text-transform: none; margin-top: 8px; color: #F2EDDD; }
.dt-sub, .dt-meta { font-family: "Spectral", serif; font-size: 10.5px; letter-spacing: 2px; }
.dt-block h3 { font-family: "Spectral", serif; font-size: 10.5px; font-weight: 600;
  letter-spacing: 2.5px; color: var(--gold); }
.dt-block { border-top: 1px solid rgba(214,184,121,.12); }
.dt-block p { font-family: "Spectral", serif; font-size: 14.5px; line-height: 1.65; color: #D8D2C2; }
.dt-back { background: none; border: 1px solid #3A3846; border-radius: 999px;
  font-family: "Spectral", serif; font-size: 11px; letter-spacing: 1.5px; }
.rows .row { border-bottom: 1px solid rgba(214,184,121,.1); font-family: "Spectral", serif; }
.pl-row { border-bottom: 1px solid rgba(214,184,121,.08); border-radius: 0; }
.pl-row:hover { background: rgba(214,184,121,.05); }
.pl-name, .pl-formula { font-family: "Spectral", serif; }
.aspect { font-family: "Spectral", serif; font-size: 13.5px; padding: 6px 0;
  border-bottom: 1px solid rgba(214,184,121,.08); }
.aspect .asp-orb { font-size: 12px; }
.dt-card { border-radius: 5px; }
#detail::-webkit-scrollbar-thumb { background: rgba(214,184,121,.25); }

/* ============ bottom bar -> planetary clock (PLACEHOLDER — future function) ============ */
#bottombar { background: var(--bg); border-top: 1px solid var(--line); }
.clockbar { display: flex; flex: 1; justify-content: center; align-items: center; gap: 34px;
  font-family: "Spectral", serif; font-size: 10.5px; font-weight: 500; letter-spacing: 2.5px;
  color: var(--muted); white-space: nowrap; overflow: hidden; }
.clockbar b { color: #CFC9B8; font-weight: 600; }
.clockbar .gold { color: var(--gold); }

/* ============ modal (settings) reskin ============ */
.modal-card { background: #12111A; border-color: var(--line); }
.modal-head h2, #viz-panel h2 { font-family: "Spectral", serif; letter-spacing: 2.5px; }

/* ============ mobile refinements ============ */
@media (max-width: 979px) {
  /* the drawer lives inside #app's stacking context (below the site header):
     start it under the header or the header clips the form (--site-h set by JS) */
  #rail { top: var(--site-h, 0px); }
  /* single top bar: burger + "inserisci data" CTA on the left,
     view tabs as icon+small label on the right */
  #topbar { gap: 10px; padding-top: 7px; padding-bottom: 7px; }
  #nav-burger { border-radius: 8px; background: none; border-color: #3A3846; flex: none; }
  .m-natal-cta { display: block; flex: 1; min-width: 0; background: none;
    border: 1px solid var(--gold); border-radius: 999px; padding: 6px 10px; cursor: pointer;
    color: var(--gold); font-family: "Cormorant Garamond", serif; font-size: 13.5px;
    font-weight: 600; letter-spacing: .4px; white-space: nowrap; text-align: center;
    overflow: hidden; text-overflow: ellipsis; }
  #topbar .view-switch { margin-left: auto; gap: 8px; flex: none; }
  #topbar .view-switch button { display: flex; flex-direction: column; align-items: center;
    gap: 2px; font-size: 6.5px; letter-spacing: .6px; }
  #topbar .view-switch .vi { display: block; font-size: 11px; line-height: 1; }
  /* keep the sheet look coherent with the new palette; contain overscroll so a
     drag-from-top never triggers pull-to-refresh behind the sheet */
  #detail { background: #12111A; overscroll-behavior: contain; }
  .m-sheet-head { background: linear-gradient(to bottom, #12111A 70%, rgba(18,17,26,0)); }
}
