:root {
  /* Tells the browser this page themes itself. Without it, Chromium's
     "auto dark theme" (on by default in some mobile browsers, e.g. Brave)
     re-tints our colors and the theme toggle appears not to work. */
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1c2733;
  --text-dim: #374654;
  --accent: #2d7dd2;
  --accent-soft: #e3eefb;
  --border: #a8c1e1;
  --code-bg: #b5c0ce;
  --warn-bg: #fdf3e0;
  --warn-border: #e0a838;
  --alert-bg:rgb(255, 202, 202);
  --alert-border: rgb(220, 54, 54);
  --glow-rgb: 45, 125, 210;   /* card glow edge color (r, g, b) */
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15171a;
  --panel: #1d2126;
  --text: #e8e6e1;
  --text-dim: #c1ccd8;
  --accent: #3878c2;
  --accent-soft: #1b2c40;
  --border: #2d5788;
  --code-bg: #374049;
  --warn-bg: #2e2617;
  --warn-border: #b98a2e;
    --alert-bg:rgb(63, 21, 21);
  --alert-border: rgb(183, 43, 43);
  --glow-rgb: 120, 200, 255;  /* card glow edge color (r, g, b) */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
}

/* -----------------------------------------------------------------
   GLOBAL LINK COLOR
   Force every hyperlink to the medium accent color in ALL states
   (unvisited, visited, hover, active). This overrides the browser's
   default dark-blue-unvisited / purple-visited so internal and
   external links look identical everywhere. Component links that
   need a different color (sidebar nav, cards, header brand) still
   win because their rules come later in this file.
   To change the link color, edit --accent in the palette blocks up top.
   ----------------------------------------------------------------- */
a,
a:link,
a:active {
  color: var(--accent);
}

a:hover{
  color:#469af3;
}

a:visited{
  color:blueviolet;
}

.site-header {
  /* stays above the open mobile nav (z 60) so the hamburger/X is always clickable */
  position: sticky; top: 0; z-index: 70;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.site-header .brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  font-weight: 600; font-size: 18px;
}

.site-header .brand img { height: 32px; width: auto; }

.site-header .spacer { flex: 1; }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 6px 12px; cursor: pointer; font-size: 14px;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle img { height: 18px; width: auto; display: block; }

/* Hamburger nav toggle. Hidden on desktop; the mobile media query at the
   bottom of this file shows it and turns the sidebar into a dropdown.
   The three spans are the burger bars; when the nav is open they animate
   into an X. */
.nav-toggle {
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; width: 38px; height: 34px; flex: 0 0 auto;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; padding: 0;
}
.nav-toggle span {
  display: block; width: 16px; height: 2px; border-radius: 1px;
  background: var(--text);
  transition: transform 200ms ease, opacity 150ms ease;
}
.nav-toggle:hover { border-color: var(--accent); }
.nav-toggle:hover span { background: var(--accent); }
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.layout {
  display: grid; grid-template-columns: 240px 1fr;
  gap: 32px; padding: 24px 5%;
}

.sidebar {
  position: sticky; top: 70px; align-self: start;
  display: flex; flex-direction: column; gap: 2px;
}

.sidebar a {
  color: var(--text-dim); text-decoration: none;
  padding: 7px 12px; border-radius: 6px; font-size: 15px;
}
.sidebar a:hover { color: var(--text); background: var(--accent-soft); }
.sidebar a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.sidebar .nav-group {
  margin-top: 0; padding: 0 4px;
  font-size: 16px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); text-decoration: underline;
}

main { 
  /* min-width: 0;  */
  padding-bottom: 80px;
  width: fit-content;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
}

main h1 { font-size: 32px; margin: 8px 0 4px; }
main h2 { font-size: 22px; margin: 36px 0 10px; padding-top: 8px; }
main h3 { font-size: 17px; margin: 24px 0 8px; }
main p { margin: 10px 0; }
main ul, main ol { margin: 10px 0 10px 26px; }
main li { margin: 5px 0; }
main [id] { scroll-margin-top: 80px; }

.lede { font-size: 18px; color: var(--text-dim); margin-bottom: 20px; }

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px; margin: 24px 0;
}

.card {
  display: block; position: relative; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px; text-decoration: none; color: var(--text);
}
.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 6px; color: var(--accent); }
.card p { margin: 0; font-size: 14px; color: var(--text-dim); }

/* -----------------------------------------------------------------
   CARD GLOW (mouse-responsive edge highlight)
   A thin sliver of the card border lights up at the point nearest the
   cursor and brightens as the pointer approaches. Driven by initCardGlow()
   in js/site.js, which sets --mx / --my / --glow on each .card and adds
   the "glow-on" class to <html> only when the browser qualifies (mouse +
   hover support, CSS masking support, no reduced-motion preference).
   Without that class none of these rules apply, so cards fall back to the
   plain accent hover border above.
   To tune: glow color is --glow-rgb in the palette blocks up top; reach
   distance is RANGE in site.js; ring reach along the border is the 140px
   circle; bloom strength is the 0.06 alpha.
   ----------------------------------------------------------------- */
html.glow-on .card:hover { border-color: var(--border); } /* the glow IS the hover feedback */

html.glow-on .card::before,
html.glow-on .card::after {
  content: "";
  position: absolute;
  border-radius: 10px;
  pointer-events: none;
  opacity: var(--glow, 0);
}

/* edge ring: a radial gradient masked down to a 1.5px border sliver */
html.glow-on .card::before {
  inset: -1px;
  padding: 1.5px;
  background: radial-gradient(140px circle at var(--mx, 50%) var(--my, 50%),
              rgb(var(--glow-rgb)), rgba(var(--glow-rgb), 0.55) 22%, transparent 55%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

/* soft interior bloom near the cursor */
html.glow-on .card::after {
  inset: 0;
  background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 50%),
              rgba(var(--glow-rgb), 0.06), transparent 50%);
}
/* card glow end */

figure.shot {
  margin: 18px 0; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; padding: 12px;
}
figure.shot img {
  display: block; max-width: 100%; margin: 0 auto;
  border-radius: 6px; cursor: zoom-in;
}
figure.shot figcaption {
  margin-top: 8px; font-size: 13px; color: var(--text-dim); text-align: center;
}
figure.shot .missing {
  display: flex; align-items: center; justify-content: center;
  min-height: 180px; border: 2px dashed var(--border); border-radius: 6px;
  color: var(--text-dim); font-size: 14px; text-align: center; padding: 16px;
}

/* figure shot "fit" modifier
   Add class "fit" to a shot (<figure class="shot fit">) to make the FRAME
   shrink-wrap the image instead of spanning the full column: the frame hugs
   the image's natural width, capped at 75% of the column, and centers itself.
   The caption wraps inside the frame. Change max-width to adjust the cap. */
figure.shot.fit {
  width: fit-content;
  max-width: 75%;
  margin-left: auto;
  margin-right: auto;
}

/* figure sidebyside
   A responsive image grid. Put one <figure class="shot"> per cell inside
   <figure class="sidebyside">. Each cell keeps its own card, its own
   word-wrapping caption, zoom, and placeholder. Change how many are across
   with grid-template-columns. Collapses to one column on mobile.
   align-items: start keeps images top-aligned so captions of different
   lengths hang below without stretching the shorter cells. */
figure.sidebyside {
  margin: 18px 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 16px;
  align-items: start;
}
figure.sidebyside .shot {
  margin: 0;
}
@media (max-width: 820px) {
  figure.sidebyside { grid-template-columns: 1fr; }
}
/* figure sidebyside end */

.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.85);
  display: none; align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox figure {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  max-width: 94vw;
}
.lightbox img { max-width: 100%; max-height: 86vh; border-radius: 6px; }
/* always light: the backdrop stays dark in both themes */
.lightbox figcaption {
  color: rgba(255, 255, 255, 0.85); font-size: 14px; line-height: 1.5;
  text-align: center; max-width: 80ch;
}
.lightbox figcaption:empty { display: none; }

/* Lightbox caption variants — pick one via the class set in buildLightbox()
   (js/site.js): "cap-bar" or "cap-frame". Delete the unused block once chosen.
   cap-bar: translucent gray strip coming off the bottom of the image.
   cap-frame: the whole zoom sits in a shot-style panel frame, caption inside.
   The "has-cap" class is set by JS when the current image has a caption. */
/* .lightbox.cap-bar figure { gap: 0; }
.lightbox.cap-bar.has-cap img { border-radius: 6px 6px 0 0; }
.lightbox.cap-bar figcaption {
  align-self: stretch; width: 0; min-width: 100%;
  background: rgba(125, 130, 138, 0.3);
  padding: 8px 14px; border-radius: 0 0 6px 6px;
} */

.lightbox.cap-frame figure {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 1px 1px 12px 1px; gap: 8px;
}
.lightbox.cap-frame img { max-height: 82vh; }
/* thin separator between image and caption area; bottom corners squared
   so the line runs clean edge to edge */
.lightbox.cap-frame.has-cap img {
  border-radius: 6px 6px 0 0;
  border-bottom: 1px solid var(--border);
}
.lightbox.cap-frame figcaption { color: var(--text-dim); font-size: 13px; }
/* lightbox caption variants end */

pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px; overflow-x: auto;
  font-size: 14px; margin: 12px 0;
}
code { font-family: Consolas, "Courier New", monospace; }
p code, li code {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px; font-size: 14px;
}

/* Severity tag — an inline colored pill for a word like "Caution" or a
   rating like "Performance Impact — High". Same idea as <code> (rounded,
   thin outline) but bold, in a legible sans (not the code monospace), and
   the outline is currentColor so it always matches the text color. Pick the
   color with a modifier class. The colors are self-contained (bright text on
   a dark hue) so they read on both the light and dark themes.
   Usage: <span class="sev sev-red">Caution</span> */
.sev {
  display: inline-block;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-weight: 700;
  font-size: 1em;
  line-height: 1.2;
  padding: 1px 8px;
  border: 1px solid currentColor;
  border-radius: 6px;
  vertical-align: baseline;
}
.sev-red    { color: #ff5a5a; background: #3a0b0b; }
.sev-orange { color: #ff9e3d; background: #3a2306; }
.sev-yellow { color: #ffce3d; background: #382f06; }
.sev-green  { color: #5fd07f; background: #0e3a1e; }
.sev-blue { color: rgb(93, 156, 244); background:rgb(13, 52, 91)}

.note, .warn, .alert {
  border-radius: 8px; padding: 12px 16px; margin: 14px 0; font-size: 15px;
}
.note { background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0; }
.warn { background: var(--warn-bg); border-left: 4px solid var(--warn-border); border-radius: 0 8px 8px 0; }
.alert { background: var(--alert-bg); border-left: 4px solid var(--alert-border); border-radius: 0 8px 8px 0; }

table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 15px; }
th, td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
th { background: var(--panel); }

.badge {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  border-radius: 20px; padding: 2px 12px; font-size: 13px; font-weight: 600;
  margin-bottom: 8px;
}

/* Inline icon: an image sitting inside a sentence at text height. em units
   make it track the surrounding font size, so it stays right wherever it's
   used — body text, notes, list items, headings. */
.inline-icon {
  height: 1.5em;
  width: auto;
  vertical-align: -0.15em;
  background: #474d57;
  border-radius: 2px;

}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px; text-align: center; font-size: 14px; color: var(--text-dim);
}
.site-footer a { color: var(--accent); }

/* The drawer's own title bar (title + close button). Built by buildSidebar()
   in js/site.js and hidden on desktop, where the sidebar is a plain column. */
.drawer-head { display: none; }
.drawer-title { font-weight: 600; font-size: 16px; color: var(--text); }
.drawer-close {
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 34px; height: 34px;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 22px; line-height: 1; cursor: pointer;
}
.drawer-close:hover { border-color: var(--accent); color: var(--accent); }

/* Holds the nav links. On desktop it is just the link column; on mobile it
   becomes the only scrolling part of the drawer. */
.drawer-body { display: flex; flex-direction: column; gap: 2px; }

/* Dimmed backdrop behind the open drawer; tapping it closes the menu. */
.nav-scrim { display: none; }

/* Mobile: the sidebar becomes a self-contained slide-in drawer. It is
   full height and fixed to the viewport, so it depends on nothing else on
   the page — not the sticky header, not page padding. It carries its own
   title and close button, and scrolls independently. */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }

  /* The drawer shell: fixed to the viewport, clips its own content. It does
     NOT scroll — .drawer-body inside it does. Keeping "fixed panel" and
     "scrolling area" as two elements avoids the flex/overflow conflicts that
     come from making one element do both. */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    /* The desktop rule sets align-self:start for the sticky column. Left in
       place it makes this fixed panel shrink-wrap its content instead of
       stretching between top:0 and bottom:0 — the panel then grows past the
       viewport and nothing can ever scroll. */
    align-self: stretch;
    width: min(82vw, 320px);
    z-index: 90;
    display: flex; flex-direction: column; gap: 0;
    padding: 0;
    background: var(--panel);
    border-right: 1px solid var(--border);
    overflow: hidden;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 220ms ease, visibility 220ms;
  }
  body.nav-open .sidebar { transform: translateX(0); visibility: visible; }

  /* title bar: fixed height, never shrinks, stays above the scrolling links */
  .drawer-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex: 0 0 auto;
    padding: 12px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
  }

  /* the scrolling area. min-height:0 is required: a flex item defaults to
     min-height:auto, which refuses to shrink below its content and silently
     kills overflow scrolling. */
  .drawer-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0 24px;
  }

  .sidebar a { padding: 10px 16px; }        /* roomier tap targets */
  .sidebar .nav-group { padding: 0 16px; margin-top: 14px; }

  .nav-scrim {
    display: block;
    position: fixed; inset: 0; z-index: 80;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0; visibility: hidden;
    transition: opacity 220ms ease, visibility 220ms;
  }
  body.nav-open .nav-scrim { opacity: 1; visibility: visible; }

  body.nav-open { overflow: hidden; }       /* page behind the drawer holds still */

  .theme-toggle span { display: none; }     /* icon only — the label doesn't fit */
  .theme-toggle { padding: 6px 8px; }
}
