/* Shared pieces used across Pocket Tools pages: ⌘K search, the all-tools page,
   support banner, sponsor slots, GitHub star button and user quotes.
   Colours fall back to the dark site palette when a page doesn't define them. */

:root {
  --pt-bg: var(--bg, #141413);
  --pt-panel: var(--panel, #1c1c1a);
  --pt-panel-2: var(--panel-2, #22221f);
  --pt-line: var(--line, rgba(255, 255, 255, 0.1));
  --pt-line-strong: var(--line-strong, rgba(255, 255, 255, 0.18));
  --pt-text: var(--text, #f5f3ef);
  --pt-muted: var(--muted, #b4b0a8);
  --pt-soft: var(--soft, #8b877f);
  --pt-accent: var(--accent, #d77855);
  --pt-accent-soft: var(--accent-soft, rgba(215, 120, 85, 0.16));
  --pt-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

kbd {
  font-family: var(--pt-mono);
  font-size: 0.85em;
  padding: 1px 6px;
  border: 1px solid var(--pt-line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  color: var(--pt-muted);
  background: var(--pt-panel-2);
}

/* ---------- ⌘K search box (home page) ---------- */

.tool-search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 640px;
  margin: 22px auto 10px;
  padding: 14px 16px;
  border: 1px solid var(--pt-line-strong);
  border-radius: 14px;
  background: var(--pt-panel);
  color: var(--pt-soft);
  font: 600 15px var(--pt-mono);
  text-align: left;
  cursor: text;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.tool-search-box span {
  flex: 1;
}

.tool-search-box:hover,
.tool-search-box:focus-visible {
  border-color: var(--pt-accent);
  color: var(--pt-muted);
}

.tool-search-box:focus-visible,
.pt-palette-input:focus-visible {
  outline: 2px solid var(--pt-accent);
  outline-offset: 2px;
}

/* ---------- ⌘K search dialog ---------- */

.pt-palette {
  width: min(640px, calc(100vw - 24px));
  max-height: min(560px, calc(100vh - 80px));
  margin: 10vh auto auto;
  padding: 0;
  border: 1px solid var(--pt-line-strong);
  border-radius: 16px;
  background: var(--pt-panel);
  color: var(--pt-text);
  font-family: var(--pt-mono);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.pt-palette[open] {
  display: flex;
  flex-direction: column;
}

.pt-palette::backdrop {
  background: rgba(8, 8, 7, 0.62);
  backdrop-filter: blur(3px);
}

.pt-palette-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--pt-line);
  color: var(--pt-muted);
}

.pt-palette-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--pt-text);
  font: 600 16px var(--pt-mono);
}

.pt-palette-input::placeholder {
  color: var(--pt-soft);
}

.pt-palette-input::-webkit-search-cancel-button {
  display: none;
}

.pt-palette-list {
  flex: 1;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}

.pt-palette-option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.pt-palette-option[aria-selected="true"] {
  background: var(--pt-accent-soft);
}

.pt-palette-name {
  font-size: 14px;
  font-weight: 800;
}

.pt-palette-desc {
  grid-column: 1;
  color: var(--pt-muted);
  font-size: 12px;
  line-height: 1.45;
}

.pt-palette-app {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  padding: 3px 8px;
  border: 1px solid var(--pt-line-strong);
  border-radius: 999px;
  color: var(--pt-muted);
  font-size: 11px;
  font-weight: 800;
}

.pt-palette-app-dev {
  color: var(--pt-accent);
  border-color: var(--pt-accent-soft);
}

.pt-palette-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--pt-line);
  color: var(--pt-soft);
  font-size: 11px;
}

.pt-palette-status {
  margin: 0;
}

.pt-palette-hint {
  flex: 1;
}

.pt-palette-all {
  color: var(--pt-accent);
  font-weight: 800;
}

/* App header: the search icon shares the left slot with the Back button.
   Back is only visible inside a tool, and the search icon only on the app's
   home screen, so exactly one of them shows. */
body.pt-in-app .app-header > * {
  grid-row: 1;
}

body.pt-in-app .app-header .pt-search-icon {
  grid-column: 1;
}

/* Inside the apps the panel follows the app's light theme. */
html[data-theme="light"] .pt-palette {
  --pt-panel: #ffffff;
  --pt-panel-2: #f3f1ec;
  --pt-text: #1c1b19;
  --pt-muted: #5c5952;
  --pt-soft: #85817a;
  --pt-line: rgba(0, 0, 0, 0.08);
  --pt-line-strong: rgba(0, 0, 0, 0.16);
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) body.pt-in-app .pt-palette {
    --pt-panel: #ffffff;
    --pt-panel-2: #f3f1ec;
    --pt-text: #1c1b19;
    --pt-muted: #5c5952;
    --pt-soft: #85817a;
    --pt-line: rgba(0, 0, 0, 0.08);
    --pt-line-strong: rgba(0, 0, 0, 0.16);
  }
}

@media (max-width: 580px) {
  .tool-search-box kbd,
  .pt-palette-hint {
    display: none;
  }

  .pt-palette {
    margin-top: 12px;
  }
}

/* ---------- Sponsor banner (home) ---------- */

.support-banner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: min(100% - 40px, var(--max, 980px));
  margin: 18px auto 0;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--pt-line);
  border-radius: 12px;
  background: var(--pt-panel);
  color: var(--pt-muted);
  font-size: 12px;
  font-weight: 700;
}

.support-banner p {
  margin: 0;
  line-height: 1.5;
}

.support-banner-short {
  display: none;
}

.support-banner-actions {
  display: flex;
  flex: none;
  gap: 8px;
}

.support-banner-button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--pt-accent);
  color: #1a1410;
  font-weight: 800;
  white-space: nowrap;
}

.support-banner-button:hover {
  filter: brightness(1.08);
}

@media (max-width: 720px) {
  .support-banner {
    justify-content: space-between;
  }

  .support-banner-long {
    display: none;
  }

  .support-banner-short {
    display: inline;
  }
}

/* ---------- GitHub star button ---------- */

.github-star span {
  margin-right: 6px;
  color: var(--pt-accent);
}

/* ---------- Sponsor rows (home) ----------
   Generated from sponsor/sponsors.json by scripts/build-sponsors.mjs. */

.sponsor-strip .label {
  text-align: center;
}

.sponsor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.sponsor-grid + .sponsor-grid {
  margin-top: 10px;
}

.sponsor-slot {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 88px;
  padding: 12px;
  border: 1px dashed var(--pt-line-strong);
  border-radius: 12px;
  color: var(--pt-soft);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.sponsor-slot:hover,
.sponsor-slot:focus-visible {
  border-color: var(--pt-accent);
  color: var(--pt-text);
}

/* A booked slot: logo + name, linking to the sponsor (rel="sponsored"). */
.sponsor-slot-filled {
  border-style: solid;
  background: var(--pt-panel);
  color: var(--pt-text);
}

.sponsor-slot-filled img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.sponsor-slot-filled span {
  font-size: 12px;
  font-weight: 800;
}

.sponsor-note {
  margin-top: 12px;
  color: var(--pt-soft);
  font-size: 11px;
  text-align: center;
}

.sponsor-note a {
  color: var(--pt-accent);
  font-weight: 800;
}

@media (max-width: 580px) {
  .sponsor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Sponsor page ----------
   Price cards reuse the home page's .app-grid / .app-card look. */

.sponsor-plans-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sponsor-plans-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sponsor-plan {
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-margin-top: 24px;
}

.sponsor-plan:target {
  border-color: var(--pt-accent);
}

.sponsor-plan h3 {
  margin: 4px 0 0;
}

.sponsor-plan-price {
  margin-top: 6px;
  color: var(--pt-muted);
  font-size: 13px;
}

.sponsor-plan-price strong {
  color: var(--pt-text);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.sponsor-plan-open {
  color: var(--pt-soft);
  font-size: 11px;
  font-weight: 800;
}

.sponsor-plan .button {
  align-self: flex-start;
  margin-top: auto;
}

.promise-grid.promise-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 820px) {
  .promise-grid.promise-grid-2,
  .sponsor-plans-2,
  .sponsor-plans-3 {
    grid-template-columns: 1fr;
  }
}

.sponsor-rules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.sponsor-rules article {
  padding: 16px;
  border: 1px solid var(--pt-line);
  border-radius: 12px;
  background: var(--pt-panel);
}

.sponsor-rules strong {
  display: block;
  margin-bottom: 6px;
}

.sponsor-rules p {
  color: var(--pt-muted);
  font-size: 13px;
  line-height: 1.6;
}

.sponsor-rules a,
.section-copy a {
  color: var(--pt-accent);
}

@media (max-width: 580px) {
  .sponsor-rules {
    grid-template-columns: 1fr;
  }
}

/* ---------- Legal pages (terms, privacy) ---------- */

.section.legal {
  max-width: 760px;
  text-align: left;
}

.legal h1 {
  margin: 6px 0 12px;
}

.legal h2 {
  margin: 28px 0 8px;
  font-size: 18px;
}

.legal p,
.legal li {
  color: var(--pt-muted);
  font-size: 14px;
  line-height: 1.7;
}

.legal ul {
  margin: 0;
  padding-left: 20px;
}

.legal strong {
  color: var(--pt-text);
}

.legal a {
  color: var(--pt-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- All tools page ---------- */

.all-tools-filter {
  margin-top: 22px;
  max-width: 34rem;
}

.all-tools-filter label {
  display: block;
  margin-bottom: 8px;
  color: var(--pt-muted);
  font-size: 12px;
  font-weight: 800;
}

.all-tools-filter input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--pt-line-strong);
  border-radius: 12px;
  background: var(--pt-panel);
  color: var(--pt-text);
  font: 600 15px var(--pt-mono);
}

.all-tools-filter input:focus-visible {
  outline: 2px solid var(--pt-accent);
  outline-offset: 2px;
}

.all-tools-count {
  margin-top: 8px;
  color: var(--pt-soft);
  font-size: 12px;
}

.all-tools-group {
  margin-top: 22px;
}

.all-tools-group h3 {
  margin-bottom: 10px;
  color: var(--pt-muted);
  font-size: 13px;
}

.all-tools-empty {
  color: var(--pt-muted);
}

.all-tools-cta a {
  color: var(--pt-accent);
  font-weight: 800;
}

[hidden] {
  display: none !important;
}

/* ---------- User quotes (home; add real quotes only) ---------- */

.quotes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.quote-card {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--pt-line);
  border-radius: 12px;
  background: var(--pt-panel);
}

.quote-card blockquote {
  margin: 0 0 12px;
  color: var(--pt-text);
  font-size: 13px;
  line-height: 1.65;
}

.quote-card figcaption {
  color: var(--pt-soft);
  font-size: 12px;
}

.sponsor-hero .hero-copy > p:not(.label) {
  margin-top: 18px;
}

.sponsor-hero .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

/* ---------- App home screen: "Sponsor Pocket Everyday/Dev" card ----------
   Added by shared/js/tool-sponsors.js under the tool grid while the app-wide
   slot is open. Uses each app's own colour variables. */
.pt-sponsor-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 14px;
  margin-top: 28px;
  padding: 16px 18px;
  border: 1px dashed var(--border-strong, var(--border));
  border-radius: var(--radius, 12px);
  background: var(--card);
  color: var(--muted);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.pt-sponsor-card:hover,
.pt-sponsor-card:focus-visible {
  border-color: var(--fg);
  color: var(--fg);
}

.pt-sponsor-card-label {
  grid-column: 1 / -1;
  font-size: 10px;
  font-weight: 740;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pt-sponsor-card-logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px dashed currentColor;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
}

.pt-sponsor-card-text {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 13px;
  line-height: 1.45;
}

.pt-sponsor-card-text strong {
  color: var(--fg);
  font-size: 15px;
  font-weight: 700;
}

.pt-sponsor-card-arrow {
  font-size: 18px;
  transition: transform 0.15s ease;
}

.pt-sponsor-card:hover .pt-sponsor-card-arrow { transform: translateX(3px); }

/* ---------- /sponsor/?tool=… note ---------- */
.sponsor-tool-note {
  margin: 0 0 18px;
  text-align: left;
  line-height: 1.6;
  padding: 12px 14px;
  border: 1px solid var(--pt-line);
  border-radius: 12px;
  background: var(--pt-panel);
  color: var(--pt-soft);
  font-size: 14px;
}

.sponsor-tool-note strong { color: var(--pt-text); }

.sponsor-plan.is-suggested {
  border-color: var(--pt-text);
  box-shadow: 0 0 0 1px var(--pt-text);
}
