/* =========================================================
   AI Prompt Library — Thrive Wellness & Development
   Dark theme matching approved cover / index / prompt mockups
   ========================================================= */

:root {
  --bg: #121212;
  --surface: #1a1a1a;
  --surface2: #222222;
  --primary: #2b6def;
  --primary-dim: #1e4fbf;
  --ink: #ffffff;
  --muted: #a0a0a0;
  --line: #2a2a2a;
  --beginner: #3ddc97;
  --intermediate: #f0a500;
  --advanced: #ff5c5c;
  --radius: 12px;
  --font: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --max: 920px;
  --tap: 44px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 16px;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 1000;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.wrap {
  width: min(100% - 1.25rem, var(--max));
  margin-inline: auto;
  max-width: 100%;
  padding-inline: 0.15rem;
  box-sizing: border-box;
}

.site-header {
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
  background: rgba(18, 18, 18, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-ph {
  width: auto;
  height: 56px;
  max-width: min(280px, 70vw);
  border: 0;
  border-radius: 0;
  display: block;
  object-fit: contain;
  background: transparent;
  padding: 0;
}

.logo-ph img,
img.logo-ph {
  width: auto;
  height: 56px;
  max-width: min(280px, 70vw);
  display: block;
  object-fit: contain;
  background: transparent;
}

.brand-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.eyebrow {
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.hero {
  padding: 2rem 0 1.25rem;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
}

.tagline {
  color: var(--ink);
  margin: 0 0 1.25rem;
  font-size: 1.05rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--tap);
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  max-width: 100%;
  box-sizing: border-box;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dim);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border-color: transparent;
  padding-inline: 0.4rem;
}

.btn-block {
  width: 100%;
}

.how-box {
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
  padding-top: 1.25rem;
}

.how-box ol {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.toolbar {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
}

.search {
  width: 100%;
  min-height: var(--tap);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0.7rem 1rem;
  font: inherit;
}

.search:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip,
.filter-btn {
  min-height: 36px;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid #3a3a3a;
  background: #1c1c1c;
  color: #ddd;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.filter-btn[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.results-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.cat-block {
  margin: 1.25rem 0 1.75rem;
}

.cat-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  background: #1e3a8a;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.cat-bar[data-cat="assistants"] { background: #1e3a8a; }
.cat-bar[data-cat="research"] { background: #4c1d95; }
.cat-bar[data-cat="documents"] { background: #1e4b7a; }
.cat-bar[data-cat="prompting"] { background: #5b2c6f; }
.cat-bar[data-cat="presentations"] { background: #7e4e1e; }
.cat-bar[data-cat="images-video"] { background: #7a2e2e; }
.cat-bar[data-cat="work-business"] { background: #1e5c3a; }
.cat-bar[data-cat="data-productivity"] { background: #1f4e6b; }
.cat-bar[data-cat="addins"] { background: #6b3a15; }
.cat-bar[data-cat="workflows"] { background: #3d4a57; }
.cat-bar[data-cat="pakistan"] { background: #0f6b5c; }
.cat-bar[data-cat="chains"] { background: #1e3a8a; }

.prompt-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem 1rem;
  align-items: start;
  padding: 0.95rem 0.25rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
  font: inherit;
  border-left: 0;
  border-right: 0;
  border-top: 0;
}

.prompt-row:hover,
.prompt-row:focus-visible {
  background: rgba(43, 109, 239, 0.08);
  outline: none;
}

.prompt-row:focus-visible {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.row-id {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-right: 0.35rem;
}

.row-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.row-usage {
  color: #cfcfcf;
  font-size: 0.92rem;
  margin: 0.2rem 0 0;
}

.row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  min-width: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-beginner {
  color: var(--beginner);
  background: rgba(61, 220, 151, 0.12);
}

.badge-intermediate {
  color: var(--intermediate);
  background: rgba(240, 165, 0, 0.14);
}

.badge-advanced {
  color: var(--advanced);
  background: rgba(255, 92, 92, 0.14);
}

.open-btn {
  min-height: var(--tap);
  min-width: 88px;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1.5px solid var(--primary);
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.open-btn:hover {
  background: rgba(43, 109, 239, 0.15);
}

.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* Preview sheet / modal */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  z-index: 90;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 720px);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transform: translateY(110%);
  transition: transform 0.22s ease;
  overflow: hidden;
}

.sheet.open {
  transform: translateY(0);
}

@media (max-width: 720px) {
  .sheet {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
  }
}

@media (min-width: 721px) {
  .sheet {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: min(560px, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    transform: translate(-50%, -40%) scale(0.96);
    opacity: 0;
    pointer-events: none;
    border-radius: 16px;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .sheet.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
  }
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1rem 0.5rem;
  min-width: 0;
}

.sheet-header > div {
  min-width: 0;
  flex: 1;
}

.sheet-header h2 {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sheet-body {
  padding: 0 1rem 1rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  max-width: 100%;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #2a2a2a;
  font-size: 0.8rem;
  font-weight: 600;
}

.pill-cat {
  background: rgba(43, 109, 239, 0.2);
  color: #9db8ff;
}

.preview-box {
  position: relative;
  margin: 0.85rem 0 1rem;
  padding: 0.9rem 1rem;
  background: var(--surface2);
  border-radius: 10px;
  border: 1px solid var(--line);
  max-height: 5.2em;
  overflow: hidden;
  color: #ddd;
  line-height: 1.45;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.preview-box::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.2em;
  background: linear-gradient(transparent, var(--surface2));
  pointer-events: none;
}

.sheet-actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.5rem;
}

.sheet-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem 1.1rem;
  border-top: 1px solid var(--line);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  flex-wrap: wrap;
}

.sheet-nav .btn {
  flex: 1 1 auto;
  min-width: 0;
}

.close-x {
  min-width: var(--tap);
  min-height: var(--tap);
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
  border-radius: 8px;
}

.close-x:hover,
.close-x:focus-visible {
  color: #fff;
  background: #2a2a2a;
}

/* Full prompt page */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  flex-wrap: wrap;
}

.prompt-article {
  padding-bottom: 2.5rem;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.prompt-article h1 {
  font-size: clamp(1.35rem, 5vw, 2rem);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.prompt-box {
  margin: 1rem 0;
  padding: 0.85rem;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 12px;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.prompt-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-height: min(55vh, 480px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 1rem;
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 100%;
}

.ph {
  background: rgba(43, 109, 239, 0.28);
  color: #cfe0ff;
  border-radius: 4px;
  padding: 0 0.15rem;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.tool-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}

.tool-list li {
  margin: 0.35rem 0;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
}

.tip-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin: 1rem 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

.fill-panel {
  margin: 1.25rem 0 1rem;
  padding: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.fill-form {
  display: grid;
  gap: 0.9rem;
  margin-top: 0.85rem;
  max-width: 100%;
  min-width: 0;
}

.fill-field {
  min-width: 0;
  max-width: 100%;
}

.fill-field label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.35rem;
  min-width: 0;
}

.fill-q {
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.fill-key {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
  overflow-wrap: anywhere;
  word-break: break-all;
  max-width: 100%;
}

.fill-field input,
.fill-field textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: var(--tap);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--ink);
  padding: 0.7rem 0.85rem;
  font: inherit;
  box-sizing: border-box;
}

.fill-field textarea {
  min-height: 88px;
  resize: vertical;
}

.fill-field input:focus,
.fill-field textarea:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

.fill-actions {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  max-width: 100%;
}

.fill-actions .btn {
  flex: 1 1 auto;
  min-width: min(100%, 140px);
}

.fill-status {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 480px) {
  .site-header .wrap,
  .wrap {
    width: calc(100% - 1rem);
  }

  .fill-panel,
  .prompt-box,
  .tip-box {
    padding: 0.75rem;
    border-radius: 10px;
  }

  .page-nav {
    gap: 0.5rem;
    font-size: 0.92rem;
  }

  .sheet-header,
  .sheet-body {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .sheet-actions .btn {
    font-size: 0.95rem;
    padding-inline: 0.75rem;
  }

  .prompt-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .row-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    width: 100%;
  }

  .prompt-text {
    font-size: 0.9rem;
  }

  .fill-key {
    font-size: 0.7rem;
  }
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.25rem 0 2rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.noscript-list {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.noscript-list a {
  display: block;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  color: #ddd;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #0e7a4f;
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.toast.show {
  opacity: 1;
}

.static-pages a {
  display: inline-block;
  margin-right: 0.85rem;
  margin-bottom: 0.5rem;
}
