/* ===== Base component styles this site needs that aren't in the shared stylesheet
   (icon size, menu, chip, tooltip). Don't add page styles here. ===== */
svg.icon { width: 24px; height: 24px; flex-shrink: 0; fill: currentColor; overflow: hidden; }

.pfy-menu-panel { overflow: auto; box-sizing: border-box; background-color: var(--white);
  border-radius: var(--border-radius-double); box-shadow: var(--dropdown-shadow);
  min-width: 120px; max-height: calc(100vh - 64px); }
.pfy-menu-panel .pfy-menu-content { padding: 8px 0; margin: 0; list-style: none; }
.pfy-menu-item { cursor: pointer; border: 0; user-select: none; display: flex; position: relative;
  align-items: center; justify-content: flex-start; overflow: hidden; width: 100%; text-align: left;
  box-sizing: border-box; color: inherit; font-size: var(--text-lg); background: none;
  text-decoration: none; margin: 0; height: 40px; padding: 0 16px; }
.pfy-menu-item > .icon { width: 20px; height: 20px; flex-shrink: 0; margin-right: 12px; color: var(--color-quiet); }
.pfy-menu-item > .icon.trailing { margin-right: 0; margin-left: auto; }
.pfy-menu-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfy-menu-item:hover { background-color: var(--n1-transp); text-decoration: none; color: inherit; }
.pfy-menu-item:active, .pfy-menu-item.pfy-active { background-color: var(--n2-transp); }
.pfy-menu-item:disabled, .pfy-menu-item.disabled { opacity: .6; pointer-events: none; }

.pfy-chip { --bg: var(--label-bg-color); --fg: var(--label-text-color); --border-radius: var(--border-radius-base);
  --font-size: var(--text-sm); --height: 28px; --icon-size: 16px; --action-x-padding: 6px;
  background: var(--bg); color: var(--fg); border-radius: var(--border-radius); font-size: var(--font-size);
  position: relative; display: inline-flex; align-items: center; height: var(--height); }
.pfy-chip.pfy-chip-pill { --border-radius: 500rem; }
.pfy-chip.pfy-chip-grey { --bg: var(--n2-transp); --fg: var(--n7-transp); }
.pfy-chip.pfy-chip-green { --bg: var(--g1); --fg: var(--g3); }
.pfy-chip.pfy-chip-red { --bg: var(--r1); --fg: var(--r4); }
.pfy-chip.pfy-chip-yellow { --bg: var(--y1); --fg: var(--y3); }
.pfy-chip.pfy-chip-disabled { opacity: .5; pointer-events: none; }
.pfy-chip .pfy-chip-action { display: inline-flex; align-items: center; height: 100%; cursor: pointer; white-space: nowrap; }
.pfy-chip .pfy-chip-action--presentational { cursor: default; }
.pfy-chip .pfy-chip-action--primary { padding-left: 12px; padding-right: 12px; }
.pfy-chip--with-trailing-action .pfy-chip-action--primary { padding-right: 0; }
.pfy-chip--with-trailing-action .pfy-chip-action--trailing { padding: var(--action-x-padding); }
.pfy-chip .pfy-chip-remove { position: relative; border-radius: var(--border-radius); background: none; border: 0; color: inherit; }
.pfy-chip .pfy-chip-remove .icon { width: var(--icon-size); height: var(--icon-size); opacity: .6; }
.pfy-chip .pfy-chip-remove:hover .icon { opacity: 1; }

/* Tooltip, label and native dialog: the same CSS as the snippets on the Presentation page. */
.tooltip {
  position: fixed;
  inset: auto; /* the script sets left and top */
  z-index: 1000;
  margin: 0;
  border: 0;
  overflow: visible;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 250px;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: var(--border-radius-base);
  background: var(--tooltip-color);
  color: hsl(0 0% 100%);
  font-size: var(--text-md);
  line-height: 20px;
  text-shadow: var(--text-shadow);
  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.15);
}
.tooltip kbd {
  border-bottom: 0;
  background: hsl(0 0% 100% / 0.15);
  color: inherit;
  text-shadow: none;
}
.label {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--border-radius-base);
  background: var(--label-bg-color);
  color: var(--label-text-color);
  font-size: var(--text-sm);
  line-height: 16px;
  white-space: nowrap;
}
.label:has(.label-remove) {
  padding-right: 0;
}
.label-remove {
  display: inline-flex;
  padding: 6px;
  border: 0;
  border-radius: var(--border-radius-base);
  background: none;
  color: inherit;
  cursor: pointer;
}
.label-remove:focus {
  outline: none;
}
.label-remove:focus-visible {
  box-shadow: 0 0 0 2px var(--focus-outline-color); /* same as .btn.borderless */
}
.label-remove .icon {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}
.label-remove:hover .icon {
  opacity: 1;
}
/* Native <dialog> with the .custom-dialog card style */
dialog.custom-dialog {
  width: 500px; /* 500px by default; 650px or 800px for more content */
  max-width: calc(100% - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  overflow: auto;
}
/* Column layout, so the middle of the dialog scrolls between the title and the buttons */
dialog.custom-dialog[open] {
  display: flex;
  flex-direction: column;
}
/* The Pathify stylesheet sets dialog { display: block }, which shows closed dialogs */
dialog.custom-dialog:not([open]) {
  display: none;
}
dialog.custom-dialog::backdrop {
  background: var(--modal-overlay-color);
}
/* ===== PROTOTYPE-SHIM-END ===== */

/* ===== Slider — the same CSS as the snippet on the Forms page. ===== */
input[type="range"][slider] {
  --value: 0%; /* how much of the track is filled; set by the script below */
  --height: 20px;
  --track-height: 4px;
  --thumb-size: 24px; /* touch target */
  --knob-size: calc(var(--thumb-size) * 0.65); /* visible white knob */
  --overhang: calc((var(--thumb-size) - var(--knob-size)) / 2);
  width: 100%;
  height: var(--height);
  margin-left: calc(var(--overhang) * -1);
  margin-right: calc(var(--overhang) * -1);
  position: relative;
  appearance: none;
  outline: none;
  background: transparent;
}
/* Track (Chrome, Safari, Edge) */
input[type="range"][slider]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: var(--overhang);
  width: calc(100% - var(--overhang) * 2);
  height: var(--track-height);
  translate: 0 -50%;
  border-radius: 999rem;
  background: linear-gradient(90deg, var(--input-color) var(--value), var(--n2-transp) var(--value), var(--n2-transp) 100%);
}
input[type="range"][slider]::-webkit-slider-runnable-track {
  height: var(--track-height);
}
/* Track (Firefox) */
input[type="range"][slider]::-moz-range-track {
  height: var(--track-height);
  margin-left: var(--overhang);
  margin-right: var(--overhang);
  border-radius: 999rem;
  background: linear-gradient(90deg, var(--input-color) var(--value), var(--n2-transp) var(--value), var(--n2-transp) 100%);
}
/* Thumb: a large touch target that draws a smaller white knob with a shadow */
input[type="range"][slider]::-webkit-slider-thumb {
  position: relative;
  width: var(--thumb-size);
  height: var(--thumb-size);
  margin-top: calc((var(--track-height) / 2) + (var(--thumb-size) / 2) * -1);
  appearance: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 50%, white 0%, white 46%, rgba(0, 0, 0, 0.08) 49%, transparent 58%),
    radial-gradient(circle at 50% 58%, rgba(0, 0, 0, 0.17) 0%, transparent 59%);
}
input[type="range"][slider]::-moz-range-thumb {
  position: relative;
  left: calc(var(--thumb-size) / 4);
  width: var(--thumb-size);
  height: var(--thumb-size);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 50%, white 0%, white 46%, rgba(0, 0, 0, 0.08) 49%, transparent 58%),
    radial-gradient(circle at 50% 58%, rgba(0, 0, 0, 0.17) 0%, transparent 59%);
}
input[type="range"][slider]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 2px var(--focus-outline-color);
}
input[type="range"][slider]:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 2px var(--focus-outline-color);
}
/* ===== SLIDER-END ===== */


/* ===== Styleguide site — shared custom CSS. Only what utilities can't express; CSS variables only. ===== */

/* Inline code / class names: Figma sm|md|lg mono text styles (Roboto Mono Medium) — main.css only sets a generic monospace */
code { font-family: "Roboto Mono", monospace; font-weight: 500; }
/* Inline code: subtle chip. Not inside <pre> — snippet blocks have their own background */
:not(pre) > code { background: var(--n1-transp); border-radius: 6px; padding: 0 0.2em;
  border: var(--border-width-base) solid var(--border-color-base); }

/* Code snippets: Figma "code/*" variables (Styleguide file), light + dark mode values.
   Token spans are added by site.js; plain text in a snippet uses --code-content. */
:root, .force-light-theme {
  --code-brackets: hsl(278.4 50% 52.2%);
  --code-tag: hsl(314.9 89.9% 35.1%);
  --code-attributes: hsl(220.6 53% 50.8%);
  --code-string: hsl(1.1 44.1% 50.2%);
  --code-content: hsl(246 13.3% 29.4%);
}
.dark-theme {
  --code-brackets: hsl(278.6 100% 72%);
  --code-tag: hsl(314.9 100% 66.9%);
  --code-attributes: hsl(201.7 100% 67.5%);
  --code-string: hsl(32.4 100% 68.4%);
  --code-content: hsl(0 0% 100%);
}
pre > code { color: var(--code-content); }
.sg-code-brackets { color: var(--code-brackets); }
.sg-code-tag { color: var(--code-tag); }
.sg-code-attributes { color: var(--code-attributes); }
.sg-code-string { color: var(--code-string); }

/* Tables: columns with long descriptions (class on the header cell) don't get squeezed on phones;
   the table scrolls sideways in .table-responsive instead. No min-width utility besides minw-0. */
.sg-col-text { min-width: 180px; }

/* --- Shell --- */
/* Page = 220px sidebar + 1000px main, centered (matches the live site) */
.sg-layout { max-width: 1220px; }
.sg-aside { width: 220px; max-height: 100vh; }
/* xl: "On This Page" panel on the right, so the page grows by its width */
.sg-toc { width: 220px; max-height: 100vh; }
.sg-toc .btn { max-width: 100%; } /* links size to their label, but never wider than the panel (no utility) */
@media (min-width: 1180px) { .sg-layout { max-width: 1440px; } }

/* Mobile header: translucent page background + blur (Figma "bg-header"); .bg-backdrop-blur is a dark overlay */
.sg-header { background-color: color-mix(in srgb, var(--bg-color-base) 70%, transparent); backdrop-filter: blur(10px); }

/* Nav item radius 12px (between Rounded and Rounded Double — no class) */
.sg-nav-link { border-radius: calc(var(--border-radius-base) * 1.5); }

/* Mobile navigation drawer (native <dialog>; slide/fade animation in site.js) */
.sg-drawer { margin: 0 0 0 auto; padding: 0; border: 0; width: 260px; max-width: 100vw; height: 100vh; max-height: 100vh;
  color: inherit; border-radius: calc(var(--border-radius-base) * 3) 0 0 calc(var(--border-radius-base) * 3); }
.sg-drawer:not([open]) { display: none; } /* main.css normalize sets dialog { display: block } */
.sg-drawer::backdrop { background-color: var(--n3-transp); }

/* "On this page" quick links: smooth scroll, and land headings below the sticky mobile header
   (72px) / with the section padding still visible */
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
main h2[id] { scroll-margin-top: 112px; }
@media (min-width: 880px) { main h2[id] { scroll-margin-top: 64px; } }

/* Hero: Figma artwork + literal white text (no .text-white: it adds a text shadow the design doesn't have) */
/* letter-spacing: Figma header styles (and the live site) use 0; main.css sets 0.2px globally, which wraps long subtitles */
.sg-hero { background-image: url(hero.png); background-color: var(--icon-brand); color: hsl(0 0% 100%); --letter-spacing-base: normal; }
.sg-hero-title { font-family: "Prompt", var(--font-family-base); }

/* Overview link cards: hover state (no utility for hover shadows/colors) */
.sg-link-card { transition: box-shadow .15s ease; }
@media (min-width: 680px) { .sg-link-card { min-height: 220px; } } /* Figma: fixed 220px tall in the 2-column grid */
.sg-link-card:hover { box-shadow: var(--card-shadow-lg); }
.sg-link-card:hover .sg-link-title { color: var(--text-brand); }
.sg-link-arrow { opacity: .3; transition: opacity .15s ease, transform .15s ease; }
.sg-link-card:hover .sg-link-arrow { opacity: 1; color: var(--icon-brand); transform: translateX(4px); }

/* Category tile colors — decorative, from Figma (unbound values, not theme tokens) */
.sg-tile { background: var(--tile-bg); color: var(--tile-fg); }
.sg-tile-layout { --tile-bg: hsl(230 100% 94%); --tile-fg: hsl(230 68% 54%); }
.sg-tile-text { --tile-bg: hsl(280 100% 94%); --tile-fg: hsl(284 100% 51%); }
.sg-tile-colors { --tile-bg: hsl(194 69% 94%); --tile-fg: hsl(204 100% 34%); }
.sg-tile-responsiveness { --tile-bg: hsl(329 100% 94%); --tile-fg: hsl(312 100% 44%); }
.sg-tile-buttons { --tile-bg: hsl(263 100% 94%); --tile-fg: hsl(262 100% 62%); }
.sg-tile-forms { --tile-bg: hsl(30 100% 93%); --tile-fg: hsl(17 77% 53%); }
.sg-tile-feedback { --tile-bg: hsl(48 100% 90%); --tile-fg: hsl(36 100% 36%); }
.sg-tile-icons { --tile-bg: hsl(91 65% 90%); --tile-fg: hsl(176 100% 27%); }
.sg-tile-presentation { --tile-bg: hsl(219 100% 94%); --tile-fg: hsl(249 100% 61%); }
.sg-tile-examples { --tile-bg: hsl(350 100% 94%); --tile-fg: hsl(350 75% 48%); }
/* Dark mode: derive a dim tile and a lighter icon from each tile's own color */
.dark-theme .sg-tile { background: color-mix(in srgb, var(--tile-fg) 22%, transparent); color: color-mix(in srgb, var(--tile-fg) 55%, white); }

/* Icons page: icon library grid (tiles at least 112px wide, as many columns as fit). */
.sg-icon-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }

/* Forms page: date input. The same CSS as the snippet on the page. */
/* Hide the browser's own calendar icon (Chrome, Edge, Safari) */
input[type="date"]::-webkit-calendar-picker-indicator {
  display: none;
}

/* Example card: collapsible code under an example (<details class="sg-code">) */
.sg-code > summary { list-style: none; }
.sg-code > summary::-webkit-details-marker { display: none; }
.sg-code-hide, .sg-code[open] .sg-code-show { display: none; }
.sg-code[open] .sg-code-hide { display: inline; }
.sg-code[open] .sg-code-chevron { rotate: 180deg; }
@media (prefers-reduced-motion: no-preference) { .sg-code-chevron { transition: rotate 0.2s; } }
