/* ========================================================================
   modern-design.md — shared landing-page styles
   Loaded by showcase/index.html and (intentionally) not by per-site
   sample pages, which keep their own design system in style.css.
   ======================================================================== */

:root {
  --bg-base: #0a0a0b;
  --bg-elevated: #141416;
  --bg-overlay: rgba(255, 255, 255, 0.04);
  --bg-modal: #0e0e10;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #f5f5f7;
  --text-secondary: #b8b8c0;
  --text-muted: #9b9ba3;
  --accent: #d63b1a;
  --accent-bright: #ff5b3a;
  --accent-soft: rgba(214, 59, 26, 0.16);
  --accent-hover: #b82f12;
  --code-bg: #1c1c20;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --max-content: 1280px;
  --pad-gutter: clamp(20px, 4vw, 48px);
}

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

html {
  scroll-behavior: smooth;
}

/* Skip link — visible on focus only */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 200;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 16px;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

main:focus {
  outline: none;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent);
}

img,
svg {
  max-width: 100%;
  display: block;
}

/* ----- Layout ----- */

.container {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 var(--pad-gutter);
}

/* ----- Header ----- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 11, 0.85);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.site-brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent-bright);
  box-shadow: 0 0 16px var(--accent-soft);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

.site-nav a {
  color: var(--text-secondary);
}

.site-nav a:hover {
  color: var(--text-primary);
}

/* ----- Hero ----- */

.hero {
  padding: clamp(64px, 12vw, 128px) 0 clamp(48px, 8vw, 96px);
  border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.hero-eyebrow::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-bright);
}

.hero h1 {
  font-size: clamp(40px, 7vw, 80px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.02;
  max-width: 14ch;
  margin-bottom: 24px;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero-lede {
  font-size: clamp(17px, 2vw, 20px);
  color: var(--text-secondary);
  max-width: 64ch;
  margin-bottom: 40px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 48px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 32px;
}

.hero-stats > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-stats strong {
  display: block;
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-family: var(--font-sans);
  line-height: 1.1;
}

.hero-stats .stat-label {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* ----- Filter ----- */

.filter {
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  max-height: 96px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.filter-row::-webkit-scrollbar {
  width: 6px;
}

.filter-row::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

.filter-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 8px;
}

.filter-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.filter-chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ----- Card grid ----- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 32px 0 80px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  min-height: 240px;
  transition: border-color 0.2s ease, transform 0.2s ease,
    background 0.2s ease;
}

/* Touch target: at least 44×44 hit area for every interactive element.
   Achieved by padding so the visible button stays compact but the
   tap target is large. WCAG 2.5.5 (AAA). */
.card-link,
.card-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  transition: all 0.18s ease;
}

.filter-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 12px 14px;
  min-height: 44px;
  border-radius: 999px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
}

.filter-search input {
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text-primary);
  font: inherit;
  width: 180px;
  min-height: 44px;
  padding: 10px 4px;
}

.filter-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  min-height: 44px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.site-nav a,
.site-brand {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
}

.site-footer a {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
}

.card:hover {
  border-color: var(--border-strong);
  background: #18181b;
  transform: translateY(-2px);
}

.card-cat {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.card-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  flex-grow: 1;
  margin-bottom: 24px;
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
}

.card-link,
.card-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  transition: all 0.18s ease;
}

.card-link:hover,
.card-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.card-link.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.card-link.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.card-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}

/* ----- Sections ----- */

.section {
  padding: 80px 0;
  border-bottom: 1px solid var(--border);
}

.section h2 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
}

.section-lede {
  color: var(--text-secondary);
  max-width: 64ch;
  font-size: 17px;
  margin-bottom: 32px;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.feature {
  padding: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.feature h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature p {
  font-size: 14px;
  color: var(--text-secondary);
}

.feature code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ----- Footer ----- */

.site-footer {
  padding: 48px 0 64px;
  color: var(--text-muted);
  font-size: 14px;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
}

.site-footer a {
  color: var(--text-secondary);
}

.site-footer a:hover {
  color: var(--text-primary);
}

/* ----- Details modal ----- */

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 8, 0.7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: fade-in 0.18s ease;
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 820px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--bg-modal);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: pop-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-head {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding: 28px 28px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-cat {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.modal-head h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  max-width: 60ch;
}

.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.modal-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: grid;
  gap: 28px;
}

.modal-section h3 {
  font-size: 12px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-section h3 .count {
  font-weight: 400;
  color: var(--text-muted);
}

/* color swatches */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.swatch {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 11px;
}

.swatch-chip {
  display: block;
  height: 64px;
  width: 100%;
}

.swatch-meta {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  gap: 6px;
}

.swatch-meta .hex {
  color: var(--text-primary);
}

.swatch-meta .role {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
  flex: 1;
}

/* typography */
.font-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.font-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 12px 16px;
  background: var(--bg-elevated);
}

.font-role {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.font-sample {
  color: var(--text-primary);
  font-size: 20px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-sample[data-empty="true"] {
  color: var(--text-muted);
  font-style: italic;
}

.font-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

/* lists */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-list li {
  list-style: none;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.chip-list li.muted {
  color: var(--text-muted);
}

.kv-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.kv {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
}

.kv .k {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  margin-bottom: 4px;
}

.kv .v {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* footer of modal */
.modal-foot {
  display: flex;
  gap: 12px;
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.modal-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.modal-cta:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.modal-cta.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.modal-cta.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

/* Busy state while the download fetch is in flight */
.modal-cta.loading {
  opacity: 0.65;
  pointer-events: none;
  animation: cta-pulse 1.1s ease-in-out infinite;
}

@keyframes cta-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.25);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ----- Responsive ----- */

@media (max-width: 720px) {
  .hero h1 {
    font-size: clamp(36px, 10vw, 56px);
  }
  .site-nav a:not(.nav-cta) {
    display: none;
  }
  .filter-search {
    margin-left: 0;
    width: 100%;
  }
  .filter-search input {
    width: 100%;
  }
  .modal-head {
    padding: 20px 20px 12px;
  }
  .modal-body {
    padding: 16px 20px;
  }
  .modal-foot {
    padding: 16px 20px;
    flex-wrap: wrap;
  }
  .font-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .font-meta {
    text-align: left;
  }
  .grid {
    grid-template-columns: 1fr;
  }
}

/* tablet — 2-column cards */
@media (min-width: 720px) and (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ----- Reduced motion ----- */

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

/* ----- Print ----- */

@media print {
  :root {
    --bg-base: #fff;
    --bg-elevated: #f5f5f5;
    --bg-overlay: transparent;
    --border: #ddd;
    --border-strong: #999;
    --text-primary: #000;
    --text-secondary: #333;
    --text-muted: #666;
    --accent: #c6351c;
  }
  * {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
  }
  body {
    background: #fff !important;
    font-size: 11pt;
  }
  .site-header,
  .site-footer,
  .modal,
  .skip-link,
  .filter,
  .card-actions,
  .hero-eyebrow,
  .hero-stats {
    display: none !important;
  }
  .hero {
    padding: 0 0 24pt;
    border: none;
  }
  .hero h1,
  .hero h2,
  .hero h3,
  .card-title,
  .card-desc,
  .card-cat,
  h1, h2, h3 {
    color: #000 !important;
  }
  .grid {
    display: block;
    padding: 0;
  }
  .card {
    border: 1px solid #999 !important;
    background: #fff !important;
    page-break-inside: avoid;
    margin-bottom: 12pt;
  }
  a {
    color: #000 !important;
    text-decoration: underline;
  }
  /* Show URLs after links for offline reading */
  a[href^="http"]::after,
  a[href^="./"]::after,
  a[href^="../"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
    word-break: break-all;
  }
  .section {
    padding: 24pt 0;
    border-color: #ddd;
  }
}
