/*
 * Pistachio palette override for hugo-theme-terminal.
 * Generated from panr.github.io/terminal-css (Pistachio preset).
 * Source palette:
 *   background #1d2021
 *   foreground #ebdbb2
 *   accent     #8ec07c
 */

:root {
  --background: #1d2021;
  --foreground: #ebdbb2;
  --accent: #8ec07c;
  --radius: 4px;
}

/* Selection highlight using the accent color */
::selection {
  background: var(--accent);
  color: var(--background);
}
::-moz-selection {
  background: var(--accent);
  color: var(--background);
}

/* Inline code: subtle accent background */
:not(pre) > code {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--foreground);
  padding: 0.1em 0.35em;
  border-radius: var(--radius);
}

/* Blockquote: leftside accent bar */
blockquote {
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

/* Footer separator */
.footer {
  border-top: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent);
}

/* Hide the auto-generated FALLBACK title bar for code blocks with no language.
   Tag your blocks with ```lang to get a proper title. */
.highlight:has(code[data-lang="fallback"]) .code-title {
  display: none;
}

/* ──────────────────────────────────────────────────────────────────────────
 * Block editor shortcodes — Pistachio-native styling.
 * Each block authored via the CMS slash menu (or toolbar) maps to a Hugo
 * shortcode under layouts/shortcodes/<id>.html.
 * ────────────────────────────────────────────────────────────────────────── */

/* Callout — info | warn | success | danger
   Uses CSS variable inheritance: each variant overrides --accent locally so
   the existing accent-tinted border/background work without new utilities. */
.callout {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: var(--radius);
}
.callout-warn    { --accent: #fabd2f; } /* gruvbox yellow */
.callout-success { --accent: #b8bb26; } /* gruvbox green  */
.callout-danger  { --accent: #fb4934; } /* gruvbox red    */

.callout-title {
  font-weight: 700;
}
.callout-body > :first-child { margin-top: 0; }
.callout-body > :last-child  { margin-bottom: 0; }

/* Gallery — square-cropped images in a CSS grid. cols 2..5 supported. */
.gallery {
  display: grid;
  gap: 0.5rem;
  margin: 1.5rem 0;
  grid-template-columns: repeat(3, 1fr); /* default */
}
.gallery.cols-2 { grid-template-columns: repeat(2, 1fr); }
.gallery.cols-3 { grid-template-columns: repeat(3, 1fr); }
.gallery.cols-4 { grid-template-columns: repeat(4, 1fr); }
.gallery.cols-5 { grid-template-columns: repeat(5, 1fr); }

.gallery-item {
  display: block;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius);
  overflow: hidden;
}
.gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
@media (max-width: 600px) {
  .gallery.cols-3, .gallery.cols-4, .gallery.cols-5 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Audio + video — full-width with subtle accent border */
.audio-block {
  margin: 1.5rem 0;
}
.audio-block audio {
  width: 100%;
}
.audio-block figcaption {
  margin-bottom: 0.5rem;
  opacity: 0.75;
}
.video-block {
  display: block;
  width: 100%;
  margin: 1.5rem 0;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}

/* Attachment download card — icon + filename + optional size */
.attachment-card {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--foreground);
  background: color-mix(in srgb, var(--accent) 4%, transparent);
  transition: background-color 0.15s ease;
}
.attachment-card:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.attachment-card .material-symbols-outlined {
  color: var(--accent);
  font-size: 1.5em;
  line-height: 1;
}
.attachment-name {
  flex: 1;
  font-weight: 500;
}
.attachment-size {
  opacity: 0.6;
  font-size: 0.85em;
}

/* Embed iframe */
.embed-block {
  display: block;
  margin: 1.5rem 0;
  border-radius: var(--radius);
}

/* Bookmark — URL preview card */
.bookmark {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--foreground);
  background: color-mix(in srgb, var(--accent) 3%, transparent);
  transition: background-color 0.15s ease;
}
.bookmark:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.bookmark:not(:has(.bookmark-thumb)) {
  grid-template-columns: 1fr;
}
.bookmark-thumb {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 3px;
  align-self: start;
}
.bookmark-meta { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.bookmark-title { display: block; }
.bookmark-desc {
  margin: 0;
  opacity: 0.85;
  font-size: 0.9em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.bookmark-host {
  opacity: 0.6;
  font-size: 0.85em;
}
@media (max-width: 500px) {
  .bookmark { grid-template-columns: 1fr; }
  .bookmark-thumb { width: 100%; height: 160px; }
}
