/* HearthSettings — full-screen settings shell. All classes scoped with .hs-.
   A left tab rail over a scrolling body, in the HEARTH firelight language. */

.hs-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: stretch;
}
.hs-overlay[hidden] { display: none; }
body.hs-locked { overflow: hidden; }

.hs-scrim {
  position: absolute; inset: 0;
  background: rgba(9, 6, 4, .66);
  backdrop-filter: blur(3px);
}

.hs-panel {
  position: relative; z-index: 1;
  width: min(1080px, 100vw);
  max-height: 100vh;
  margin: auto;
  display: flex; flex-direction: column;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: hs-rise .32s var(--ease);
}
@keyframes hs-rise { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: none; } }

/* header */
.hs-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1.05rem clamp(1rem, 3vw, 1.6rem) .9rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-hi), var(--bg-raise));
}
.hs-head__eyebrow {
  display: block;
  font-size: var(--step--1); letter-spacing: .32em; text-transform: uppercase;
  color: var(--ember); font-weight: 600; margin-bottom: .25rem;
}
.hs-head__title h2 { font-family: var(--f-display); font-size: var(--step-2); color: var(--ink); }
.hs-close {
  flex: none;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--bg-card);
  color: var(--ink-dim); font-size: 1rem; cursor: pointer;
  display: grid; place-items: center;
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.hs-close:hover { border-color: var(--ember); color: var(--ink); background: var(--bg-hi); }

/* main split */
.hs-main {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 210px 1fr;
}

/* rail */
.hs-rail {
  display: flex; flex-direction: column; gap: .2rem;
  padding: .8rem .6rem;
  border-right: 1px solid var(--line);
  background: var(--bg);
  overflow-y: auto;
}
.hs-tab {
  display: flex; align-items: center; gap: .7rem;
  padding: .62rem .75rem; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--ink-mute); cursor: pointer;
  font-family: var(--f-ui); font-size: var(--step-0); text-align: left;
  letter-spacing: .01em;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.hs-tab__icon { font-size: 1.05rem; width: 1.4rem; text-align: center; filter: saturate(.9); }
.hs-tab:hover { background: var(--bg-hi); color: var(--ink-dim); }
.hs-tab.is-active {
  background: var(--bg-card); color: var(--ink);
  box-shadow: inset 2px 0 0 var(--ember);
}
.hs-tab.is-active .hs-tab__icon { filter: none; }

/* body */
.hs-body {
  min-width: 0; overflow-y: auto;
  padding: clamp(1rem, 3vw, 1.7rem);
}

/* graceful module-missing / error note */
.hs-missing {
  max-width: 34ch; margin: 3rem auto; text-align: center; color: var(--ink-mute);
  display: grid; gap: .35rem;
}
.hs-missing__icon { font-size: 1.6rem; color: var(--warn); }
.hs-missing__sub { font-size: var(--step--1); color: var(--ink-mute); opacity: .8; word-break: break-word; }

/* focus states */
.hs-tab:focus-visible,
.hs-close:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

/* narrow: rail collapses to a scrolling top row */
@media (max-width: 720px) {
  .hs-panel { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; border: 0; }
  .hs-main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .hs-rail {
    flex-direction: row; gap: .3rem;
    border-right: 0; border-bottom: 1px solid var(--line);
    overflow-x: auto; overflow-y: hidden;
    padding: .55rem .6rem;
  }
  .hs-tab { flex: none; }
  .hs-tab.is-active { box-shadow: inset 0 -2px 0 var(--ember); }
  .hs-tab__label { white-space: nowrap; }
}

@media (max-width: 420px) {
  .hs-tab__label { display: none; }
  .hs-tab { padding: .55rem .7rem; }
  .hs-tab__icon { width: auto; font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hs-panel { animation: none; }
}
