/*
 * Bastion — user customizations
 *
 * This file is safe to edit. It is loaded last so anything here overrides
 * build/css/site.css without having to mark rules !important. It also holds
 * the handful of stateful nav/mobile-menu rules that are easier as plain CSS
 * than as Tailwind utility soup (dropdown popovers, mobile overlay).
 */

/* Cal Sans is loaded and preloaded (see fonts.css / base.html.twig) but was
   never actually applied anywhere - the browser warns on every page load
   that the preloaded font goes unused. Wire it in as the heading font
   (custom.css rather than site.css's @theme: the tailwind4 engine strips
   unused custom theme properties, and nothing generates a `font-display`
   utility class, so it never survived into the compiled output). */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Cal Sans', var(--font-sans, ui-sans-serif, system-ui, sans-serif);
}

/* partials/breadcrumbs.html.twig - a plain <ol class="breadcrumbs"> of
   <li> crumbs built from Grav's own breadcrumbs.get(), not the breadcrumbs
   plugin's markup, so it needs its own styling rather than reusing
   bastion-old's #breadcrumbs plugin overrides. */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  margin: 0;
  list-style: none;
  font-size: 0.875rem;
  color: var(--color-gray-500);
}
.dark .breadcrumbs {
  color: var(--color-gray-400);
}
.breadcrumbs li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.breadcrumbs li:not(:last-child)::after {
  content: '/';
  color: var(--color-gray-400);
}
.dark .breadcrumbs li:not(:last-child)::after {
  color: var(--color-gray-600);
}
.breadcrumbs a {
  color: var(--accent);
  transition: color 0.3s ease-in-out;
}
.breadcrumbs a:hover {
  color: var(--accent-darker);
}
.breadcrumbs li[aria-current="page"] {
  color: var(--color-gray-600);
}
.dark .breadcrumbs li[aria-current="page"] {
  color: var(--color-gray-300);
}

/* Results on the /search results page - styled after a classic
   search-engine result: a small url line, a larger link-colored title, a
   muted snippet. No thumbnail, no dividers - whitespace alone separates
   results. */
.simplesearch-results .search-row {
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}
.simplesearch-results .search-row:first-child {
  padding-top: 0;
}
.simplesearch-results .search-url {
  font-size: 0.875rem;
  color: var(--color-gray-600);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dark .simplesearch-results .search-url {
  color: var(--color-gray-400);
}
.simplesearch-results .search-title {
  margin: 0.125rem 0 0;
  font-size: 1.25rem;
  font-weight: 500;
}
.simplesearch-results .search-title a {
  color: var(--accent);
}
.simplesearch-results .search-title a:hover {
  text-decoration: underline;
}
.simplesearch-results .search-snippet {
  margin: 0.25rem 0 0;
  line-height: 1.6;
  color: var(--color-gray-600);
}
.dark .simplesearch-results .search-snippet {
  color: var(--color-gray-300);
}
.simplesearch-results .search-date {
  color: var(--color-gray-500);
}
.dark .simplesearch-results .search-date {
  color: var(--color-gray-400);
}
.simplesearch-results hr {
  display: none;
}

/* Header Transparent / Header Text Light / Header Text Dark (blueprints.yaml
   header-transparent/header-dark/header-light) - these toggles existed as
   config with no implementation at all (no CSS ever read the body classes
   they produce). #header:has(+ .hero-section) rather than duplicating
   hero.html.twig's own display logic here: modular pages render their hero
   from a modular child page, not page.header.hero, so that logic can't be
   replicated from a body-class computed in base.html.twig anyway - the DOM
   adjacency is the one signal available in every case. Reuses the existing
   .scrolled class (already toggled by site.js for the header's shadow) so
   no new JS is needed. */
body.header-transparent #header:has(+ .hero-section) {
  position: absolute;
  inset-inline: 0;
  top: 0;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
body:not(.header-animated) #header:has(+ .hero-section) {
  transition: none;
}
body.header-transparent.scrolled #header:has(+ .hero-section) {
  position: sticky;
}
body.header-transparent:not(.scrolled) #header:has(+ .hero-section) {
  background: transparent;
  border-color: transparent;
  backdrop-filter: none;
  box-shadow: none;
}
body.header-transparent.header-dark:not(.scrolled) #header:has(+ .hero-section),
body.header-transparent.header-dark:not(.scrolled) #header:has(+ .hero-section) * {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}
body.header-transparent.header-light:not(.scrolled) #header:has(+ .hero-section),
body.header-transparent.header-light:not(.scrolled) #header:has(+ .hero-section) * {
  color: #111827;
  border-color: rgba(17, 24, 39, 0.3);
}

/* Tailwind's preflight sets buttons to cursor: default (matching native
   browser behavior) rather than cursor: pointer. Every button in this theme
   is acting as a clickable control, not a native form submit, so restore
   the pointer cursor globally instead of annotating each one. */
/* Tailwind's preflight sets svg/img { height: auto }. An inline <svg> with
   only a viewBox (no width/height attributes) has no intrinsic size for
   "auto" to resolve against, so it silently renders at 0x0 - it was in the
   DOM the whole time, just invisible. Force it to fill its sized wrapper. */
.logo-svg svg {
  height: 100%;
  width: auto;
}

button {
  cursor: pointer;
}

/* Nav panel: a single toggle-revealed menu used at every viewport width
   (no separate always-visible desktop bar) - nested children render inline,
   indented, rather than as hover popovers. */
.dropmenu .dropmenu-panel {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding-left: 1rem;
}

/* simplesearch's searchbox partial ships no CSS of its own
   (plugins.simplesearch.built_in_css: false) - these three classes are its
   entire contract. */
.search-wrapper form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}
.search-wrapper .search-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--color-gray-300);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  background: #ffffff;
  color: inherit;
}
.dark .search-wrapper .search-input {
  border-color: var(--color-gray-600);
  background: var(--color-gray-800);
}
.search-wrapper .search-input:focus {
  outline: none;
  border-color: var(--accent);
}
.search-wrapper .search-submit {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  height: 2.25rem;
  width: 2.25rem;
  border-radius: 0.375rem;
  border: 1px solid var(--color-gray-300);
  background: none;
}
.dark .search-wrapper .search-submit {
  border-color: var(--color-gray-600);
}
.search-wrapper .search-submit img {
  height: 1rem;
  width: 1rem;
}
.dark .search-wrapper .search-submit img {
  filter: invert(1);
}

/* The form plugin's default field/button layouts ship no CSS of their own
   either - same story as simplesearch above. */
.form-field {
  margin-bottom: 1rem;
  text-align: left;
}
.form-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-gray-700);
}
.dark .form-label {
  color: var(--color-gray-400);
}
.form-input,
.form-input-wrapper select {
  width: 100%;
  border: 1px solid var(--color-gray-300);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  background: #ffffff;
  color: inherit;
}
.dark .form-input,
.dark .form-input-wrapper select {
  border-color: var(--color-gray-600);
  background: var(--color-gray-800);
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
}
/* The Form plugin adds no structural class of its own - a submit button is
   whatever the page's own form config's `classes:` string says, nothing
   more. Give every submit button sane base padding/rounding regardless
   (form authors who set no-default-style still get a usable button, not
   an unstyled text blob), and reserve the accent gradient look for buttons
   that haven't opted out of it. */
.button-wrapper button[type="submit"],
.form-field button[type="submit"] {
  display: inline-block;
  border-radius: 0.375rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.3s ease-in-out;
}
.button-wrapper button[type="submit"]:not(.no-default-style),
.form-field button[type="submit"]:not(.no-default-style) {
  background: linear-gradient(to bottom right, var(--accent), var(--accent-darker));
  color: var(--accent-contrast, #ffffff);
}
.button-wrapper button[type="submit"]:not(.no-default-style):hover,
.form-field button[type="submit"]:not(.no-default-style):hover {
  filter: brightness(0.95);
}

/* Login plugin's own login.css hardcodes a light #fcfcfc card with no dark
   mode awareness - it just so happens the form fields inside are already
   covered by the .form-input rules above, but the card itself needs its
   own override, or dark mode ends up with a dark form floating in a
   stark white box. */
#grav-login {
  max-width: 26rem;
  margin: 4rem auto;
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: 0.75rem;
  padding: 2rem;
}
.dark #grav-login {
  background: var(--color-gray-800);
  border-color: var(--color-gray-700);
}
#grav-login h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}
#grav-login .button-wrapper a {
  color: var(--color-gray-500);
  transition: color 0.3s ease-in-out;
}
.dark #grav-login .button-wrapper a {
  color: var(--color-gray-400);
}
#grav-login .button-wrapper a:hover {
  color: var(--accent);
}

/* Minimal prose styling for rendered Markdown content (page.content). A
   hand-rolled stand-in for @tailwindcss/typography: that plugin is a JS
   PostCSS plugin and support in the ported PHP engine is unverified, so
   this avoids depending on it for body text to be readable at all. */
.prose {
  line-height: 1.75;
}
.prose > * + * {
  margin-top: 1.25em;
}
.prose > *:first-child {
  margin-top: 0;
}
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-weight: 700;
  line-height: 1.3;
  margin-top: 1.6em;
  margin-bottom: 0.6em;
}
.prose h1 { font-size: 1.875em; }
.prose h2 { font-size: 1.5em; }
.prose h3 { font-size: 1.25em; }
.prose ul, .prose ol {
  padding-left: 1.5em;
}
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose a {
  color: var(--link, #2563eb);
  text-decoration: underline;
}
.prose blockquote {
  border-left: 3px solid var(--color-gray-300);
  padding-left: 1em;
  font-style: italic;
  color: var(--color-gray-500);
}
.dark .prose blockquote {
  border-color: var(--color-gray-600);
  color: var(--color-gray-400);
}
.prose img {
  border-radius: 0.5rem;
}
/* GitHub-style inline code and code blocks - readable background tint in
   both light and dark mode rather than a fixed dark block. */
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 85%;
  border-radius: 0.375rem;
  padding: 0.2em 0.4em;
  background: rgba(175, 184, 193, 0.2);
  color: inherit;
}
.dark .prose code {
  background: rgba(110, 118, 129, 0.4);
}
.prose pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 85%;
  line-height: 1.6;
  border-radius: 0.375rem;
  padding: 1rem;
  overflow-x: auto;
  background: var(--color-gray-50);
  color: inherit;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
}
.dark .prose pre {
  background: rgba(110, 118, 129, 0.4);
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.prose pre::-webkit-scrollbar {
  height: 0.5rem;
}
.prose pre::-webkit-scrollbar-track {
  background: transparent;
}
.prose pre::-webkit-scrollbar-thumb {
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.25);
}
.dark .prose pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
}
.prose pre code,
.dark .prose pre code {
  font-size: 100%;
  background: none;
  padding: 0;
  border-radius: 0;
}

/* comments-pro ships its own self-contained gray/blue palette via CSS custom
   properties (see its own :root block) rather than reading the theme's -
   remap those onto this theme's actual tokens so the comment UI matches the
   rest of the site instead of using its own colors. Must load after the
   plugin's own comments-pro.css for the cascade to win (it does - see
   base.html.twig's asset priorities). */
:root {
  --comments-color-gray-50: var(--color-gray-50);
  --comments-color-gray-100: var(--color-gray-100);
  --comments-color-gray-200: var(--color-gray-200);
  --comments-color-gray-300: var(--color-gray-300);
  --comments-color-gray-400: var(--color-gray-400);
  --comments-color-gray-500: var(--color-gray-500);
  --comments-color-gray-600: var(--color-gray-600);
  --comments-color-gray-700: var(--color-gray-700);
  --comments-color-gray-800: var(--color-gray-800);
  --comments-color-gray-900: var(--color-gray-900);
  --comments-color-gray-950: color-mix(in srgb, var(--color-gray-900) 85%, black);

  --comments-color-primary: var(--accent);
  --comments-color-primary-hover: var(--accent-darker);
  --comments-color-primary-alt: var(--accent);
  --comments-color-primary-alt-hover: var(--accent-darker);
  --comments-color-primary-dark: var(--accent-darker);
  --comments-color-primary-light: var(--accent);
}
