/* ── EcoRoom visual + responsive layer ── */

:root {
  --shadow: 0 10px 28px rgba(15, 23, 42, .07);
  --shadow-lg: 0 18px 44px rgba(15, 23, 42, .12);
  --ease: .18s ease;
}

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  padding-bottom: env(safe-area-inset-bottom);
}
::selection {
  background: #99f6e4;
  color: #134e4a;
}
:focus-visible {
  outline: 2px solid #0d9488;
  outline-offset: 2px;
}
img { height: auto; }
h1, h2, h3 {
  text-wrap: balance;
  letter-spacing: -.01em;
}
.container {
  width: min(1200px, calc(100% - clamp(1.25rem, 4vw, 2.5rem)));
}

/* Buttons */
.btn, .nav-icon, .nav-toggle, .user-menu-btn, .rr-help-btn {
  touch-action: manipulation;
}
.btn {
  min-height: 42px;
  letter-spacing: .01em;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 60%, #0e7490 100%);
}
.btn-light {
  background: rgba(255,255,255,.16);
  color: #fff;
  border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(8px);
}
.btn-light:hover { background: rgba(255,255,255,.26); color: #fff; }

/* Nav */
.topnav {
  height: auto;
  min-height: var(--nav-h);
  padding-top: env(safe-area-inset-top);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(16px) saturate(1.2);
}
.topnav-inner { min-height: var(--nav-h); }
.nav-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(15, 23, 42, .38);
  backdrop-filter: blur(2px);
}
.nav-overlay.is-on { display: block; }
.nav-overlay[hidden] { display: none !important; }
.nav-toggle {
  display: none;
  place-items: center;
  gap: 4px;
  padding: 0;
  flex-direction: column;
}
.nav-toggle-bar {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 99px;
  background: #334155;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle.open .nav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(-45deg); }
.nav-toggle.open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle.open .nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(45deg); }
.user-menu-drop {
  inset-inline-start: 0;
  left: auto;
  max-height: min(70vh, 440px);
  overflow: auto;
}

/* Hero */
.hero {
  padding: clamp(2rem, 5vw, 3.8rem) 0 clamp(1.6rem, 4vw, 2.6rem);
  background:
    radial-gradient(circle at 8% 12%, rgba(13, 148, 136, .2), transparent 36%),
    radial-gradient(circle at 92% 8%, rgba(29, 78, 216, .14), transparent 32%),
    linear-gradient(180deg, #ecfeff 0%, #f4f7fb 100%);
}
.hero-card {
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,.78);
}
.stat-item strong {
  font-variant-numeric: tabular-nums;
  font-size: 1.55rem;
  letter-spacing: -.02em;
}

/* Cards & lists */
.card:hover {
  border-color: #99f6e4;
}
.feat-card .card-body { gap: .15rem; }
.list-row {
  align-items: center;
  min-width: 0;
}
.list-row > div { min-width: 0; }
.list-row strong {
  display: block;
  line-height: 1.55;
}
.section-head { align-items: flex-end; }

/* How steps */
.how-step {
  box-shadow: 0 4px 14px rgba(15, 23, 42, .04);
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.how-step:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: #99f6e4;
}

/* News */
.news-row {
  grid-template-columns: 200px 1fr;
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.news-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: #99f6e4;
}
.news-thumb { min-height: 132px; }
.news-thumb img {
  min-height: 132px;
  aspect-ratio: 4 / 3;
}
.news-row-body {
  padding: 1rem 1.1rem;
  min-width: 0;
}
.news-row-body .search-hit-top {
  flex-wrap: wrap;
  margin-bottom: .25rem;
}
.news-row-body .search-hit-top strong {
  flex: 1 1 12rem;
  line-height: 1.55;
}
.news-home-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.news-home-card .card-body { flex: 1; }
.news-home-media {
  height: 176px;
  overflow: hidden;
}
.news-home-media img {
  transition: transform .45s ease;
}
.news-home-card:hover .news-home-media img {
  transform: scale(1.05);
}
.news-hero img { aspect-ratio: 16 / 9; height: auto; max-height: 420px; }

/* Page heroes */
.page-hero { padding: clamp(1.4rem, 3.4vw, 2.4rem) 0 clamp(1.2rem, 3vw, 2rem); }
.page-search { max-width: min(560px, 100%); width: 100%; }
.page-hero .page-search { margin-top: 1.05rem; }
.url-copy { min-width: 0; }
.url-copy input { min-width: 0; }

/* Tables */
.ctrl-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Footer */
.footer {
  padding: 2.6rem 0 calc(1.4rem + env(safe-area-inset-bottom));
}
.footer li a {
  border-radius: 8px;
  padding: .12rem 0;
}
.footer li a:hover { color: #99f6e4; }

/* Chat */
.chat-layout { min-height: min(70vh, 760px); }
.chat-compose { align-items: flex-end; }

/* Support + help: safe area */
.rr-support-btn {
  bottom: calc(1.15rem + env(safe-area-inset-bottom));
}
.rr-support-panel {
  bottom: calc(4.6rem + env(safe-area-inset-bottom));
}
.rr-help-panel {
  padding-top: env(safe-area-inset-top);
}

/* Forms */
.filters { align-items: end; }
.filters-search { grid-template-columns: 1fr auto; }
.filters-3 { grid-template-columns: 1.4fr 1fr auto; }
.field input,
.field select,
.field textarea {
  min-height: 44px;
}

/* Scrollbars */
.rr-help-body,
.chat-messages,
.chat-list,
.rr-support-body {
  scrollbar-width: thin;
  scrollbar-color: #99f6e4 transparent;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Breakpoints ── */

/* Wide tablet / small laptop: hamburger before nav overflows */
@media (max-width: 1120px) {
  .nav-toggle { display: grid; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: .85rem 1rem 1.05rem;
    flex-direction: column;
    align-items: stretch;
    box-shadow: 0 16px 36px rgba(15,23,42,.1);
    max-height: min(78vh, 560px);
    overflow: auto;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    border-radius: 12px;
    padding: .75rem .9rem;
    font-size: 1rem;
  }
  .brand-text small { display: none; }
}

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .grid-3,
  .grid-4,
  .grid-2,
  .related-grid,
  .laws-cat-dir,
  .law-type-grid.grid-3,
  .mission-row,
  .founder-tags,
  .split-2,
  .feature-grid-clean,
  .mem-svcs,
  .mem-fees,
  .propos-who-grid {
    grid-template-columns: 1fr 1fr;
  }
  .dash-stats,
  .dash-stats-6,
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid,
  .dash-grid-bottom { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1.4fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
  .filters {
    grid-template-columns: 1fr 1fr;
  }
  .filters-search { grid-template-columns: 1fr auto; }
  .filters-3 { grid-template-columns: 1fr 1fr; }
  .filters:not(.filters-search) > .btn { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .chat-layout { grid-template-columns: 1fr; min-height: 0; }
  .chat-sidebar { max-height: 280px; }
  .page-hero-split { flex-direction: column; align-items: flex-start; }
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .news-row { grid-template-columns: 160px 1fr; }
  .news-home-media { height: 154px; }
  .how-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .user-menu-name,
  .user-menu-caret { display: none; }
  .user-menu-btn { padding: .15rem; max-width: none; }
  .site-search-box {
    flex-direction: column;
    border-radius: 16px;
    padding: .65rem;
  }
  .site-search-box .btn { width: 100%; }
  .nav-actions .btn-sm { padding: .4rem .7rem; }
  .hero-actions .btn { flex: 1 1 calc(50% - .75rem); }
  .url-copy { flex-wrap: wrap; }
  .url-copy .btn { width: 100%; }
}

@media (max-width: 640px) {
  :root { --nav-h: 64px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: .85rem; }
  .hero { padding: 1.6rem 0 1.2rem; }
  .hero h1 { font-size: 1.55rem; }
  .hero p.lead { font-size: .98rem; }
  .hero-actions { gap: .5rem; }
  .hero-actions .btn { flex: 1 1 100%; }
  .section { padding: 1.35rem 0; }
  .grid-3,
  .grid-4,
  .grid-2,
  .related-grid,
  .laws-cat-dir,
  .law-type-grid.grid-3,
  .mission-row,
  .founder-tags,
  .split-2,
  .feature-grid-clean,
  .mem-svcs,
  .mem-fees,
  .propos-who-grid,
  .how-row,
  .footer-grid,
  .filters,
  .filters-search,
  .filters-3,
  .form-grid,
  .mp-gallery.n2,
  .mp-gallery.n4,
  .news-row,
  .people-grid,
  .links-grid,
  .links-feat-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid > :first-child { grid-column: auto; }
  .dash-stats,
  .dash-stats-6,
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .news-thumb img,
  .news-thumb { min-height: 168px; height: 168px; aspect-ratio: auto; }
  .news-row-body { padding: .95rem 1rem 1.05rem; }
  .page-hero h1 { font-size: 1.35rem; }
  .page-sub { font-size: .94rem; }
  .page-search { max-width: none; }
  .detail-hero { padding: 1.2rem 1.1rem; border-radius: 16px; }
  .detail-hero h1 { font-size: 1.28rem; }
  .auth-wrap { padding: 1.2rem .15rem 2rem; }
  .auth-card { padding: 1.35rem 1.15rem; border-radius: 18px; }
  .leader-spotlight { padding: 1.1rem; }
  .founder-quote,
  .founder-profile,
  .founder-home-text { margin-inline: 1rem; }
  .founder-tags { margin-inline: 1rem; }
  .list-row { padding: .85rem .9rem; gap: .7rem; }
  .card-body { padding: 1rem 1.05rem; }
  .filters { padding: .85rem .9rem; }
  .footer { padding-bottom: calc(5.4rem + env(safe-area-inset-bottom)); }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: .55rem; }
  .rr-support-btn { inset-inline-end: .85rem; }
  .rr-support-panel {
    inset: auto 0 0 0;
    width: 100%;
    height: min(78vh, 620px);
    bottom: 0;
    border-radius: 18px 18px 0 0;
  }
  .rr-help-panel { width: 100vw; }
  input, select, textarea { font-size: 16px !important; }
  .btn, .nav-icon, .nav-toggle, .user-menu-btn {
    min-height: 42px;
  }
}

@media (max-width: 400px) {
  .dash-stats-6,
  .quick-grid,
  .dash-stats { grid-template-columns: 1fr; }
  .nav-actions .btn-secondary { display: none; }
  .links-feat-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 641px) and (max-width: 960px) {
  .links-feat-grid { grid-template-columns: repeat(3, 1fr); }
  .links-grid { grid-template-columns: 1fr 1fr; }
}
