/* layout.css — 3D Viral Prompt shared layout (Phase A, Foundation).
 * Header, navigation, dropdown, footer, mobile bottom nav, buttons,
 * badges, card shell, theme and accessibility primitives. Page-level
 * styles are added in later phases; nothing here renders page content.
 */

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  margin: 0 0 var(--space-3);
}

a { color: var(--green-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

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

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.brand { display: flex; align-items: center; gap: var(--space-2); color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { height: 36px; width: auto; display: block; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); white-space: nowrap; }
.brand-name em { font-style: normal; color: var(--green-text); }

.main-nav { display: flex; align-items: center; gap: var(--space-1); margin-left: auto; }
.main-nav > a,
.main-nav .nav-drop-btn {
  color: var(--text);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-weight: 500;
  white-space: nowrap;
}
.main-nav > a:hover,
.main-nav .nav-drop-btn:hover { text-decoration: none; background: var(--green-soft); }
.main-nav a[aria-current="page"] { color: var(--green-text); }

.nav-drop { position: relative; }
.nav-drop-btn {
  background: none;
  border: 0;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.nav-drop-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: var(--space-2);
  display: none;
}
.nav-drop[data-open="true"] .nav-drop-menu { display: block; }
.nav-drop-menu a {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  color: var(--text);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}
.nav-drop-menu a:hover { background: var(--green-soft); text-decoration: none; }
.nav-drop-menu .count { color: var(--text-muted); font-size: var(--text-sm); }

.header-actions { display: flex; align-items: center; gap: var(--space-2); }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.icon-btn:hover { border-color: var(--border-strong); }
/* Header icons are inline SVGs (one visual language, no emoji):
   20px in the 40px button. */
.icon-btn svg { width: 20px; height: 20px; display: block; }

/* ---------- Buttons, badges, cards ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 600;
  line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--green); color: var(--text-on-green); }
.btn-primary:hover { background: var(--green-accent); }
.btn-dark { background: var(--surface-raised); color: var(--text); border-color: var(--border); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--green-soft);
  color: var(--green-text);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card-media { aspect-ratio: 16 / 10; background: var(--surface-raised); }
.card-body { padding: var(--space-4); }
.card-title { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.card-desc { color: var(--text-muted); font-size: var(--text-sm); margin: 0 0 var(--space-4); }
.card-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ---------- Main / sections ---------- */
.site-main { padding: var(--space-6) 0 var(--space-10); }
.section { margin-bottom: var(--space-8); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: var(--space-8) 0 var(--space-6);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: var(--space-6);
}
.footer-grid h3 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.footer-grid a { color: var(--text); }
.footer-bottom {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--text-sm);
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* ---------- Mobile bottom navigation ---------- */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  height: var(--bottom-nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.bottom-nav nav { display: grid; grid-template-columns: repeat(5, 1fr); height: 100%; }
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
}
.bottom-nav a[aria-current="page"] { color: var(--green-text); }
.bottom-nav a:hover { text-decoration: none; }
/* Bottom-nav icons are inline SVGs in one visual language: 22px
   icons with 12px labels in the 60px bar (59px cells). No emoji,
   so rendering is identical on every platform. */
.bottom-nav .nav-icon { width: 22px; height: 22px; display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .main-nav { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 767px) {
  .bottom-nav { display: block; }
  body { padding-bottom: var(--bottom-nav-height); }
  .brand-name { font-size: var(--text-base); }
  .site-main { padding-top: var(--space-4); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
