/* ========================================================================== 
   Shell: chrome, stage, footer, command palette, toasts
   ========================================================================== */

.chrome {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 300;
  background: var(--veil);
  -webkit-backdrop-filter: saturate(170%) blur(18px);
  backdrop-filter: saturate(170%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.chrome-in {
  max-width: var(--shell); margin: 0 auto;
  padding: 0 clamp(14px, 3.4vw, 26px);
  height: var(--chrome-h);
  display: flex; align-items: center; gap: clamp(8px, 2.2vw, 22px);
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 21px; height: 21px; flex: none; }
.brand-name { font-size: var(--fs-small); font-weight: 650; letter-spacing: -0.012em; white-space: nowrap; }

.nav { display: flex; align-items: center; gap: 1px; margin-right: auto; overflow: hidden; }
.nav a {
  color: var(--ink-3); font-size: var(--fs-small); padding: 5px 9px;
  border-radius: 7px; white-space: nowrap;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.nav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; background: var(--surface-2); }

.chrome-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.tool {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 9px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-3); font-size: var(--fs-small);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.tool:hover { color: var(--ink); border-color: var(--line-2); }
.tool svg { width: 15px; height: 15px; flex: none; }
.tool.icon { width: 30px; padding: 0; justify-content: center; }
.tool-label { display: none; }
.nav-toggle { display: none; }

.chrome-progress { height: 2px; }
.chrome-progress > span { display: block; height: 100%; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; will-change: transform; }

@media (min-width: 1080px) { .tool-label { display: inline; } }
@media (max-width: 940px) {
  .nav {
    position: fixed; inset: calc(var(--chrome-h) + env(safe-area-inset-top, 0px)) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--veil);
    -webkit-backdrop-filter: saturate(170%) blur(22px); backdrop-filter: saturate(170%) blur(22px);
    border-bottom: 1px solid var(--line);
    padding: 6px clamp(14px, 3.4vw, 26px) 14px;
    display: none;
  }
  .nav[data-open="1"] { display: flex; animation: sheetDrop var(--t-mid) var(--ease); }
  .nav a { padding: 11px 10px; border-radius: 9px; font-size: var(--fs-read); }
  .nav-toggle { display: inline-flex; }
  .brand { margin-right: auto; }
}
@keyframes sheetDrop { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }

.stage { display: block; min-height: 66vh; }
.stage > .view { animation: viewIn var(--t-slow) var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(7px) } to { opacity: 1; transform: none } }

.wrap { max-width: var(--shell); margin: 0 auto; padding-inline: clamp(14px, 3.4vw, 26px); }
.wrap-wide { max-width: 1440px; margin: 0 auto; padding-inline: clamp(14px, 3.4vw, 26px); }
.band { padding-block: clamp(34px, 6vw, 66px); }
.band-sm { padding-block: clamp(20px, 3.4vw, 34px); }
.band-sunk { background: var(--surface-sunk); border-block: 1px solid var(--line); }

.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: clamp(16px, 2.6vw, 26px); }
.sec-head h2 { max-width: 24ch; }
.sec-head p { color: var(--ink-3); max-width: 48ch; font-size: var(--fs-body); }
.eyebrow {
  display: block; font-size: var(--fs-micro); font-weight: 680;
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink-4); margin-bottom: 8px;
}

.grid { display: grid; gap: 13px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(246px, 100%), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }

.foot { border-top: 1px solid var(--line); background: var(--surface-sunk); margin-top: clamp(36px, 7vw, 80px); }
.foot-in {
  max-width: var(--shell); margin: 0 auto;
  padding: clamp(30px, 4.6vw, 48px) clamp(14px, 3.4vw, 26px) clamp(36px, 5vw, 56px);
  display: grid; gap: 28px; grid-template-columns: 1fr;
}
@media (min-width: 620px) { .foot-in { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .foot-in { grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); } }
.foot-col { display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.foot-mark { font-weight: 650; color: var(--ink); letter-spacing: -0.012em; }
.foot-col h2 { font-size: var(--fs-fine); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-4); font-weight: 680; margin-bottom: 3px; }
.foot-col p { color: var(--ink-3); font-size: var(--fs-small); max-width: 40ch; }
.foot-col a { color: var(--ink-3); font-size: var(--fs-small); }
.foot-col a:hover { color: var(--ink); }
.foot-fine { font-size: var(--fs-fine) !important; color: var(--ink-4) !important; }

/* ---------- command palette ---------- */
.palette { position: fixed; inset: 0; z-index: 700; display: grid; place-items: start center; }
.palette-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.4); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fadeIn var(--t-fast) ease both; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.palette-box {
  position: relative; width: min(690px, calc(100vw - 28px)); margin-top: clamp(44px, 11vh, 120px);
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: var(--lift-3); overflow: hidden;
  animation: paletteIn var(--t-mid) var(--ease-out) both;
}
@keyframes paletteIn { from { opacity: 0; transform: translateY(-10px) scale(.985) } to { opacity: 1; transform: none } }
.palette-field { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.palette-field svg { width: 17px; height: 17px; color: var(--ink-4); flex: none; }
.palette-field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: var(--fs-read); letter-spacing: -0.01em; }
.palette-field input::placeholder { color: var(--ink-4); }
.palette-results { max-height: min(56vh, 460px); overflow-y: auto; padding: 6px; }
.p-group { font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-4); font-weight: 680; padding: 10px 10px 5px; }
.p-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 9px; color: var(--ink); cursor: pointer; min-width: 0; }
.p-item:hover, .p-item[data-active="1"] { background: var(--accent-soft); text-decoration: none; }
.p-item .p-dot { width: 7px; height: 7px; border-radius: 99px; flex: none; background: var(--ink-4); }
.p-item .p-t { font-size: var(--fs-body); font-weight: 520; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-item .p-s { font-size: var(--fs-fine); color: var(--ink-3); margin-left: auto; white-space: nowrap; padding-left: 10px; flex: none; }
.p-empty { padding: 26px 14px; text-align: center; color: var(--ink-3); font-size: var(--fs-small); }

.toast-rail { position: fixed; z-index: 800; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--ground); padding: 9px 16px; border-radius: 99px; font-size: var(--fs-small); font-weight: 520; box-shadow: var(--lift-3); animation: toastIn var(--t-mid) var(--ease-out) both; }
.toast[data-out="1"] { animation: toastOut var(--t-fast) var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96) } to { opacity: 1; transform: none } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(.97) } }
