/* ==========================================================================
   AiTrendz.org — shared stylesheet
   All colors, fonts, radii, shadows, spacing and motion values come from
   --at-* custom properties: brand tokens in assets/css/tokens.css (a copy of
   brand/final/tokens.css) plus site-only extras in assets/css/site-tokens.css.
   Dark-only. Do not add literal colors here; add or change a token instead.
   ========================================================================== */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--at-header-height) + var(--at-space-4)); }
body {
  margin: 0;
  font-family: var(--at-font-sans);
  font-size: var(--at-text-base);
  line-height: var(--at-leading-base);
  color: var(--at-color-text);
  background: var(--at-gradient-page), var(--at-color-bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--at-font-display); font-weight: var(--at-weight-bold); letter-spacing: var(--at-tracking-heading); line-height: var(--at-leading-tight); margin: 0 0 var(--at-space-4); }
h1 { font-size: var(--at-text-2xl); }
h2 { font-size: var(--at-text-xl); }
h3 { font-size: var(--at-text-lg); }
p { margin: 0 0 var(--at-space-4); }
a { color: var(--at-color-primary); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: var(--at-focus-width) solid var(--at-focus-color);
  outline-offset: var(--at-focus-offset);
  box-shadow: 0 0 0 calc(var(--at-focus-width) + var(--at-focus-offset)) var(--at-focus-halo);
  border-radius: var(--at-radius-sm);
}

.skip-link {
  position: absolute;
  left: var(--at-space-4);
  top: calc(-1 * var(--at-space-8));
  z-index: var(--at-z-skip);
  padding: var(--at-space-2) var(--at-space-4);
  background: var(--at-color-primary);
  color: var(--at-color-on-primary);
  border-radius: var(--at-radius-sm);
  font-weight: var(--at-weight-bold);
}
.skip-link:focus { top: var(--at-space-2); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.container { width: 100%; max-width: var(--at-content-max); margin: 0 auto; padding: 0 var(--at-space-4); }

/* ---------- Header / nav (shared on every page) ---------- */
.site-header {
  position: sticky; top: 0; z-index: var(--at-z-header);
  background: var(--at-color-overlay);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--at-color-border);
  transition: background-color var(--at-duration-fast) var(--at-ease-out), border-color var(--at-duration-fast) var(--at-ease-out);
}
/* Home: transparent over the hero, solid after 80px of scroll (JS adds .is-scrolled). */
.site-header--overlay { position: fixed; left: 0; right: 0; background: transparent; border-bottom-color: transparent; backdrop-filter: none; }
.site-header--overlay.is-scrolled { background: var(--at-color-overlay); border-bottom-color: var(--at-color-border); backdrop-filter: blur(12px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: var(--at-header-height); gap: var(--at-space-4); }
.logo { display: inline-flex; align-items: center; min-height: var(--at-tap-min); border-radius: var(--at-radius-sm); }
.logo img { height: var(--at-logo-height); width: auto; }
.header-actions { display: flex; align-items: center; gap: var(--at-space-3); }
.header-actions .btn-nav { display: none; } .header-actions .btn-nav { min-height: var(--at-tap-min); padding: var(--at-space-2) var(--at-space-4); font-size: var(--at-text-sm); color: var(--at-color-primary); background: transparent; border-color: var(--at-color-primary); }
.header-actions .btn-nav:hover { background: var(--at-color-surface); color: var(--at-color-primary-hover); border-color: var(--at-color-primary-hover); }
.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--at-tap-min); height: var(--at-tap-min);
  color: var(--at-color-text); background: var(--at-color-surface);
  border: 1px solid var(--at-color-border-strong); border-radius: var(--at-radius-md); cursor: pointer;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative;
}
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.site-nav { display: none; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--at-space-2); }
.nav-list a {
  display: inline-flex; align-items: center; min-height: var(--at-tap-min); padding: 0 var(--at-space-3);
  font-size: var(--at-text-sm); font-weight: var(--at-weight-medium); color: var(--at-color-muted); text-decoration: none; border-radius: var(--at-radius-sm);
}
.nav-list a:hover { color: var(--at-color-text); }
.nav-list a[aria-current="page"] { color: var(--at-color-text); box-shadow: inset 0 -2px 0 var(--at-color-primary); }
.no-js .site-nav { display: block; }
.no-js .nav-list { flex-wrap: wrap; }
.no-js .nav-toggle { display: none; }
@media (min-width: 60rem) {
  .nav-toggle { display: none; }
  .site-nav { display: block; }
  .header-actions .btn-nav { display: inline-flex; }
}

/* ---------- Mobile menu: full-screen dialog sheet (matches mobile-menu-390 mockup) ---------- */
.menu-sheet {
  position: fixed; inset: 0; z-index: var(--at-z-menu);
  display: flex; flex-direction: column; gap: var(--at-space-5);
  padding: 0 var(--at-space-4) var(--at-space-5);
  background: var(--at-gradient-page), var(--at-color-bg); overflow-y: auto;
  animation: fade-in 320ms var(--at-ease-out) both;
}
.menu-sheet[hidden] { display: none; }
.menu-top { display: flex; align-items: center; justify-content: space-between; min-height: var(--at-header-height); }
.menu-close {
  width: var(--at-tap-min); height: var(--at-tap-min); display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--at-text-2xl); line-height: 1; color: var(--at-color-text);
  background: var(--at-color-surface); border: 1px solid var(--at-color-border-strong); border-radius: var(--at-radius-md); cursor: pointer;
}
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-list li { border-bottom: 1px solid var(--at-color-border); animation: menu-rise 320ms var(--at-ease-out) both; animation-delay: calc(var(--n, 0) * 30ms); }
.menu-list li:nth-child(2) { --n: 1; } .menu-list li:nth-child(3) { --n: 2; } .menu-list li:nth-child(4) { --n: 3; } .menu-list li:nth-child(5) { --n: 4; }
.menu-list a {
  display: flex; align-items: center; justify-content: space-between; min-height: 4.5rem;
  font-family: var(--at-font-display); font-size: var(--at-text-3xl); font-weight: var(--at-weight-bold); letter-spacing: var(--at-tracking-display);
  color: var(--at-color-text); text-decoration: none;
}
.menu-list a:hover, .menu-list a[aria-current="page"] { color: var(--at-color-primary); }
.menu-num { font-family: var(--at-font-mono); font-size: var(--at-text-sm); font-weight: var(--at-weight-regular); color: var(--at-color-muted); letter-spacing: var(--at-tracking-label); }
.menu-ctas { display: grid; gap: var(--at-space-3); }
.btn-block { width: 100%; min-height: 3.25rem; }
.menu-foot { margin: auto 0 0; display: flex; justify-content: space-between; font-family: var(--at-font-mono); font-size: var(--at-text-xs); color: var(--at-color-muted); letter-spacing: var(--at-tracking-label); }
.menu-open { overflow: hidden; }
@keyframes menu-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Main / sections ---------- */
main { display: block; }
.page-head { padding: var(--at-space-7) 0 var(--at-space-5); }
.page-head .lede { font-size: var(--at-text-lg); color: var(--at-color-muted); max-width: 44rem; }
.section { padding: var(--at-space-6) 0; }
.section-alt { background: var(--at-color-bg-deep); border-block: 1px solid var(--at-color-border); }
.eyebrow {
  display: inline-block; font-family: var(--at-font-mono); font-size: var(--at-text-xs); font-weight: var(--at-weight-semibold);
  text-transform: uppercase; letter-spacing: var(--at-tracking-label); color: var(--at-color-primary); margin-bottom: var(--at-space-2);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--at-space-2);
  min-height: var(--at-tap-min); padding: var(--at-space-2) var(--at-space-5);
  font: inherit; font-weight: var(--at-weight-bold); text-decoration: none;
  border-radius: var(--at-radius-md); border: 1px solid var(--at-color-primary); cursor: pointer;
  transition: transform var(--at-duration-fast) var(--at-ease-out), box-shadow var(--at-duration-fast) var(--at-ease-out), background var(--at-duration-fast);
}
.btn-primary { background: var(--at-color-primary); color: var(--at-color-on-primary); box-shadow: var(--at-glow-primary-sm); }
.btn-primary:hover, .btn-primary:focus-visible { background: var(--at-color-primary-hover); box-shadow: var(--at-glow-primary); }
.btn-secondary { background: var(--at-color-bg); color: var(--at-color-text); border-color: var(--at-color-accent); }
.btn-secondary:hover, .btn-secondary:focus-visible { box-shadow: var(--at-glow-accent); }
.btn:hover { transform: translateY(var(--at-hover-lift)); }
.btn-small { min-height: 36px; padding: var(--at-space-1) var(--at-space-3); font-size: var(--at-text-sm); }

/* ---------- Cards ---------- */
.grid { display: grid; gap: var(--at-space-4); grid-template-columns: 1fr; }
@media (min-width: 40rem) { .grid-2, .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60rem) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--at-color-surface); border: 1px solid var(--at-color-border);
  border-radius: var(--at-radius-lg); padding: var(--at-space-5); box-shadow: var(--at-shadow-sm);
  transition: transform var(--at-duration-fast) var(--at-ease-out), box-shadow var(--at-duration-fast) var(--at-ease-out), border-color var(--at-duration-fast);
}
.card:hover, .card:focus-within { transform: translateY(var(--at-hover-lift)); box-shadow: var(--at-shadow-md), var(--at-glow-primary-sm); border-color: var(--at-color-primary); }
.card h2, .card h3 { margin-bottom: var(--at-space-2); }
.card p { color: var(--at-color-muted); }
.card .card-foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: var(--at-space-2); align-items: center; }
.card-media {
  aspect-ratio: 16 / 9; border-radius: var(--at-radius-md); margin-bottom: var(--at-space-4);
  background: repeating-linear-gradient(45deg, var(--at-color-surface-2), var(--at-color-surface-2) 10px, var(--at-color-surface) 10px, var(--at-color-surface) 20px);
  display: grid; place-items: center; color: var(--at-color-placeholder-text); font-size: var(--at-text-sm); font-weight: var(--at-weight-bold);
}

.tag, .badge {
  display: inline-block; font-family: var(--at-font-mono); font-size: var(--at-text-xs); font-weight: var(--at-weight-semibold);
  padding: 0 var(--at-space-2); border-radius: var(--at-radius-sm);
  background: var(--at-color-primary-soft); color: var(--at-color-text); border: 1px solid var(--at-color-border);
}
.badge-placeholder { background: var(--at-color-surface-2); color: var(--at-color-placeholder-text); border: 1px dashed var(--at-color-border-strong); }

/* ---------- Notes / placeholder callouts ---------- */
.note {
  border: 1px solid var(--at-color-warning); border-left-width: 6px;
  background: var(--at-color-note-bg); color: var(--at-color-note-text);
  padding: var(--at-space-3) var(--at-space-4); border-radius: var(--at-radius-md); margin: var(--at-space-4) 0;
}
.note strong { color: inherit; }
.placeholder-text { color: var(--at-color-placeholder-text); font-style: italic; }

/* ---------- Pipeline (ideas) ---------- */
.pipeline { list-style: none; padding: 0; margin: 0 0 var(--at-space-5); display: flex; flex-wrap: wrap; gap: var(--at-space-2); }
.pipeline li { padding: var(--at-space-1) var(--at-space-3); border-radius: var(--at-radius-pill); background: var(--at-color-surface); border: 1px solid var(--at-color-border); font-size: var(--at-text-sm); font-weight: var(--at-weight-bold); }

.idea-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--at-space-3); }
.idea { display: grid; grid-template-columns: auto 1fr; gap: var(--at-space-4); align-items: start; }
.vote { display: flex; flex-direction: column; align-items: center; gap: var(--at-space-1); min-width: 3.5rem; }
.vote-count { font-family: var(--at-font-display); font-weight: var(--at-weight-bold); font-size: var(--at-text-lg); }

/* ---------- Forms ---------- */
.form { display: grid; gap: var(--at-space-4); max-width: 40rem; }
.field { display: grid; gap: var(--at-space-1); }
.field label { font-weight: var(--at-weight-bold); }
.field .hint { font-size: var(--at-text-sm); color: var(--at-color-muted); }
.field input, .field textarea, .field select {
  font: inherit; color: var(--at-color-text); background: var(--at-color-surface-2);
  border: 1px solid var(--at-color-border-strong); border-radius: var(--at-radius-sm);
  padding: var(--at-space-3); min-height: var(--at-tap-min); width: 100%;
}
.field textarea { min-height: 8rem; resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { border-color: var(--at-focus-color); }
.field [aria-invalid="true"] { border-color: var(--at-color-error); border-width: 2px; }
.error-msg { color: var(--at-color-error); font-size: var(--at-text-sm); font-weight: var(--at-weight-bold); }
.error-msg:empty { display: none; }
.form-status { padding: var(--at-space-3) var(--at-space-4); border-radius: var(--at-radius-md); border: 1px solid var(--at-color-border); background: var(--at-color-surface); }
.form-status:empty { display: none; }
.form-status.is-error { border-color: var(--at-color-error); color: var(--at-color-error); }
.form-status.is-ok { border-color: var(--at-color-warning); background: var(--at-color-note-bg); color: var(--at-color-note-text); }

/* ---------- Trends feed ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--at-space-2); margin-bottom: var(--at-space-5); }
.filter-bar button[aria-pressed="true"] { background: var(--at-color-primary); color: var(--at-color-on-primary); border-color: var(--at-color-primary); }
.trend-meta { font-size: var(--at-text-sm); color: var(--at-color-muted); font-family: var(--at-font-mono); }

/* ---------- Footer (shared) ---------- */
.site-footer { margin-top: var(--at-space-7); padding: var(--at-space-8) 0 var(--at-space-5); border-top: 1px solid var(--at-color-border); background: var(--at-color-bg-deep); color: var(--at-color-muted); font-size: var(--at-text-sm); overflow: hidden; }
.footer-grid { display: grid; gap: var(--at-space-6); }
.footer-brand p { max-width: 22rem; margin: 0; }
.footer-logo { display: inline-block; margin-bottom: var(--at-space-4); }
.footer-logo img { height: var(--at-logo-height-footer); width: auto; }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--at-space-5); }
.footer-h { margin: 0 0 var(--at-space-3); font-family: var(--at-font-mono); font-size: var(--at-text-xs); font-weight: var(--at-weight-semibold); text-transform: uppercase; letter-spacing: var(--at-tracking-label); color: var(--at-color-muted); }
.footer-cols ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--at-space-1); }
.footer-cols a { display: inline-flex; align-items: center; min-height: var(--at-tap-min); color: var(--at-color-text); text-decoration: none; }
.footer-cols a:hover { color: var(--at-color-primary); text-decoration: underline; }
.footer-cols .ph { display: inline-flex; align-items: center; min-height: var(--at-tap-min); color: var(--at-color-placeholder-text); }
/* Dot-matrix wordmark: gradient clipped to text, then masked to a dot grid. Decorative (aria-hidden). */
.footer-wordmark { margin: var(--at-space-7) 0 var(--at-space-5); text-align: center; line-height: 0.9; user-select: none; }
.footer-wordmark span {
  display: inline-block; font-family: var(--at-font-display); font-weight: var(--at-weight-bold);
  font-size: clamp(4.5rem, 19vw, 17.5rem); letter-spacing: var(--at-tracking-display);
  background: var(--at-gradient-signal); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-mask: radial-gradient(circle, var(--at-color-mask-solid) 42%, transparent 46%) 0 0 / 7px 7px;
          mask: radial-gradient(circle, var(--at-color-mask-solid) 42%, transparent 46%) 0 0 / 7px 7px;
  opacity: 0.85;
}
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--at-space-3); padding-top: var(--at-space-4); border-top: 1px solid var(--at-color-border); font-family: var(--at-font-mono); font-size: var(--at-text-xs); letter-spacing: var(--at-tracking-label); }
.footer-bottom p { margin: 0; }
.motion-toggle { min-height: var(--at-tap-min); padding: 0 var(--at-space-4); font: inherit; color: var(--at-color-text); background: var(--at-color-surface); border: 1px solid var(--at-color-border-strong); border-radius: var(--at-radius-pill); cursor: pointer; }
.motion-toggle[aria-pressed="true"] { color: var(--at-color-on-primary); background: var(--at-color-primary); border-color: var(--at-color-primary); }
@media (min-width: 60rem) { .footer-grid { grid-template-columns: 1fr 1.4fr; } }

/* ---------- Scroll reveal (JS adds .reveal-ready to <html>) ---------- */
.reveal-ready .reveal { opacity: 0; transform: translateY(var(--at-reveal-shift)); transition: opacity var(--at-duration-slow) var(--at-ease-out), transform var(--at-duration-slow) var(--at-ease-out); }
.reveal-ready .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Reduced motion / "Pause motion" (tokens.css zeroes durations under the media query) ---------- */
[data-motion="reduced"] *, [data-motion="reduced"] *::before, [data-motion="reduced"] *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) {
  .reveal-ready .reveal { opacity: 1; transform: none; }
  .card:hover, .card:focus-within, .btn:hover { transform: none; }
  .menu-sheet, .menu-list li { animation: none; }
}
[data-motion="reduced"] .reveal-ready .reveal, [data-motion="reduced"].reveal-ready .reveal { opacity: 1; transform: none; }
[data-motion="reduced"] .menu-sheet, [data-motion="reduced"] .menu-list li { animation: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.footer-bio { margin-top: var(--at-space-3) !important; color: var(--at-color-text); }
