/* ===========================================================================
   Print Trail Docs — clean minimal theme
   Brand: teal #27b9a4 · ink #404041 · coral #ef4140
   =========================================================================== */

/* --- Fonts: self-hosted Lato (no Google Fonts) --------------------------- */
@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/lato-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Lato";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/lato-latin-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/lato-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("/assets/fonts/lato-latin-900-normal.woff2") format("woff2");
}

/* --- Tokens -------------------------------------------------------------- */
:root {
  --font: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --brand: #0b7a6b;          /* accessible teal for links/buttons */
  --brand-bright: #27b9a4;   /* logo teal, used for accents/hover */
  --accent: #d33636;         /* coral, used sparingly (warnings) */

  --ink: #1f2733;
  --muted: #5b6573;
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --bg-sunken: #eef1f5;
  --line: #e4e8ee;
  --code-bg: #f4f6f8;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);

  --header-h: 3.5rem;
  --content-max: 46rem;
  --radius: 10px;
}

html[data-theme="dark"] {
  --brand: #2bc4ad;
  --brand-bright: #4fd8c3;
  --accent: #ff6b6b;
  --ink: #e6eaef;
  --muted: #9aa6b2;
  --bg: #0f1419;
  --bg-soft: #161c23;
  --bg-sunken: #1b222b;
  --line: #242d38;
  --code-bg: #161c23;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
}

/* --- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.no-scroll { overflow: hidden; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--brand); color: #fff; padding: .6rem 1rem; border-radius: 0 0 8px 0; z-index: 200;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--brand-bright); outline-offset: 2px; border-radius: 4px; }

/* --- Header -------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  height: var(--header-h);
  max-width: 90rem; margin: 0 auto; padding: 0 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); font-weight: 900; }
.brand:hover { text-decoration: none; }
.brand__logo { display: block; }
.brand__logo--dark { display: none; }
html[data-theme="dark"] .brand__logo--light { display: none; }
html[data-theme="dark"] .brand__logo--dark { display: block; }
.brand__label {
  font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); border-left: 1px solid var(--line); padding-left: .55rem;
}

.top-nav { margin-left: auto; display: flex; align-items: center; gap: 1.2rem; }
.top-nav > a { color: var(--muted); font-weight: 700; font-size: .95rem; }
.top-nav > a:hover { color: var(--ink); text-decoration: none; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 2.25rem; height: 2.25rem; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); }

.search-btn {
  display: inline-flex; align-items: center; gap: .5rem; min-width: 15rem;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  color: var(--muted); padding: .5rem .85rem; cursor: pointer; font: inherit; font-size: .92rem;
}
.search-btn:hover { border-color: var(--brand-bright); color: var(--ink); }
.search-btn kbd {
  margin-left: auto;
  font-family: var(--mono); font-size: .75rem; background: var(--bg); border: 1px solid var(--line);
  border-radius: 5px; padding: 0 .35rem; color: var(--muted);
}
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav-toggle { display: none; margin-left: auto; }

/* --- Layout (3 columns) -------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr) 14rem;
  gap: 2.5rem;
  max-width: 90rem; margin: 0 auto; padding: 2rem 1.5rem 5rem;
}
.content { min-width: 0; }
.content--single { max-width: var(--content-max); margin: 0 auto; padding: 2.5rem 1.5rem 5rem; }

/* --- Sidebar ------------------------------------------------------------- */
.sidebar {
  position: sticky; top: calc(var(--header-h) + 1.5rem);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 3rem);
  overflow-y: auto;
  padding-right: .5rem;
}
.sidebar__section { border: 0; margin-bottom: .25rem; }
.sidebar__summary {
  list-style: none; cursor: pointer; padding: .35rem 0;
  font-weight: 800; font-size: .82rem; letter-spacing: .03em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar__summary::-webkit-details-marker { display: none; }
.sidebar__summary::after {
  content: ""; width: .5rem; height: .5rem; margin-left: .5rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s ease; opacity: .7;
}
details[open] > .sidebar__summary::after { transform: rotate(45deg); }
.sidebar__summary a { color: inherit; }
.sidebar__summary a:hover { color: var(--ink); text-decoration: none; }
.sidebar__list { list-style: none; margin: .15rem 0 .6rem; padding: 0 0 0 .1rem; }
.sidebar__list a {
  display: block; padding: .3rem .6rem; margin: .05rem 0;
  color: var(--muted); font-size: .95rem; border-radius: 7px; border-left: 2px solid transparent;
}
.sidebar__list a:hover { background: var(--bg-soft); color: var(--ink); text-decoration: none; }
.sidebar__list a.is-active {
  color: var(--brand); font-weight: 700; background: color-mix(in srgb, var(--brand-bright) 12%, transparent);
  border-left-color: var(--brand);
}

/* --- Table of contents --------------------------------------------------- */
.toc { font-size: .9rem; }
.toc__inner {
  position: sticky; top: calc(var(--header-h) + 1.5rem);
  max-height: calc(100vh - var(--header-h) - 3rem); overflow-y: auto;
  border-left: 1px solid var(--line); padding-left: 1rem;
}
.toc__title { margin: 0 0 .5rem; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.toc__list { list-style: none; margin: 0; padding: 0; }
.toc__item a { display: block; padding: .42rem 0; color: var(--muted); line-height: 1.45; }
.toc__item a:hover { color: var(--brand); text-decoration: none; }
.toc__item--l3 a { padding-left: .85rem; font-size: .86rem; }
.toc__item a.is-current { color: var(--brand); font-weight: 700; }

/* --- Prose --------------------------------------------------------------- */
.prose { max-width: var(--content-max); }
.prose h1 { font-size: 2.1rem; font-weight: 900; line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
.lead { font-size: 1.18rem; color: var(--muted); margin: 0 0 2rem; line-height: 1.5; }
.prose h2 { font-size: 1.5rem; font-weight: 800; margin: 2.4rem 0 .8rem; padding-top: .4rem; letter-spacing: -.01em; }
.prose h3 { font-size: 1.2rem; font-weight: 800; margin: 1.8rem 0 .6rem; }
.prose h4 { font-size: 1.02rem; font-weight: 800; margin: 1.4rem 0 .5rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin: .35rem 0; }
.prose li > ul, .prose li > ol { margin: .35rem 0; }
.prose strong { font-weight: 800; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

/* Heading anchors (markdown-it-anchor headerLink) */
.prose :is(h2, h3, h4) > a { color: inherit; }
.prose :is(h2, h3, h4) > a:hover { color: var(--brand); text-decoration: none; }

.prose a { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.prose a:hover { text-decoration-color: var(--brand); }

/* Tables */
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.4rem; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 800; background: var(--bg-soft); }

/* Inline + block code */
.prose :not(pre) > code {
  font-family: var(--mono); font-size: .88em; background: var(--code-bg);
  padding: .15em .4em; border-radius: 6px; border: 1px solid var(--line);
}
.prose pre {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; overflow-x: auto; margin: 0 0 1.4rem; font-size: .9rem; line-height: 1.5;
}
.prose pre code { font-family: var(--mono); background: none; border: 0; padding: 0; }

/* Callout (converted Hugo alert -> blockquote) */
.prose blockquote {
  margin: 0 0 1.3rem; padding: .85rem 1.1rem;
  background: color-mix(in srgb, var(--brand-bright) 8%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--brand-bright) 30%, var(--line));
  border-left: 4px solid var(--brand-bright);
  border-radius: 8px; color: var(--ink);
}
.prose blockquote :last-child { margin-bottom: 0; }

/* Videos in docs */
.doc-video {
  display: block; width: 100%; margin: 0 0 1.4rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: #000;
}

/* --- Buttons / cards (home, 404) ---------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .65rem 1.2rem; border-radius: 9px; font-weight: 700;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink); cursor: pointer;
}
.btn:hover { border-color: var(--brand-bright); text-decoration: none; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: color-mix(in srgb, var(--brand) 85%, #000); }

.home .hero { padding: 2rem 0 1rem; }
.hero h1 { font-size: 2.5rem; font-weight: 900; margin: 0 0 .6rem; letter-spacing: -.02em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.5rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin-top: 2.5rem; }
.card { display: block; padding: 1.2rem 1.3rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); color: var(--ink); }
.card:hover { border-color: var(--brand-bright); box-shadow: var(--shadow); text-decoration: none; transform: translateY(-1px); transition: .15s ease; }
.card h2 { margin: 0 0 .35rem; font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }

/* --- Mobile sidebar toggle ---------------------------------------------- */
.sidebar-toggle {
  display: none; align-items: center; gap: .5rem;
  padding: .55rem .9rem; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg-soft); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer;
}
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 90; }

/* --- Footer -------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 2rem; }
.site-footer__inner { max-width: 90rem; margin: 0 auto; padding: 1.5rem; color: var(--muted); font-size: .9rem; }

/* --- Search modal + Pagefind theming ------------------------------------ */
.search-modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: start center; }
.search-modal[hidden] { display: none; }
.search-modal__backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, .5); backdrop-filter: blur(2px); }
.search-modal__panel {
  position: relative; width: min(40rem, 92vw); margin-top: 8vh;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 1rem; max-height: 80vh; overflow: auto;
}
/* Scope to .search-modal .pagefind-ui so these win over pagefind-ui.css's
   own .pagefind-ui defaults (which load after this file) — and stay
   theme-aware via --ink/--bg so dark mode is readable. */
.search-modal .pagefind-ui {
  --pagefind-ui-scale: .9;
  --pagefind-ui-primary: var(--brand);
  --pagefind-ui-text: var(--ink);
  --pagefind-ui-background: var(--bg);
  --pagefind-ui-border: var(--line);
  --pagefind-ui-tag: var(--bg-soft);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 9px;
  --pagefind-ui-font: var(--font);
}
.pagefind-ui__search-input { font-weight: 400 !important; }
.pagefind-ui__search-input::placeholder { color: var(--muted) !important; font-weight: 400 !important; opacity: 1; }
.pagefind-ui__search-clear {
  background: var(--bg-soft); color: var(--ink); border: 1px solid var(--line);
  border-radius: 7px; padding: .3rem .7rem; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.pagefind-ui__search-clear:hover { border-color: var(--brand-bright); color: var(--ink); }
/* Typed query text (Pagefind's default was dark — invisible on the dark bar) */
.search-modal .pagefind-ui__search-input { color: var(--ink) !important; }
/* Softer, blue-tinted result text in dark mode */
html[data-theme="dark"] .search-modal .pagefind-ui { --pagefind-ui-text: #c3cdd9; }
/* Subtle match highlight instead of the harsh yellow/black default */
.search-modal .pagefind-ui mark {
  background: color-mix(in srgb, var(--brand-bright) 16%, transparent);
  color: inherit;
  font-weight: 700;
  border-radius: 3px;
  padding: 0 .12em;
}

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 16rem minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 820px) {
  body { font-size: 16px; }
  .layout { grid-template-columns: minmax(0, 1fr); padding-top: 1rem; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 95;
    width: min(20rem, 84vw); max-height: none; background: var(--bg);
    border-right: 1px solid var(--line); padding: calc(var(--header-h) + 1rem) 1.25rem 2rem;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: translateX(0); }
  .top-nav {
    position: absolute; top: var(--header-h); right: 0; left: 0;
    flex-direction: column; align-items: stretch; gap: .25rem;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: .75rem 1.25rem;
    display: none;
  }
  .top-nav.is-open { display: flex; }
  .top-nav > a { padding: .5rem 0; }
  .search-btn { justify-content: space-between; }
  .nav-toggle { display: inline-grid; }
}
