/* =========================================================================
   Arboryx public landing — layout + chrome.
   The center console is left as a 6-cell sector grid placeholder; Phase 4
   replaces the contents of each cell with an SVG tree.
   ========================================================================= */

#site {
  display: grid;
  grid-template-rows: var(--header-h) 1fr var(--footer-h);
  height: 100vh;
  width: 100vw;
}

/* --- HEADER --- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 98%, transparent);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  text-decoration: none;
}

.brand-mark {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: visible;          /* never clip descenders */
  padding-bottom: 6px;        /* absolute pixel safety margin */
}

.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.04em;
  line-height: 1.8;           /* per request — wordmark sits in a tall line-box */
  overflow: visible;
}

.brand-slogan {
  /* Switched off Syne — its descenders clip at small sizes regardless of
     line-height / padding. JetBrains Mono is already loaded and pairs
     well with the Syne wordmark above (display + mono is a clean combo). */
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.04em;
  line-height: 1.5;
  padding-bottom: 3px;
  overflow: visible;
  display: block;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: border-color .15s, color .15s, background .15s;
}
.nav-link:hover { border-color: var(--border2); color: var(--accent); }
.nav-link.active {
  border-color: var(--border2);
  background: var(--surface);
  color: var(--accent);
}

.auth-stub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--border2);
  border-radius: var(--r-sm);
  padding: 6px 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: not-allowed;
}

/* --- MAIN / CENTER CONSOLE --- */
.grove-console {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px 22px 14px;
  gap: 12px;
  overflow: hidden;
  min-height: 0;     /* lets grid item shrink to row track */
}

.console-banner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.console-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0;
}

/* Inline subtitle that follows the title on the same line.  Wraps
   gracefully on narrow viewports (no white-space: nowrap) so the SVG
   below isn't pushed; on wide viewports it sits beside the title. */
.console-sub {
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--muted);
  opacity: 0.85;
}

.console-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  display: flex;
  gap: 14px;
  align-items: center;
  line-height: 1.45;          /* descender clearance for "loading…", "latest" */
}

.last-updated {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.last-updated::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 6px var(--accent2);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

.grove-canvas {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  background:
    radial-gradient(
      ellipse at 50% 60%,
      color-mix(in srgb, var(--surface) 60%, transparent) 0%,
      transparent 65%
    );
}

/* The grove is one SVG; each tree is a <g class="tree"> placed by SVG
   transform="translate(...)". DO NOT add CSS transforms to .tree — they
   conflict with the SVG transform attribute and cause hover flicker. */
.tree { cursor: default; }

.tree-trunk,
.tree-branch {
  stroke: var(--cc);
  stroke-linecap: round;
  fill: none;
  opacity: 0.88;
}
/* Stroke hierarchy: trunk thickest; branches taper as they ascend.
   Branches are NEVER thicker than the trunk. */
.tree-trunk          { stroke-width: 4.5; }
.tree-branch.b-main  { stroke-width: 3.0; }
.tree-branch.b-sub   { stroke-width: 2.0; }
.tree-branch.b-tip   { stroke-width: 1.6; }
.tree-ground {
  stroke: var(--cc);
  stroke-width: 1.4;
  stroke-linecap: round;
  opacity: 0.4;
}

.tree-leaf {
  stroke: var(--cc);
  stroke-width: 0.9;
  transition: stroke-width .12s ease, filter .12s ease;
  outline: none;                      /* default focus ring → see :focus-visible */
}
.tree-leaf:hover,
.tree-leaf:focus-visible {
  stroke-width: 2;
  filter: drop-shadow(0 0 6px var(--cc));
  cursor: pointer;
}
@media (prefers-reduced-motion: reduce) {
  .tree-leaf, .tree-leaf:hover, .tree-leaf:focus-visible {
    transition: none;
  }
}
.leaf-d0 { fill: var(--leaf-d0); }
.leaf-d1 { fill: var(--leaf-d1); }
.leaf-d2 { fill: var(--leaf-d2); }
.leaf-d3 { fill: var(--leaf-d3); }
.leaf-d4 { fill: var(--leaf-d4); }
.leaf-d5 { fill: var(--leaf-d5); }
.leaf-d6 { fill: var(--leaf-d6); }

.tree-label {
  fill: var(--text);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-anchor: middle;
  dominant-baseline: hanging;
}
.tree-count {
  fill: var(--accent);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: hanging;
  font-variant-numeric: tabular-nums;
}
.tree-count[data-pending] { fill: var(--muted); }

/* --- LEGEND --- */
.legend {
  position: absolute;
  bottom: 18px;
  right: 22px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-head {
  justify-content: space-between;
  width: 130px;
}

/* Mute toggle in legend */
.mute-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.mute-toggle:hover { color: var(--accent); border-color: var(--border2); }
.mute-toggle svg { width: 12px; height: 12px; }
.mute-toggle .mute-icon-on  { display: block; }
.mute-toggle .mute-icon-off { display: none; }
.mute-toggle.is-muted .mute-icon-on  { display: none; }
.mute-toggle.is-muted .mute-icon-off { display: block; color: var(--danger); }

/* Floating leaf tooltip */
.leaf-tooltip {
  position: fixed;
  z-index: 1000;
  min-width: 180px;
  max-width: 320px;
  padding: 8px 11px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .14s ease, transform .14s ease;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1.5;
}
.leaf-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}
.leaf-tooltip-head {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 4px;
}
.leaf-tooltip-body {
  font-size: 12px;
  padding: 2px 0 4px;
  word-break: break-word;
}
.leaf-tooltip-date {
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.legend-title {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.8;
  margin-bottom: 2px;
}
.legend-strip {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  width: 130px;
}
.legend-strip span { flex: 1; }
.legend-labels {
  display: flex;
  justify-content: space-between;
  width: 130px;
  font-size: 9px;
  line-height: 1.5;           /* descender clearance for "today", "ago" */
}

/* --- FOOTER --- */
.site-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 22px;
  background: color-mix(in srgb, var(--bg) 98%, transparent);
  border-top: 1px solid var(--border);
  gap: 18px;
  position: relative;
  overflow: hidden;
}

.site-footer::after {
  content: "ARBORYX";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 96px;
  font-weight: 800;
  letter-spacing: 0.32em;
  color: var(--text);
  opacity: 0.025;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.share-row,
.follow-row,
.footer-right {
  position: relative;
  z-index: 1;
}

.share-row,
.follow-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.follow-row { justify-content: center; gap: 14px; }

.share-row { justify-content: flex-start; }

.share-btn,
.follow-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--muted);
  transition: color .15s, border-color .15s, background .15s, transform .15s;
}
.share-btn svg, .follow-btn svg { width: 14px; height: 14px; }
.share-btn:hover, .follow-btn:hover {
  color: var(--brand-color, var(--accent));
  border-color: var(--brand-color, var(--border2));
  background: var(--surface);
  transform: translateY(-1px);
}

.follow-btn {
  width: auto;
  padding: 0 12px;
  height: 28px;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.copyright-home {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
  padding: 5px 9px;
  border-radius: var(--r-sm);
  line-height: 1.5;            /* descender clearance for "Arboryx.ai", "rights" */
  transition: color .15s, border-color .15s;
}
.copyright-home:hover { color: var(--text); border-color: var(--border2); }

.legal-links {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legal-links a {
  color: inherit;
  text-decoration: none;
  border: 1px solid transparent;
  padding: 5px 9px;
  border-radius: var(--r-sm);
  line-height: 1.5;
  transition: color .15s, border-color .15s;
}
.legal-links a:hover { color: var(--text); border-color: var(--border2); }


/* Legal pages release the no-scroll viewport lock via inline <style> in
   privacy_policy.html / terms_of_service.html (lives there so it overrides
   tokens.css cleanly without :has() or cache-state coupling). */


/* --- MOBILE — keep no-scroll, expand center console horizontally --- */
@media (max-width: 768px) {
  .site-header { padding: 0 12px; }
  .brand-slogan { display: none; }
  .nav-link { padding: 5px 8px; font-size: 10px; }
  .auth-stub { font-size: 9.5px; padding: 5px 8px; }

  .grove-console { padding: 10px 4px 8px; }
  .grove-canvas { padding: 0; }
  /* On mobile we let the SVG scale; viewBox handles aspect. Text inside the
     SVG scales with it, so the labels stay legible. */

  .legend {
    position: static;
    width: max-content;
    margin: 0 auto;
  }

  .site-footer {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    padding: 6px 8px;
    gap: 4px;
    text-align: center;
  }
  .site-footer::after { display: none; }
  .share-row { justify-content: center; flex-wrap: wrap; }
  .footer-right { justify-content: center; }
  .follow-row { display: none; } /* save space; X+LinkedIn surfaces in share row */
}
