/* @nap.codes tools — light theme + power layer
   Applied when <html data-theme="light">. Dark stays default. */

:root[data-theme="light"] {
  --bg: #f7f7f5;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #fafaf8;
  --line: #e6e6e2;
  --line-2: #cfcfcb;
  --ink: #1a1a1a;
  --ink-2: #3a3a3a;
  --muted: #666666;
  --dim: #a0a0a0;
}

:root[data-theme="light"] body {
  background-image:
    radial-gradient(circle at 12% 8%, rgba(0,0,0,0.02), transparent 40%),
    radial-gradient(circle at 88% 92%, rgba(0,0,0,0.015), transparent 42%);
}
:root[data-theme="light"] ::selection { color: #ffffff; }
:root[data-theme="light"] ::-webkit-scrollbar-track { background: #f0f0ee; }
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: #cfcfcb; }
:root[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

/* ---------- Floating buttons ---------- */
#napThemeToggle,
#napSettingsBtn,
#napPaletteHint {
  position: fixed;
  z-index: 999;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--line-2);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, sans-serif;
  transition: transform .15s, background .15s, border-color .15s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
#napThemeToggle:hover,
#napSettingsBtn:hover,
#napPaletteHint:hover { transform: scale(1.06); border-color: var(--muted); }

#napThemeToggle    { bottom: 20px; right: 20px;  width: 40px; height: 40px; font-size: 16px; }
#napSettingsBtn    { bottom: 20px; right: 68px;  width: 40px; height: 40px; font-size: 15px; }
#napPaletteHint    { bottom: 20px; right: 116px; width: auto; height: 40px; font-size: 11px; padding: 0 12px; border-radius: 20px; font-family: 'JetBrains Mono', ui-monospace, monospace; letter-spacing: .05em; color: var(--muted); }
#napPaletteHint:hover { color: var(--ink); }

:root[data-theme="light"] #napThemeToggle,
:root[data-theme="light"] #napSettingsBtn,
:root[data-theme="light"] #napPaletteHint { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }

@media (max-width: 640px){
  #napPaletteHint { display: none; }
  #napSettingsBtn { right: 68px; }
}

/* ---------- Modal shell (settings + palette) ---------- */
.nap-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 20px 20px;
  animation: napFade .12s ease-out;
}
:root[data-theme="light"] .nap-modal { background: rgba(0,0,0,0.35); }
@keyframes napFade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Settings modal ---------- */
.nap-modal-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  width: 100%;
  max-width: 460px;
  overflow: hidden;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  color: var(--ink);
}
.nap-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.nap-modal-head b { color: var(--ink); font-weight: 500; }
.nap-modal-close {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  font-size: 22px; line-height: 1; padding: 0 4px;
}
.nap-modal-close:hover { color: var(--ink); }
.nap-modal-body { padding: 6px 0; }
.nap-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.nap-row:last-child { border-bottom: none; }
.nap-row > span:first-child { display: flex; flex-direction: column; gap: 4px; }
.nap-row em { color: var(--muted); font-style: normal; font-size: 11px; }
.nap-seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 2px; overflow: hidden; }
.nap-seg button {
  background: var(--bg-2); color: var(--muted); border: none;
  padding: 6px 14px; font: inherit; font-size: 11px; cursor: pointer;
  border-right: 1px solid var(--line-2); letter-spacing: .05em;
}
.nap-seg button:last-child { border-right: none; }
.nap-seg button.active { background: var(--accent, #3b82f6); color: #fff; }
.nap-toggle { position: relative; display: inline-block; width: 38px; height: 22px; }
.nap-toggle input { opacity: 0; width: 0; height: 0; }
.nap-toggle i {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--line-2); border-radius: 12px; transition: .15s;
}
.nap-toggle i::before {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.nap-toggle input:checked + i { background: var(--accent, #3b82f6); }
.nap-toggle input:checked + i::before { transform: translateX(16px); }
.nap-btn {
  background: var(--accent, #3b82f6); color: #fff; border: none;
  padding: 8px 14px; font: inherit; font-size: 11px; cursor: pointer;
  border-radius: 2px; letter-spacing: .15em; text-transform: uppercase; font-weight: 500;
}
.nap-btn:hover { filter: brightness(1.08); }
.nap-shortcuts { flex-direction: column; align-items: flex-start; gap: 10px; }
.nap-shortcuts > span:first-child { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.nap-kbds { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--ink-2); }
.nap-kbds kbd {
  display: inline-block; padding: 2px 6px; margin: 0 2px;
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: 2px; font-size: 10.5px; font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* ---------- Command palette ---------- */
.nap-pal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 100%;
  max-width: 640px;
  overflow: hidden;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
#napPalInput {
  width: 100%; background: transparent; color: var(--ink);
  border: none; outline: none;
  padding: 18px 20px;
  font: inherit; font-size: 15px;
  border-bottom: 1px solid var(--line);
}
#napPalInput::placeholder { color: var(--dim); }
.nap-pal-list { max-height: 50vh; overflow-y: auto; padding: 6px 0; }
.nap-pal-row {
  display: grid;
  grid-template-columns: 14px 90px 1fr auto;
  gap: 12px; align-items: center;
  padding: 9px 20px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-2);
}
.nap-pal-row .dot { width: 8px; height: 8px; border-radius: 50%; }
.nap-pal-row .nm { color: var(--ink); font-weight: 500; }
.nap-pal-row .ds { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nap-pal-row .tg { color: var(--dim); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.nap-pal-row.active { background: var(--bg-2); }
:root:not([data-theme="light"]) .nap-pal-row.active { background: rgba(255,255,255,0.04); }
.nap-pal-empty { padding: 20px; color: var(--muted); text-align: center; font-size: 12px; }
.nap-pal-foot {
  border-top: 1px solid var(--line);
  padding: 10px 20px;
  display: flex; gap: 18px;
  font-size: 10.5px; color: var(--muted);
}
.nap-pal-foot kbd {
  display: inline-block; padding: 1px 5px; margin: 0 3px;
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: 2px; font-size: 10px;
}

/* ---------- Install banner ---------- */
#napInstallBanner {
  position: fixed; left: 50%; bottom: 20px;
  transform: translateX(-50%) translateY(20px);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 10px 14px 10px 12px;
  display: flex; align-items: center; gap: 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px; color: var(--ink);
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  z-index: 998;
  opacity: 0; transition: opacity .25s, transform .25s;
  max-width: 92vw;
}
#napInstallBanner.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#napInstallBanner .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent, #3b82f6); box-shadow: 0 0 8px var(--accent, #3b82f6); }
#napInstallBanner .msg { color: var(--ink-2); }
#napInstallBanner .install {
  background: var(--accent, #3b82f6); color: #fff; border: none;
  padding: 6px 12px; font: inherit; font-size: 11px; cursor: pointer;
  border-radius: 2px; letter-spacing: .1em; text-transform: uppercase; font-weight: 500;
}
#napInstallBanner .dismiss {
  background: transparent; border: none; color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px;
}
#napInstallBanner .dismiss:hover { color: var(--ink); }

/* ---------- Byline (injected per tool page) ---------- */
#napByline {
  max-width: 1280px;
  margin: 32px auto 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .04em;
  text-align: center;
}
#napByline a { color: var(--ink-2); text-decoration: none; }
#napByline a:hover { color: var(--ink); }
#napByline .at { color: var(--accent, #3b82f6); }
#napByline time { color: var(--dim); }

/* ---------- Mobile accessibility fixes ---------- */
@media (max-width: 640px){
  /* Enlarge tap targets in hub-nav to meet WCAG 44x44 min */
  .hub-nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 6px 4px; }
  .hub-nav .other-tools { gap: 4px 10px; }
}

/* ---------- Recipe banner ---------- */
#napRecipeBar {
  position: sticky; top: 0; left: 0; right: 0;
  z-index: 900;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  animation: napFade .18s ease-out;
}
#napRecipeBar .rb-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 10px 20px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
}
#napRecipeBar .rb-head { display: flex; align-items: baseline; gap: 10px; }
#napRecipeBar .rb-tag {
  background: var(--accent, #3b82f6); color: #fff;
  padding: 2px 8px; border-radius: 2px;
  font-size: 9px; letter-spacing: .18em; font-weight: 500;
}
#napRecipeBar .rb-head b { color: var(--ink); font-size: 13px; font-weight: 500; }
#napRecipeBar .rb-step { color: var(--muted); font-size: 11px; letter-spacing: .1em; }
#napRecipeBar .rb-chips { display: flex; align-items: center; gap: 4px; flex: 1; overflow-x: auto; }
#napRecipeBar .rb-chips .chip {
  padding: 4px 10px; border-radius: 20px;
  border: 1px solid var(--line-2); background: var(--bg-2);
  color: var(--muted); font-size: 11px;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
#napRecipeBar .rb-chips .chip::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c);
}
#napRecipeBar .rb-chips .chip.cur { color: var(--ink); border-color: var(--c); background: var(--panel); font-weight: 500; }
#napRecipeBar .rb-chips .chip.done { color: var(--dim); }
#napRecipeBar .rb-chips .chip.done::before { background: var(--dim); }
#napRecipeBar .rb-chips .arrow { color: var(--dim); font-size: 12px; }
#napRecipeBar .rb-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
#napRecipeBar .rb-btn {
  background: var(--accent, #3b82f6); color: #fff; border: none;
  padding: 8px 14px; font: inherit; font-size: 11px; cursor: pointer;
  border-radius: 2px; letter-spacing: .1em; font-weight: 500;
}
#napRecipeBar .rb-btn:hover { filter: brightness(1.08); }
#napRecipeBar .rb-btn.ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line-2);
}
#napRecipeBar .rb-btn.ghost:hover { border-color: var(--muted); }
#napRecipeBar .rb-btn.sm { padding: 6px 10px; font-size: 13px; }
@media (max-width: 720px){
  #napRecipeBar .rb-chips { order: 3; width: 100%; }
  #napRecipeBar .rb-actions { margin-left: 0; }
}
