/* =========================
   Terminal-Inspired Theme
   ========================= */

:root {
  --bg-main: #1b1026;        /* deep purple */
  --bg-panel: #140c1d;       /* darker inset */
  --text-main: #7fffd4;      /* cyan */
  --text-muted: #b9a7d9;     /* lavender */
  --text-dim: #8a7aa8;

  --accent-green: #6dff8b;
  --accent-amber: #ffcc66;
  --accent-red: #ff6b6b;

  --border-soft: #3a2a4f;
  --link-hover: #a6ffff;
}

/* Base reset */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               "Liberation Mono", "Courier New", monospace;
  font-size: 16px;
  line-height: 1.6;
}

/* Layout */
body {
  max-width: 80ch;
  padding: 2rem 1.5rem;
  margin: auto;
}

/* Headings */
h1, h2, h3, h4 {
  color: var(--accent-green);
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h1::before {
  content: "> ";
  color: var(--accent-amber);
}

/* Paragraphs */
p {
  margin: 0.75rem 0;
}

/* Links */
a {
  color: var(--text-main);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--link-hover);
}

/* Lists */
ul, ol {
  padding-left: 1.5rem;
}

li {
  margin: 0.4rem 0;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 2rem 0;
}

/* Code */
code {
  background: var(--bg-panel);
  color: var(--accent-amber);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

pre {
  background: var(--bg-panel);
  padding: 1rem;
  overflow-x: auto;
  border-left: 3px solid var(--accent-green);
  margin: 1.5rem 0;
}

pre code {
  background: none;
  color: var(--text-main);
  padding: 0;
}

/* Blockquotes */
blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--border-soft);
  color: var(--text-muted);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

th, td {
  border: 1px solid var(--border-soft);
  padding: 0.5rem 0.75rem;
}

th {
  color: var(--accent-green);
  text-align: left;
}

/* Footer-ish text */
footer,
.small {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 3rem;
}

/* Pagefind theme overrides (safe: survives rebuilds) */
.pagefind-ui {
  /* Pagefind uses these variables internally */
  --pagefind-ui-text: #aefcff;              /* brighter cyan-ish */
  --pagefind-ui-background: rgba(0,0,0,0.35);
  --pagefind-ui-border: rgba(255,255,255,0.18);
  --pagefind-ui-primary: #aefcff;
  --pagefind-ui-tag: rgba(255,255,255,0.12);
  --pagefind-ui-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Make result meta/excerpt readable */
.pagefind-ui__result-excerpt,
.pagefind-ui__result-url,
.pagefind-ui__result-meta {
  color: #d8ffff;
  opacity: 0.95;
}

/* Title link more “terminal” */
.pagefind-ui__result-title a {
  color: #aefcff;
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* Highlight matches like grep */
.pagefind-ui mark {
  background: rgba(255, 255, 0, 0.85);
  color: #111;
  padding: 0 0.15em;
}


/* =============================
   Pagefind readability polish
   Terminal-style result panels
   ============================= */

/* Give results a panel so they don't blend into the background */
.pagefind-ui__result {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
}

/* Slight glow on hover, terminal-focus style */
.pagefind-ui__result:hover {
  box-shadow: 0 0 0 1px rgba(127, 255, 212, 0.25);
}

/* Result titles should pop more than body text */
.pagefind-ui__result-title a {
  color: var(--accent-green);
  font-size: 1.05rem;
}

/* URLs / breadcrumbs: dim but readable */
.pagefind-ui__result-url,
.pagefind-ui__result-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Excerpt text spacing */
.pagefind-ui__result-excerpt {
  margin-top: 0.4rem;
  line-height: 1.5;
}

/* Search input: make it clearly distinct */
.pagefind-ui__search-input {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  color: var(--text-main);
}

/* Cursor focus cue */
.pagefind-ui__search-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(127, 255, 212, 0.35);
}

/* Result count message ("1 result for …") */
.pagefind-ui__message {
  color: var(--text-muted);
  margin-top: 0.5rem;
}


/* =============================
   Safari-specific Pagefind fixes
   Safari sometimes applies different default form/control styling
   and can render opacity/variable-driven colors more dimly.
   These rules intentionally increase specificity and avoid opacity.
   ============================= */

@supports (-webkit-touch-callout: none) {
  /* Ensure dark form controls + consistent contrast */
  html { color-scheme: dark; }

  /* Force readable text colors (avoid opacity) */
  .pagefind-ui .pagefind-ui__result-excerpt,
  .pagefind-ui .pagefind-ui__result-url,
  .pagefind-ui .pagefind-ui__result-meta,
  .pagefind-ui .pagefind-ui__message {
    color: var(--text-muted) !important;
    opacity: 1 !important;
  }

  .pagefind-ui .pagefind-ui__result-title a {
    color: var(--accent-green) !important;
  }

  /* Give results a slightly more solid panel in Safari */
  .pagefind-ui .pagefind-ui__result {
    background-color: #140c1d !important; /* matches --bg-panel */
  }

  /* Make the search input clearly readable in Safari */
  .pagefind-ui .pagefind-ui__search-input {
    -webkit-appearance: none;
    appearance: none;
    background-color: #140c1d !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-soft) !important;
  }

  .pagefind-ui .pagefind-ui__search-input::placeholder {
    color: var(--text-dim) !important;
    opacity: 1 !important;
  }
}