/* ==========================================================================
   themes/default/base.css - the public design's frame: a Local's website in localcen.com's standard, in the Local's
   colour (#35 Phase 5, D18). The approved look: design/foundation/features/35-public-site.html (Blocks → Public site).
   Every value comes from public-tokens.css (generated from design/foundation/tokens.json - load it first) and the page's
   style block (themes.PublicPrefsCSS: the Local's colour, the content width, high contrast); nothing here is a colour
   of its own except the footer band (the site's dark band) and the verified badges (fixed colours).
   1 variables · 2 base · 3 type · 4 cards, buttons · 5 header, menus · 6 back to top · 7 footer · 8 reveal ·
   9 share, language pills. local.css: the listings and the article.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Variables - what the rules below read, derived from public-tokens.css
   -------------------------------------------------------------------------- */

/* The Local's colour: --accent-solid (a fill) with --accent-solid-fg (its text) and --accent-solid-hover, and
   --accent-ink (the colour as text and line on the page: links, the category, the focus ring); --accent-fg is the text
   on the ink (selected text). LocalCen's green unless the Local picked a colour (public-tokens.css / PrefsCSS). */
:root {
  --ink-2: color-mix(in srgb, var(--ink-1) 80%, var(--bg)); /* body copy: #333 on white (the site's) */
  --border: var(--line);
  --line-strong: color-mix(in srgb, var(--line) 93%, var(--ink-1)); /* outlines of white buttons */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
  --scrim: rgb(0 0 0 / 0.5);
  --pad: clamp(16px, 4vw, 32px);
  --card-pad: clamp(20px, 2.5vw, 24px);
  --control-sm: 36px;
  --control: 42px;
  --control-lg: 48px;
  --font-sans: var(--lc-font-sans);
  --font-serif: var(--lc-font-serif);
  --font-mono: var(--lc-font-mono);
  /* The footer's band: the site's dark band in both schemes (#111, its text #F5F5F5 / #A3A3A3). */
  --band-bg: #111111;
  --band-ink: #F5F5F5;
  --band-ink-2: #A3A3A3;
  --band-line: #333333;
  --band-edge: transparent;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --fast: 160ms;
  --base: 240ms;
}

[data-theme="dark"] {
  --ink-2: var(--ink-3); /* the site's dark copy (#A3A3A3) */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --scrim: rgb(0 0 0 / 0.65);
  --band-edge: var(--line); /* the band is only a little lighter than the page: a hairline marks its edge */
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

/* The footer sits at the bottom of the screen on a short page: the page is a column at least one screen tall and
   <main> takes the room that is left (100vh first for browsers without dvh). */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-1);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body:lang(hi),
body:lang(te),
body:lang(gu) {
  line-height: 1.7;
}

main {
  flex: 1 0 auto;
  min-width: 0;
  padding-bottom: clamp(32px, 5vw, 56px);
}

/* Headings: the site's sans, bold, tight (fonts.css gives Hindi / Telugu / Gujarati their own heading faces). */
h1,
h2,
h3,
h4 {
  margin: 0 0 0.6em;
  font-family: inherit;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: inherit;
}

p {
  margin: 0 0 1em;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--fast) var(--ease);
}

img {
  display: block;
  max-width: 100%;
}

button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* One focus ring: the Local's ink, 2px, 2px off the edge. */
:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
}

:where(a):focus-visible {
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: 999px;
  background-color: var(--accent-solid);
  color: var(--accent-solid-fg);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: none;
}

::selection {
  background: var(--accent-ink);
  color: var(--accent-fg);
}

/* Icons (the Lucide sprite in _head.html) */
.icon {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.18em;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Columns: the site's 1160px (the reading column 46rem), scaled by Content width (--pub-w-scale). */
.container,
.container-narrow {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--pad);
}

.container {
  max-width: calc(1160px * var(--pub-w-scale, 1) + 2 * var(--pad));
}

.container-narrow {
  max-width: calc(46rem * var(--pub-w-scale, 1) + 2 * var(--pad));
}

.section-alt {
  border-top: 1px solid var(--border);
  background-color: var(--bg-muted);
}

/* --------------------------------------------------------------------------
   3. Type - the page head (home, a category, a tag, a message)
   -------------------------------------------------------------------------- */

/* The kicker: small, semibold, the Local's ink. */
.eyebrow {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--accent-ink);
}

/* Public pages keep the site's large headlines. */
.display {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lead {
  max-width: 40rem;
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink-2);
}

.page-hero {
  padding-block: clamp(40px, 7vw, 72px) clamp(24px, 4vw, 40px);
  text-align: center;
}

.page-hero > .container-narrow {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.page-message {
  padding-block: clamp(72px, 10vw, 128px);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

/* The category of an article (cards, the article head, pulse): the kicker's look, a link to its page. */
.article-cat {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--accent-ink);
}

a.article-cat:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --------------------------------------------------------------------------
   4. Cards and buttons
   -------------------------------------------------------------------------- */

/* Cards: 18px, the hairline, the site's soft shadow. */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background-color: var(--surface);
  box-shadow: var(--shadow-card);
}

/* Buttons: pills, 42px (36 small, 48 large), 15px semibold; hover lifts. Solid = the Local's fill with its own text. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control);
  padding: 0 20px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: none;
}

.btn-solid,
.btn-primary {
  background-color: var(--accent-solid);
  color: var(--accent-solid-fg);
}

.btn-solid:hover,
.btn-primary:hover {
  background-color: var(--accent-solid-hover);
  box-shadow: var(--shadow-card);
}

.btn-outline {
  border-color: var(--line-strong);
  background-color: var(--surface);
  color: var(--ink-1);
  box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
  border-color: var(--field);
  background-color: var(--bg-muted);
}

.btn-sm {
  height: var(--control-sm);
  padding: 0 14px;
  gap: 6px;
  font-size: 0.875rem;
}

.btn-lg {
  height: var(--control-lg);
  padding: 0 24px;
  font-size: 1rem;
}

/* Round icon buttons (the header's language, light / dark and menu; share): 40px, the white button's outline. */
.icon-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background-color: var(--surface);
  color: var(--ink-1);
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
  border-color: var(--field);
  background-color: var(--bg-muted);
}

.icon-btn .icon {
  width: 18px;
  height: 18px;
}

/* --------------------------------------------------------------------------
   5. Header and its menus
   -------------------------------------------------------------------------- */

/* 64px, the card colour with a hairline (localcen.com's light bar); it stays at the top. */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background-color: var(--surface);
}

.navbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 64px;
}

.nav-brand {
  min-width: 0;
  overflow: hidden;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ink-1);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 12px;
}

.nav-link {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--ink-2);
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.nav-link:hover {
  background-color: var(--bg-soft);
  color: var(--ink-1);
}

.nav-link[aria-current="page"] {
  background-color: var(--bg-soft);
  color: var(--ink-1);
  font-weight: 600;
}

.nav-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-lang,
.nav-menu {
  position: relative;
}

/* The language button: the icon and the language's code (EN, HI, TE, GU). */
.lang-btn {
  width: auto;
  gap: 6px;
  padding: 0 12px 0 14px;
}

.lang-btn .icon {
  color: var(--ink-3);
}

.lang-mark {
  min-width: 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

/* Light / dark: the moon on a light page, the sun on a dark one. */
:root:not([data-theme="dark"]) .theme-toggle .icon-sun,
[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* On a narrow screen the pages and Sign in fold into the menu button. */
.nav-menu {
  display: none;
}

@media (max-width: 760px) {
  .nav-links,
  .nav-signin {
    display: none;
  }

  .nav-menu {
    display: block;
  }
}

/* The menus (language, the folded pages): the site's menu panel. */
.nav-lang-list,
.nav-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  display: grid;
  gap: 2px;
  min-width: 180px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition:
    opacity var(--fast) var(--ease),
    visibility var(--fast) var(--ease),
    transform var(--fast) var(--ease);
}

[dir="rtl"] .nav-lang-list,
[dir="rtl"] .nav-menu-panel {
  right: auto;
  left: 0;
}

.nav-lang.open .nav-lang-list,
.nav-menu.open .nav-menu-panel {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.nav-lang-list a,
.nav-menu-panel a {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink-1);
  text-align: start;
}

.nav-lang-list a:hover,
.nav-menu-panel a:hover {
  background-color: var(--bg-soft);
}

.nav-lang-opt.is-active {
  background-color: var(--bg-soft);
  font-weight: 600;
}

/* On a phone the header keeps the Local's name readable: smaller gaps, the language button without its padding. */
@media (max-width: 480px) {
  .navbar-inner,
  .nav-actions {
    gap: 6px;
  }

  .lang-btn {
    padding: 0 10px;
  }
}

/* --------------------------------------------------------------------------
   6. Back to top (bottom right, once the page is scrolled a while)
   -------------------------------------------------------------------------- */

.fab-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
}

.fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background-color: var(--surface);
  color: var(--ink-1);
  box-shadow: var(--shadow-card);
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}

.fab:hover {
  border-color: var(--field);
  background-color: var(--bg-muted);
}

.fab .icon {
  width: 18px;
  height: 18px;
}

#toTop {
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition:
    opacity var(--base) var(--ease),
    visibility var(--base) var(--ease),
    transform var(--base) var(--ease),
    border-color var(--fast) var(--ease),
    background-color var(--fast) var(--ease);
}

#toTop.show {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* --------------------------------------------------------------------------
   7. Footer
   The Local's name and tagline, the site's links in columns, then the copyright line, the LocalCen credit and the
   languages. Settings → Interface → Public site → Footer style chooses its colours:
   band  = the site's dark band (both schemes; a hairline marks its edge on a dark page);
   brand = the Local's fill with its own text;
   plain = the card colour with a hairline above.
   -------------------------------------------------------------------------- */

.footer-min {
  --fm-bg: var(--band-bg);
  --fm-ink: var(--band-ink);
  --fm-ink-2: var(--band-ink-2);
  --fm-line: var(--band-line);
  flex: none;
  border-top: 1px solid var(--band-edge);
  background-color: var(--fm-bg);
  color: var(--fm-ink);
}

.footer-min.footer-brand {
  --fm-bg: var(--accent-solid);
  --fm-ink: var(--accent-solid-fg);
  /* Text on a colour keeps its full contrast: the levels differ by size and weight, not by fading. */
  --fm-ink-2: var(--accent-solid-fg);
  --fm-line: color-mix(in srgb, var(--accent-solid-fg) 25%, var(--accent-solid));
  border-top-color: transparent;
}

.footer-min.footer-plain {
  --fm-bg: var(--surface);
  --fm-ink: var(--ink-1);
  --fm-ink-2: var(--ink-3);
  --fm-line: var(--border);
  border-top-color: var(--border);
}

.fm-main {
  display: grid;
  gap: 32px;
  padding-block: clamp(40px, 6vw, 56px) 0;
}

@media (min-width: 768px) {
  .fm-main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  }
}

.fm-brand {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 14px;
  min-width: 0;
}

.fm-title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--fm-ink);
  overflow-wrap: anywhere;
}

.fm-tagline {
  max-width: 34ch;
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--fm-ink-2);
  overflow-wrap: anywhere;
}

.fm-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr));
  gap: 24px;
}

.fm-head {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  color: var(--fm-ink);
  overflow-wrap: anywhere;
}

.fm-col ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fm-col a,
.fm-lang a {
  color: var(--fm-ink-2);
}

.fm-col a {
  font-size: 0.9375rem;
}

.fm-col a:hover,
.fm-lang a:hover {
  color: var(--fm-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fm-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 32px;
  padding-block: 20px 24px;
  border-top: 1px solid var(--fm-line);
  font-size: 0.8125rem;
  color: var(--fm-ink-2);
}

.fm-lang {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.fm-lang a {
  padding: 4px 8px;
  border-radius: var(--radius-md);
}

.fm-lang a[aria-current] {
  background-color: color-mix(in srgb, var(--fm-ink) 12%, transparent);
  color: var(--fm-ink);
  font-weight: 600;
}

/* On a phone the base lines stack on the left: back to top sits in the bottom right corner and must not cover them. */
@media (max-width: 640px) {
  .fm-base {
    flex-direction: column;
    align-items: flex-start;
    padding-inline-end: calc(var(--pad) + 56px);
  }
}

/* --------------------------------------------------------------------------
   8. Reveal on scroll (Settings → Page animations) + reduced motion
   -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.reveal.on {
  opacity: 1;
  transform: none;
}

.no-motion .reveal {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   9. Share (an article) and the language pills (an article's translations)
   -------------------------------------------------------------------------- */

.share-wrap {
  position: relative;
  display: inline-flex;
}

.share-btn {
  width: 32px;
  height: 32px;
}

.share-btn .icon {
  width: 15px;
  height: 15px;
}

.share-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 70;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  box-shadow: var(--shadow-pop);
  text-align: start;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition:
    opacity var(--fast) var(--ease),
    visibility var(--fast) var(--ease),
    transform var(--fast) var(--ease);
}

.share-menu.open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.share-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink-1);
  text-align: start;
  transition: background-color var(--fast) var(--ease);
}

.share-item:hover {
  background-color: var(--bg-soft);
}

.share-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 90;
  padding: 10px 18px;
  border-radius: 999px;
  background-color: var(--band-bg);
  color: var(--band-ink);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  transform: translateX(-50%);
}

.lang-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.lang-row-center {
  justify-content: center;
}

.lang-pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background-color: var(--surface);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.lang-pill:hover {
  border-color: var(--field);
  color: var(--ink-1);
}

.lang-pill.active {
  border-color: color-mix(in srgb, var(--accent-ink) 45%, var(--surface));
  background-color: color-mix(in srgb, var(--accent-ink) 10%, var(--surface));
  color: var(--accent-ink);
  font-weight: 600;
}

/* Hindi / Telugu / Gujarati: no negative tracking, taller lines on the headlines. */
:lang(hi) :is(h1, h2, h3, h4, .display, .nav-brand, .fm-title),
:lang(te) :is(h1, h2, h3, h4, .display, .nav-brand, .fm-title),
:lang(gu) :is(h1, h2, h3, h4, .display, .nav-brand, .fm-title) {
  letter-spacing: 0;
}

:lang(hi) .display,
:lang(te) .display,
:lang(gu) .display {
  line-height: 1.3;
}
