/* ==========================================================================
   theme-picker.css — right-edge gear tab + palette drawer
   ========================================================================== */

/* ------------------------------------------------------------- gear tab -- */
.theme-fab{
  position:fixed;z-index:1200;
  right:0;top:50%;transform:translateY(-50%);
  display:grid;place-items:center;
  width:46px;height:52px;
  border-radius:12px 0 0 12px;
  background:var(--primary);color:var(--gold);
  font-size:1.25rem;line-height:1;
  box-shadow:-6px 0 20px rgba(var(--primary-rgb),.3);
  border:1px solid rgba(255,255,255,.14);border-right:0;
  transition:background var(--t-fast) var(--ease),color var(--t-fast) var(--ease),
             width var(--t-med) var(--ease-out);
}
.theme-fab:hover,.theme-fab:focus-visible{width:54px;background:var(--navbar);color:var(--gold)}
.theme-fab i{transition:transform 1.6s linear}
.theme-fab:hover i{transform:rotate(180deg)}
.theme-fab[aria-expanded="true"]{opacity:0;pointer-events:none}

/* --------------------------------------------------------------- scrim -- */
.theme-scrim{
  position:fixed;inset:0;z-index:1250;
  background:rgba(var(--footer-rgb),.42);
  opacity:0;visibility:hidden;
  transition:opacity var(--t-med) var(--ease),visibility var(--t-med);
}
.theme-scrim.is-open{opacity:1;visibility:visible}

/* -------------------------------------------------------------- drawer -- */
.theme-panel{
  position:fixed;z-index:1300;
  right:14px;top:50%;
  width:min(344px,calc(100vw - 28px));
  max-height:min(90vh,672px);
  display:flex;flex-direction:column;
  border:1px solid var(--hairline);border-radius:16px;
  background:var(--surface);
  box-shadow:0 26px 60px rgba(var(--footer-rgb),.3);
  transform:translate(calc(100% + 24px),-50%);
  opacity:0;visibility:hidden;
  transition:transform var(--t-med) var(--ease-out),opacity var(--t-med) var(--ease),
             visibility var(--t-med);
  overflow:hidden;
}
.theme-panel.is-open{transform:translate(0,-50%);opacity:1;visibility:visible}

.theme-panel-head{
  display:flex;align-items:center;gap:14px;
  padding:18px 18px 16px;
  background:var(--primary);color:#fff;
  border-bottom:3px solid var(--gold);
}
.theme-panel-head>i{
  display:grid;place-items:center;flex-shrink:0;width:38px;height:38px;
  border:1px solid rgba(var(--accent-rgb),.34);border-radius:10px;
  background:rgba(var(--accent-rgb),.08);
  color:var(--gold);font-size:1.125rem;
}
.theme-panel-head>div{flex:1;min-width:0}
.theme-panel-head h2{
  margin:0;font-family:var(--font-display);
  font-size:1.0625rem;font-weight:600;line-height:1.3;color:#fff;
}
.theme-panel-head p{
  margin:3px 0 0;font-size:.6875rem;line-height:1.5;color:var(--on-dark-muted);
}
.theme-panel-close{
  display:grid;place-items:center;flex-shrink:0;width:30px;height:30px;
  border:1px solid rgba(255,255,255,.26);border-radius:50%;
  color:#fff;font-size:.8125rem;
  transition:background var(--t-fast) var(--ease),color var(--t-fast) var(--ease);
}
.theme-panel-close:hover{background:var(--gold);color:var(--primary);border-color:var(--gold)}

/* ------------------------------------------------------------ swatches -- */
.theme-grid{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;
  padding:16px;overflow-y:auto;flex:1;
}
.theme-option{
  position:relative;display:flex;flex-direction:column;gap:9px;
  padding:9px 9px 10px;min-width:0;
  border:1px solid var(--hairline);border-radius:11px;
  background:var(--surface);text-align:left;
  transition:border-color var(--t-fast) var(--ease),box-shadow var(--t-med) var(--ease),
             transform var(--t-med) var(--ease-out);
}
.theme-option:hover{transform:translateY(-2px);box-shadow:0 10px 24px rgba(var(--primary-rgb),.12)}
.theme-option[aria-checked="true"]{
  border-color:var(--secondary);
  box-shadow:0 0 0 2px rgba(var(--secondary-rgb),.28);
}
.theme-swatch{
  display:flex;height:38px;border-radius:7px;overflow:hidden;
  border:1px solid rgba(var(--primary-rgb),.1);
}
.theme-swatch span{flex:1}
.theme-swatch span:first-child{flex:1.6}
.theme-option-name{
  display:flex;align-items:center;gap:6px;
  font-size:.6875rem;font-weight:600;line-height:1.35;
  color:var(--body-text);
}
.theme-option-name::before{
  content:"";flex-shrink:0;width:13px;height:13px;border-radius:50%;
  border:1.5px solid var(--hairline);
  transition:background var(--t-fast) var(--ease),border-color var(--t-fast) var(--ease);
}
.theme-option[aria-checked="true"] .theme-option-name::before{
  background:var(--secondary);border-color:var(--secondary);
  box-shadow:inset 0 0 0 2.5px var(--surface);
}

/* ---------------------------------------------------------------- foot -- */
.theme-panel-foot{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:13px 16px;border-top:1px solid var(--hairline);
  background:var(--page-bg);
}
.theme-panel-foot small{font-size:.625rem;line-height:1.5;color:var(--muted-text)}
.theme-reset{
  display:inline-flex;align-items:center;gap:7px;flex-shrink:0;
  padding:7px 13px;border:1px solid var(--hairline);border-radius:6px;
  font-size:.6875rem;font-weight:600;color:var(--primary-blue);
  transition:background var(--t-fast) var(--ease),color var(--t-fast) var(--ease),
             border-color var(--t-fast) var(--ease);
}
.theme-reset:hover{background:var(--primary);border-color:var(--primary);color:var(--gold)}

/* ----------------------------------------------------------- dark mode -- */
html[data-theme="dark"] .theme-option[aria-checked="true"]{border-color:var(--gold);box-shadow:0 0 0 2px rgba(var(--accent-rgb),.3)}
html[data-theme="dark"] .theme-option[aria-checked="true"] .theme-option-name::before{background:var(--gold);border-color:var(--gold)}
html[data-theme="dark"] .theme-reset{color:var(--gold)}
html[data-theme="dark"] .theme-reset:hover{background:var(--gold);color:var(--primary);border-color:var(--gold)}

/* ---------------------------------------------------------- responsive -- */
@media (max-width:575.98px){
  .theme-panel{
    right:0;left:0;top:auto;bottom:0;
    width:auto;max-height:78vh;
    border-radius:16px 16px 0 0;border-bottom:0;
    transform:translateY(100%);
  }
  .theme-panel.is-open{transform:translateY(0)}
  .theme-fab{width:42px;height:48px;font-size:1.125rem}
  .theme-fab:hover,.theme-fab:focus-visible{width:48px}
}

@media (prefers-reduced-motion:reduce){
  .theme-fab,.theme-fab i,.theme-panel,.theme-scrim,.theme-option,
  .theme-option-name::before,.theme-reset,.theme-panel-close{transition:none}
  .theme-fab:hover i{transform:none}
  .theme-option:hover{transform:none}
}

@media print{.theme-fab,.theme-panel,.theme-scrim{display:none !important}}
