/* polygonals.com — a customised copy of the stylesheet.org framework.
 *
 * Same structure and class contract as https://stylesheet.org/stylesheet.css
 * (reset / theme tokens / layout / elements / components), reskinned into the
 * polygonals brand: a DEEP PURPLE field lit by a single PHOSPHOR-GREEN accent,
 * taken straight from the wordmark (#130033 ground, #11fa9c ink). Dark, glowing,
 * a little neon — built to sit behind moving artwork.
 *
 * This is a *copy* on purpose — it diverges from the upstream framework. Only
 * section 2 (tokens) and the dark-surface element rules change in spirit; the
 * layout and component contracts are identical, so markup is portable.
 */

/* ============================================================
   1. RESET  (unchanged from the framework)
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); }
body { min-height: 100vh; overflow-x: hidden; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg, video { max-width: 100%; height: auto; display: block; }

/* ============================================================
   2. THEME TOKENS  — the polygonals purple/green theme
   ============================================================ */
:root {
  /* colour — deep purple ground, phosphor-green ink */
  --bg: #130033;               /* brand purple — the page ground */
  --bg-2: #0a001e;             /* deepest purple, near black */
  --surface: #1d0a4a;          /* raised purple panel */
  --surface-soft: #271263;     /* nested / soft fill */
  --section-bg: #170540;       /* section band */
  --band: #170540;
  --pad: 28px;                 /* content side padding */
  --header-bg: rgba(13, 0, 34, 0.72);   /* glassy dark purple bar */
  --header-bg-2: #1a0744;
  --fg: #e9e2ff;               /* soft lavender-white text */
  --heading: #ffffff;
  --muted: #a99adf;            /* muted lavender */
  --border: #341a6e;           /* violet edge */
  --border-strong: #4d2b9c;
  --accent: #11fa9c;           /* phosphor green — links, focus, the wordmark */
  --accent-hover: #6effc1;
  --accent-fg: #04241a;        /* near-black green for text on a green key */
  --accent-tint: rgba(17, 250, 156, 0.14);
  --accent-2: #a779ff;         /* violet secondary accent */
  --accent-2-tint: rgba(167, 121, 255, 0.16);
  --code-bg: #0c0124;
  --code-fg: #c7f8e4;
  --ok-fg: #5cffbd; --ok-bg: rgba(17,250,156,0.12); --ok-bd: #1c7a55;
  --err-fg: #ff9bb0; --err-bg: rgba(190,40,80,0.16); --err-bd: #7a3048;
  --info-fg: #b9a6ff; --info-bg: rgba(120,90,220,0.16); --info-bd: #4d3a96;
  --warn-fg: #ffd27a; --warn-bg: rgba(180,130,30,0.14); --warn-bd: #7a5d20;
  /* type */
  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-brand: 'Comfortaa', var(--font);   /* rounded geometric — the wordmark */
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  /* space + shape */
  --space: 18px;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --maxw: 1100px;
  --header-h: 70px;            /* approx sticky-header height (brand 44 + 12+12 pad + 1 border) */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.45), 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 10px 24px -8px rgba(0,0,0,0.7), 0 2px 8px -3px rgba(0,0,0,0.5);
  --shadow-lg: 0 30px 60px -20px rgba(0,0,0,0.85);
  --glow: 0 0 24px rgba(17,250,156,0.35);
  --glow-soft: 0 0 14px rgba(17,250,156,0.22);
}

/* ============================================================
   3. LAYOUT  — structure only (unchanged from the framework)
   ============================================================ */
.row, .column { display: flex; gap: var(--space); }
.row { flex-direction: row; }
.column { flex-direction: column; }
.row > *, .column > * { flex: 0 0 auto; min-width: 0; min-height: 0; }
.stretch { flex: 1 1 0; min-width: 0; min-height: 0; }
.stretch-2 { flex-grow: 2; }
.stretch-3 { flex-grow: 3; }
.grid { display: grid; gap: var(--space); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.flow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
@media (max-width: 860px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

/* ============================================================
   4. ELEMENTS  — semantic tags, dark purple surfaces
   ============================================================ */
body {
  background:
    radial-gradient(120% 70% at 50% -8%, #220a52 0%, transparent 60%),
    radial-gradient(90% 90% at 50% 120%, #1a0640 0%, var(--bg-2) 90%),
    var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
}

/* typography */
h1, h2, h3, h4, h5, h6 { color: var(--heading); font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; letter-spacing: -0.01em; }
h4 { font-size: 1.02rem; letter-spacing: 0; }
h5, h6 { font-size: 0.9rem; letter-spacing: 0; }
a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
strong { font-weight: 650; color: var(--heading); }
small { color: var(--muted); font-size: 0.875em; }
ul, ol { padding-left: 1.4em; }
li { margin: 5px 0; }
li::marker { color: var(--accent); }
hr { border: none; border-top: 1px solid var(--border); }
code { font-family: var(--mono); font-size: 0.88em; background: var(--code-bg); border: 1px solid var(--border); padding: 0.1em 0.4em; border-radius: 6px; color: var(--code-fg); }
pre { background: var(--code-bg); color: var(--code-fg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; overflow-x: auto; box-shadow: var(--shadow-sm); font-size: 0.85rem; line-height: 1.6; }
pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
blockquote { padding: 10px 18px; border-left: 3px solid var(--accent); background: var(--accent-tint); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--fg); }

/* header: a glassy dark-purple bar, sticky, a thin green underglow */
header {
  position: sticky; top: 0; z-index: 30;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid rgba(17,250,156,0.18);
  box-shadow: 0 2px 24px rgba(0,0,0,0.5), 0 1px 0 rgba(17,250,156,0.10) inset;
}
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
nav > a, nav > span { font-weight: 700; color: var(--heading); letter-spacing: -0.01em; }
nav > a:hover { text-decoration: none; }
nav > ul { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; }
nav > ul > li { margin: 0; }
nav ul a { display: block; padding: 7px 14px; border-radius: var(--radius-pill); white-space: nowrap; color: var(--fg); font-size: 0.95rem; font-weight: 500; text-decoration: none; transition: background 0.15s, color 0.15s, box-shadow 0.2s; }
nav ul a:hover { background: var(--accent-tint); color: var(--accent-hover); text-decoration: none; }
nav a[aria-current] { background: var(--accent); color: var(--accent-fg); font-weight: 650; box-shadow: var(--glow-soft); }
nav a[aria-current]:hover { background: var(--accent); color: var(--accent-fg); }
header > nav { padding: 12px 28px; }
header > nav:first-of-type > a.brand { display: inline-flex; align-items: center; gap: 11px; font-family: var(--font-brand); font-weight: 700; font-size: 1.45rem; letter-spacing: -0.01em; line-height: 1; color: var(--accent); }
header > nav:first-of-type > a.brand:hover { color: var(--accent-hover); }
header > nav:first-of-type > a.brand svg { width: 44px; height: 44px; display: block; filter: drop-shadow(0 0 6px rgba(17,250,156,0.5)); }
header > nav:first-of-type > ul { margin-left: auto; }

/* nav dropdowns (no JS) — dark violet cards */
nav li { position: relative; }
nav li > ul, nav details > ul {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 210px; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
nav li > ul li, nav details > ul li { margin: 0; }
nav li > ul { visibility: hidden; opacity: 0; transform: translateY(-4px); transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s; }
nav li:hover > ul, nav li:focus-within > ul { visibility: visible; opacity: 1; transform: none; }

/* main: a centred column over the purple field */
main {
  flex: 1 0 auto;
  width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 44px var(--pad) 0;
  display: flex; flex-direction: column; gap: 0;
}
main > :not(section) + :not(section) { margin-top: 24px; }
main > h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -0.025em; line-height: 1.12; }
main > h1 + p { max-width: 72ch; font-size: 1.15rem; color: var(--muted); }
main > ul { padding-left: 1.3em; max-width: 70ch; }
main > ul > li { margin: 0 0 18px; }
main > ul > li:last-child { margin-bottom: 0; }
main > ul > li > strong { font-size: 1.05rem; }
main > ul > li > p { margin-top: 4px; color: var(--muted); }

/* sections: full-width purple bands; the content stays centred */
section { display: flex; flex-direction: column; gap: 16px; }
main > section {
  position: relative;
  margin: 0 calc(var(--pad) * -1); padding: 54px var(--pad);
  background: var(--section-bg); box-shadow: 0 0 0 100vw var(--section-bg); clip-path: inset(0 -100vw);
  border-top: 1px solid var(--border);
}
main > section > * { width: 100%; max-width: var(--maxw); margin-inline: auto; }
main > section:nth-of-type(even) { background: #14043a; box-shadow: 0 0 0 100vw #14043a; }
main > section > h2 { padding-bottom: 8px; border-bottom: 1px solid var(--border-strong); display: inline-block; }
section section { gap: 12px; }
section section section { gap: 9px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
caption { text-align: left; padding: 8px 0; font-weight: 600; color: var(--muted); }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); }
thead th { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--border-strong); }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--accent-tint); }
tbody tr:last-child td { border-bottom: none; }

/* forms */
form { display: grid; gap: 15px; }
fieldset { padding: 16px; display: grid; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
legend { font-weight: 600; padding: 0 6px; color: var(--heading); }
label > p { font-weight: 550; font-size: 0.9rem; margin-bottom: 6px; color: var(--heading); }
input, select, textarea { width: 100%; padding: 9px 12px; font: inherit; color: var(--fg); background: var(--code-bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); transition: border-color 0.15s, box-shadow 0.15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint), var(--glow-soft); }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; margin-right: 7px; accent-color: var(--accent); }

/* buttons: primary = a glowing green key; never resizes — hover adds glow */
button, input[type="submit"], input[type="reset"], input[type="button"], a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: auto; padding: 9px 18px; font: inherit; font-weight: 650; line-height: 1.4;
  cursor: pointer; text-align: center; text-decoration: none;
  background: var(--accent); color: var(--accent-fg);
  border: 1px solid var(--accent); border-radius: var(--radius-pill);
  box-shadow: var(--glow-soft); transition: box-shadow 0.18s, filter 0.15s, transform 0.1s, background 0.15s;
}
button:hover, input[type="submit"]:hover, input[type="button"]:hover, a.button:hover {
  background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg);
  box-shadow: var(--glow); text-decoration: none; transform: translateY(-1px);
}
button:focus-visible, a.button:focus-visible, input[type="submit"]:focus-visible, input[type="button"]:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--accent-tint), var(--glow);
}
button:active, a.button:active { transform: translateY(0); filter: brightness(0.95); }
/* secondary = a ghosted violet key */
.button.secondary, input[type="reset"], button.secondary {
  background: transparent; color: var(--fg); border-color: var(--border-strong); box-shadow: none;
}
.button.secondary:hover, input[type="reset"]:hover, button.secondary:hover {
  background: var(--accent-tint); color: var(--accent-hover); border-color: var(--accent); box-shadow: var(--glow-soft);
}
.button.ghost, button.ghost { background: transparent; color: var(--accent); border-color: transparent; box-shadow: none; }
.button.ghost:hover, button.ghost:hover { background: var(--accent-tint); color: var(--accent-hover); transform: none; }
.button.small, button.small { padding: 5px 13px; font-size: 0.9rem; }
.button.large, button.large { padding: 13px 26px; font-size: 1.05rem; }

/* menu: a sidebar nav on a dark plate */
menu { display: block; margin: 0; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
menu ol, menu ul { list-style: none; margin: 0; padding: 0; }
menu li { margin: 2px 0; }
menu p { margin: 12px 8px 4px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
menu a { display: block; padding: 7px 12px; color: var(--fg); border-radius: 8px; transition: background 0.15s; }
menu a:hover { background: var(--surface-soft); text-decoration: none; }
menu a[aria-current] { background: var(--accent-tint); color: var(--accent-hover); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }

/* ============================================================
   5. COMPONENTS
   ============================================================ */
/* panel — a soft purple surface; card — a liftable unit */
.panel, .card { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.panel .panel, .card .card, .panel .card, .card .panel { background: var(--surface-soft); box-shadow: none; }
.card { transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.12s ease; }
a.card { color: inherit; }
a.card:hover, .grid > a.card:hover { text-decoration: none; box-shadow: var(--shadow-md), var(--glow-soft); border-color: var(--accent); transform: translateY(-2px); }
.card > h2, .card > h3 { color: var(--heading); }

/* card-link — a link at a card's foot that makes the whole card clickable */
.card-link { display: inline-block; align-self: flex-start; margin-top: 6px; font-weight: 600; color: var(--accent); }
.card:has(> .card-link) { position: relative; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card:has(> .card-link):hover { box-shadow: var(--shadow-md), var(--glow-soft); border-color: var(--accent); transform: translateY(-2px); }
.card:has(> .card-link) a:not(.card-link) { position: relative; z-index: 1; }

/* chip — an inline pill; .accent lights up green, .teal uses the violet 2nd accent */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; font-size: 0.85rem; font-weight: 600; line-height: 1.5; color: var(--fg); background: var(--surface-soft); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); }
button.chip, a.chip { cursor: pointer; text-decoration: none; transition: filter 0.15s, border-color 0.15s, color 0.15s, background 0.15s; }
button.chip:hover, a.chip:hover { border-color: var(--accent); color: var(--accent-hover); background: var(--accent-tint); text-decoration: none; }
.chip.accent { color: var(--accent); border-color: rgba(17,250,156,0.4); background: var(--accent-tint); }
.chip.teal { color: var(--accent-2); border-color: rgba(167,121,255,0.4); background: var(--accent-2-tint); }

/* buttons — a group of actions */
.buttons { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* status — a lit banner */
.status { display: block; position: relative; padding: 11px 15px 11px 34px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-weight: 500; background: var(--surface); }
.status::before { content: ""; position: absolute; left: 15px; top: 1.05em; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.status.success { color: var(--ok-fg); border-color: var(--ok-bd); background: var(--ok-bg); }
.status.error   { color: var(--err-fg); border-color: var(--err-bd); background: var(--err-bg); }
.status.info    { color: var(--info-fg); border-color: var(--info-bd); background: var(--info-bg); }
.status.warning { color: var(--warn-fg); border-color: var(--warn-bd); background: var(--warn-bg); }

/* paging */
.paging { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.paging a, .paging span { display: inline-block; padding: 7px 13px; border-radius: 8px; color: var(--fg); text-decoration: none; }
.paging a:hover { background: var(--surface); box-shadow: var(--shadow-sm); text-decoration: none; }
.paging a[aria-current] { background: var(--accent); color: var(--accent-fg); }
.paging span { color: var(--muted); }

/* footer — a quiet dark-purple base plate */
footer { flex-shrink: 0; background: var(--bg-2); border-top: 1px solid var(--border); color: var(--muted); }
footer > .row { width: 100%; max-width: var(--maxw); margin-inline: auto; padding: 24px var(--pad); align-items: center; flex-wrap: wrap; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { color: var(--accent-hover); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.06s !important; scroll-behavior: auto !important; }
}
