/* Shared public site chrome — matches Weekly hub branding */
:root {
  color-scheme: light;
  --ink: #494949;
  --muted: #6b7c86;
  --bg: #f0f8fa;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --accent: #4bb3d4;
  --accent-deep: #399ab8;
  --accent-muted: #65a0af;
  --forte-red: #e42935;
  --line: rgba(75, 179, 212, 0.22);
  --glow: rgba(75, 179, 212, 0.35);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shell: min(960px, 100%);
  --page-bg: linear-gradient(180deg, #ffffff 0%, #f8fcfd 42%, var(--bg) 100%);
  --code-bg: #ffffff;
  --tile-bg: linear-gradient(160deg, #fff 0%, #eef7fa 100%);
  --footer-copy: #9aa8b0;
}

html.dark {
  color-scheme: dark;
  --ink: #e5e7eb;
  --muted: #94a3b8;
  --bg: #111827;
  --surface: rgba(15, 23, 42, 0.82);
  --surface-solid: #0f172a;
  --accent: #4bb3d4;
  --accent-deep: #7ec8de;
  --accent-muted: #65a0af;
  --line: rgba(75, 179, 212, 0.28);
  --glow: rgba(75, 179, 212, 0.28);
  --page-bg: linear-gradient(180deg, #0b1220 0%, #0f172a 42%, #111827 100%);
  --code-bg: #111827;
  --tile-bg: linear-gradient(160deg, #0f172a 0%, #132033 100%);
  --footer-copy: #64748b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Montserrat, sans-serif;
  background: var(--page-bg);
  line-height: 1.55;
  overflow-x: hidden;
}
h1, h2, h3, .heading { font-family: Raleway, sans-serif; }

.ambient {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  animation: site-drift 14s var(--ease) infinite;
}
.glow-a {
  top: -18%; left: -8%;
  width: 46vw; height: 46vw;
  max-width: 520px; max-height: 520px;
  opacity: 0.28;
  background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
}
html.dark .glow-a { opacity: 0.22; }
.glow-b {
  bottom: -12%; right: -6%;
  width: 40vw; height: 40vw;
  max-width: 460px; max-height: 460px;
  opacity: 0.18;
  background: radial-gradient(circle, rgba(228, 41, 53, 0.14) 0%, transparent 70%);
  animation-delay: -6s;
}
html.dark .glow-b { opacity: 0.14; }
.grid-fade {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image:
    linear-gradient(to right, var(--accent) 1px, transparent 1px),
    linear-gradient(to bottom, var(--accent) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 35%, #000 18%, transparent 75%);
}
html.dark .grid-fade { opacity: 0.055; }
@keyframes site-drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(2%, -1.5%, 0) scale(1.04); }
}

.shell {
  position: relative;
  z-index: 1;
  width: var(--shell);
  margin: 0 auto;
  padding: clamp(1.1rem, 3vw, 1.75rem) clamp(1rem, 3vw, 1.75rem) 3rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(75, 179, 212, 0.14);
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}
/* Match Hub landing logo: height 3rem (h-12), width auto */
.brand-lockup img {
  height: 3rem;
  width: auto;
  max-width: min(100%, 14rem);
  object-fit: contain;
}
.brand-name {
  font-family: Raleway, sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
}
.brand-sub {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-muted);
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  align-items: center;
}
.site-nav a {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0;
}
.site-nav a:hover,
.site-nav a.is-active {
  color: var(--accent-deep);
}
.site-nav a.is-active {
  box-shadow: inset 0 -2px 0 var(--accent);
}
.site-lang-switcher {
  position: relative;
  display: inline-flex;
  margin-left: 0.5rem;
  align-items: center;
}
.site-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid rgba(75, 179, 212, 0.4);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink, #494949);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.site-lang-trigger:hover {
  border-color: rgba(75, 179, 212, 0.7);
  background: rgba(75, 179, 212, 0.1);
}
.site-lang-icon {
  display: inline-flex;
  color: var(--accent-deep, #399ab8);
}
.site-lang-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.55;
  transition: transform 0.2s ease;
}
.site-lang-switcher.is-open .site-lang-caret {
  transform: rotate(180deg);
}
.site-lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 10rem;
  padding: 0.3rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line, rgba(73, 73, 73, 0.12));
  background: var(--surface, #fff);
  box-shadow: 0 12px 28px rgba(73, 73, 73, 0.12);
  z-index: 40;
}
.site-lang-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 0;
  background: transparent;
  color: var(--muted, #6b7c86);
  font: inherit;
  font-size: 0.78rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.5rem;
  cursor: pointer;
  text-align: left;
}
.site-lang-option:hover {
  background: rgba(75, 179, 212, 0.1);
  color: var(--ink, #494949);
}
.site-lang-option.is-active,
.site-lang-option[aria-selected="true"] {
  background: rgba(75, 179, 212, 0.16);
  color: var(--accent-deep, #399ab8);
  font-weight: 700;
}
.site-lang-option-code {
  font-size: 0.68rem;
  opacity: 0.7;
}
html.i18n-pending body { visibility: hidden; }

.page-main { flex: 1; }
.page-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  padding: clamp(1.25rem, 3vw, 1.85rem);
  box-shadow: 0 10px 36px rgba(73, 73, 73, 0.05);
}
html.dark .page-card {
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.28);
}
.page-card h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.65rem, 3.5vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.page-card .meta {
  margin: 0 0 1.15rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-muted);
}
.rule {
  height: 4px;
  width: 4.5rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(75, 179, 212, 0.12));
  margin: 0 0 1.25rem;
}
.page-card h2 {
  margin: 1.65rem 0 0.45rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
}
.page-card p,
.page-card li {
  color: var(--muted);
  font-size: 0.95rem;
}
.page-card ul {
  margin: 0.4rem 0 0;
  padding-left: 1.15rem;
}
.page-card li { margin: 0.35rem 0; }
.page-card a {
  color: var(--accent-deep);
  font-weight: 600;
  text-decoration: none;
}
.page-card a:hover { text-decoration: underline; text-underline-offset: 3px; }
.page-card code {
  font-size: 0.82em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  padding: 0.1rem 0.35rem;
  word-break: break-all;
  color: var(--ink);
}
.doc-grid {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.25rem;
}
@media (min-width: 700px) {
  .doc-grid { grid-template-columns: 1fr 1fr; }
}
.doc-tile {
  display: block;
  padding: 1rem 1.05rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: var(--tile-bg);
  text-decoration: none !important;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.doc-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(75, 179, 212, 0.12);
}
.doc-tile strong {
  display: block;
  font-family: Raleway, sans-serif;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 0.25rem;
}
.doc-tile span {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.site-footer {
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(75, 179, 212, 0.15);
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.15rem;
  align-items: center;
  justify-content: space-between;
}
.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}
.site-footer a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-deep);
  text-decoration: none;
}
.site-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.site-footer-copy {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--footer-copy);
}
