/* Page shell shared by every primelogiclab.io page: background, header, side menu, footer.
   Each page links this before its own <style> block, which then only styles its content.

   Layout is a grid on <body>, so pages need no wrapper element:
     header   - full width, sticky, its own slightly lighter background
     .sidebar - the site menu, which never moves while the page scrolls: a bordered panel fixed
                at the left edge (same look as the menus in our generated HTML docs), and at
                768px and below a row of links that sticks under the header
     main     - the page's content, left-aligned next to the menu, capped at 55rem; long-form pages
                narrow it further
     footer   - full width
   /assets/site-nav.js swaps only <main> (and the page's own <style>) when a link to another page is
   followed, so header and menu stay put. Without JavaScript every link is an ordinary page load.

   static-pages/ (the error pages) deliberately doesn't use this: nginx shows them when the site
   itself is failing or in maintenance, when /assets/ may not be reachable either. */

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #172033;
  --border: #334155;
  --panel: rgba(30, 41, 59, 0.55);
  --line: rgba(148, 163, 184, 0.14);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --faint: #64748b;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  --header-height: 4rem;
  --menu-width: 12rem;
  /* The brand gradient and display type, as on the Discord banners (discord/tools/render_assets.py).
     Those use Inter; the site doesn't download fonts, so this takes Inter if the reader has it and
     the platform's own UI face otherwise. */
  --brand-gradient: linear-gradient(135deg, #12ddef, #1ec6fe 45%, #7062ef);
  --font-display: "Inter", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-padding-top: calc(var(--header-height) + 1rem);   /* #anchors land below the sticky header */
}

body {
  font-family: sans-serif;
  margin: 0;
  color: var(--text);
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.5rem var(--menu-width) 2.5rem minmax(0, 1fr) 1.5rem;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header header header header header"
    ".      nav    .      main   .     "
    "footer footer footer footer footer";
  /* Two soft washes in the logo's own cyan/purple (sampled from logo-512.png: top #12ddef,
     bottom #7062ef), plus a large, faded copy of the logo top-right as texture. */
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 900px 700px at 6% -8%, rgba(18, 221, 239, 0.10), transparent 60%),
    radial-gradient(ellipse 900px 750px at 105% 110%, rgba(112, 98, 239, 0.14), transparent 60%),
    url('/assets/logo-watermark.png');
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-position: 0 0, 0 0, 100% 0%;
  background-size: auto, auto, 640px 640px;
  background-attachment: scroll, scroll, fixed;
}

/* --- Header --- */
header {
  grid-area: header;
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;   /* same gutter as the menu, so the logo lines up with it */
  background: rgba(30, 41, 59, 0.88);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 6px 20px -10px rgba(0, 0, 0, 0.6);
}
/* Brand: the gradient app tile (same style as the Discord server icon) and the gradient wordmark. */
header h1 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
header h1 a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}
header h1 img {
  width: 32px;
  height: 32px;
  display: block;
  flex: none;
  filter: drop-shadow(0 2px 8px rgba(30, 198, 254, 0.25));
}
header h1 span {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 0.08em;   /* keeps the "g" descender inside the clipped gradient */
}

/* Page titles use the same display type as the wordmark. */
.hero-title,
.doc-title {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Sign in / Account, switched by /assets/auth-nav.js (SIGN-IN-PLAN.md §3). */
header nav a.auth-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid rgba(56, 189, 248, 0.6);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
header nav a.auth-link:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* --- Side menu ---
   Fixed to the window, so it never moves while the page scrolls; the grid's menu column stays
   empty to keep the content clear of it. A menu taller than the window scrolls on its own. */
.sidebar {
  position: fixed;
  z-index: 5;
  top: calc(var(--header-height) + 2.5rem);
  left: 1.5rem;
  width: var(--menu-width);
  max-height: calc(100vh - var(--header-height) - 4rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.sidebar::before {
  content: "Menu";
  content: "Menu" / "";   /* decorative: the <nav> already has an aria-label */
  margin: 0.2rem 0.5rem 0.45rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
}
.sidebar a {
  display: block;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.sidebar a:hover {
  color: var(--text);
  background: var(--surface-2);
}
/* aria-current="page" on the page's own link, "true" on its section (Golf App on the golf
   policy pages). site-nav.js moves it when it swaps the content. */
.sidebar a[aria-current] {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
/* A section (<div class="menu-section">: Applications, Software) is the section's own link
   followed by its pages (class="sub"), indented on a thin guide line. Only the open page is
   marked, not the section as well. */
.sidebar .menu-section {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.sidebar a.sub {
  margin-left: 0.85rem;
  padding: 0.35rem 0.7rem;
  border-left: 1px solid var(--border);
  border-radius: 0 6px 6px 0;
  font-size: 0.88rem;
}

/* --- Cards whose title is a link: the whole card is clickable ---
   The title link's ::after is stretched over the card, so there's still exactly one real link
   (keyboard, screen readers, middle-click and "open in new tab" all work as normal) but the hand
   pointer and the click cover the whole card. Any other link inside a card is lifted above the
   overlay so it stays clickable. Cards without a title link are untouched. */
:is(.card, .project-card, .feature-card):has(h4 a) {
  position: relative;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
:is(.card, .project-card, .feature-card) h4 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
:is(.card, .project-card, .feature-card) a:not(h4 a) {
  position: relative;
  z-index: 1;
}
:is(.card, .project-card, .feature-card):has(h4 a):hover {
  border-color: var(--accent);
  background: rgba(30, 41, 59, 0.85);
}
:is(.card, .project-card, .feature-card) h4 a:focus-visible {
  outline: none;
}
:is(.card, .project-card, .feature-card):has(h4 a:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Content and footer --- */
main {
  grid-area: main;
  min-width: 0;
  max-width: 55rem;
  padding: 2.5rem 0 4rem;
}
main:focus {
  outline: none;   /* site-nav.js focuses <main> after a swap, for screen readers */
}
/* Played by site-nav.js on the new content after a swap. */
main.page-enter {
  animation: page-enter 0.18s ease-out;
}
@keyframes page-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  main.page-enter { animation: none; }
}
/* While a slow page is loading. */
html.is-loading main {
  opacity: 0.55;
  transition: opacity 0.2s ease 0.15s;
}

footer {
  grid-area: footer;
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  color: var(--faint);
  font-size: 0.8rem;
}
footer a {
  color: var(--muted);
}

/* --- Tablet and down: the menu becomes one row of links that stays under the header ---
   Same background as the header, so the two read as one bar; the row scrolls sideways if the
   links don't fit (site-nav.js keeps the current one in view). */
@media (max-width: 768px) {
  html {
    scroll-padding-top: calc(var(--header-height) + 4rem);
  }
  body {
    grid-template-columns: 1.5rem minmax(0, 1fr) 1.5rem;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
      "header header header"
      "nav    nav    nav   "
      ".      main   .     "
      "footer footer footer";
  }
  header {
    box-shadow: none;
  }
  .sidebar {
    grid-area: nav;
    position: sticky;
    z-index: 9;
    top: var(--header-height);
    left: auto;
    width: auto;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.25rem;
    padding: 0.4rem 1.5rem 0.55rem;
    background: rgba(30, 41, 59, 0.88);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    border: 0;
    border-radius: 0;
    box-shadow: 0 6px 20px -10px rgba(0, 0, 0, 0.6);
  }
  .sidebar::-webkit-scrollbar {
    display: none;
  }
  .sidebar::before {
    display: none;
  }
  .sidebar a {
    flex: none;
    padding: 0.4rem 0.75rem;
    white-space: nowrap;
  }
  /* In the one-row menu a section's pages show only while you're in that section (its section
     page links to them all), so the row doesn't fill up with every app and tool. */
  .sidebar .menu-section {
    display: contents;
  }
  .sidebar .menu-section:not(:has(a[aria-current])) a.sub {
    display: none;
  }
  .sidebar a.sub {
    margin-left: 0;
    padding: 0.4rem 0.75rem;
    border-left: 0;
    border-radius: 6px;
    font-size: 0.95rem;
  }
  main {
    padding: 1.75rem 0 3rem;
  }
}

/* --- Phones --- */
@media (max-width: 480px) {
  body {
    grid-template-columns: 1rem minmax(0, 1fr) 1rem;
  }
  /* The header must stay one line high: the menu row sticks right under it at 4rem. */
  header {
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }
  header h1 {
    font-size: 1.05rem;
  }
  header h1 a {
    gap: 0.5rem;
  }
  header nav a.auth-link {
    font-size: 0.85rem;
    padding: 0.3rem 0.75rem;
  }
  .sidebar {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  main {
    padding: 1.5rem 0 2.5rem;
  }
  footer {
    font-size: 0.85rem;
  }
}
