@import "./public-footer.css";

:root {
  color-scheme: dark;
  --danger: #ff6b6b;

  --input-bg: rgba(7, 17, 31, 0.98);
  --choice-bg: rgba(7, 17, 31, 0.98);

  --shadow: 0 12px 32px rgba(0, 0, 0, 0.26);
  --radius: 16px;

  --region-chip-border: rgba(126, 168, 255, 0.28);
  --region-chip-bg: rgba(7, 17, 31, 0.98);
  --region-chip-bg-hover: rgba(10, 23, 42, 0.98);
  --region-chip-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  --region-chip-shadow-hover: 0 8px 22px rgba(0, 0, 0, 0.16);

  --globe-sphere-glow-inner: rgba(29, 78, 216, 0.24);
  --globe-sphere-core: rgba(8, 22, 44, 0.96);
  --globe-sphere-outer: rgba(3, 10, 22, 1);
  --globe-grid-stroke: rgba(126, 168, 255, 0.10);
  --globe-land-fill: rgba(126, 168, 255, 0.22);
  --globe-land-stroke: rgba(126, 168, 255, 0.18);
  --globe-outline-stroke: rgba(148, 163, 184, 0.18);

  --globe-region-border: rgba(var(--primary-rgb), 0.46);
  --globe-region-fill: rgba(var(--primary-rgb), 0.09);
  --globe-region-glow: rgba(var(--primary-rgb), 0.16);
  --globe-hit-fill-active: rgba(var(--primary-rgb), 0.24);
  --globe-hit-border-active: rgba(var(--primary-rgb), 0.94);
  --globe-hit-glow-active: rgba(var(--primary-rgb), 0.34);
}

html[data-theme="system"] {
  color-scheme: dark;
  --danger: #ff6b6b;
  --input-bg: rgba(7, 17, 31, 0.98);
  --choice-bg: rgba(7, 17, 31, 0.98);

  --region-chip-border: rgba(126, 168, 255, 0.28);
  --region-chip-bg: rgba(7, 17, 31, 0.98);
  --region-chip-bg-hover: rgba(10, 23, 42, 0.98);
  --region-chip-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  --region-chip-shadow-hover: 0 8px 22px rgba(0, 0, 0, 0.16);

  --globe-sphere-glow-inner: rgba(29, 78, 216, 0.24);
  --globe-sphere-core: rgba(8, 22, 44, 0.96);
  --globe-sphere-outer: rgba(3, 10, 22, 1);
  --globe-grid-stroke: rgba(126, 168, 255, 0.10);
  --globe-land-fill: rgba(126, 168, 255, 0.22);
  --globe-land-stroke: rgba(126, 168, 255, 0.18);
  --globe-outline-stroke: rgba(148, 163, 184, 0.18);

  --globe-region-border: rgba(var(--primary-rgb), 0.46);
  --globe-region-fill: rgba(var(--primary-rgb), 0.09);
  --globe-region-glow: rgba(var(--primary-rgb), 0.16);
  --globe-hit-fill-active: rgba(var(--primary-rgb), 0.24);
  --globe-hit-border-active: rgba(var(--primary-rgb), 0.94);
  --globe-hit-glow-active: rgba(var(--primary-rgb), 0.34);
}

@media (prefers-color-scheme: light) {
  html[data-theme="system"] {
    color-scheme: light;
    --danger: #e5484d;
    --input-bg: #ffffff;
    --choice-bg: #ffffff;

    --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);

    --region-chip-border: rgba(79, 124, 255, 0.20);
    --region-chip-bg: #ffffff;
    --region-chip-bg-hover: #f7faff;
    --region-chip-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    --region-chip-shadow-hover: 0 6px 16px rgba(15, 23, 42, 0.08);

    --globe-sphere-glow-inner: rgba(79, 124, 255, 0.10);
    --globe-sphere-core: rgba(231, 239, 252, 0.98);
    --globe-sphere-outer: rgba(209, 221, 243, 1);
    --globe-grid-stroke: rgba(79, 124, 255, 0.16);
    --globe-land-fill: rgba(79, 124, 255, 0.18);
    --globe-land-stroke: rgba(79, 124, 255, 0.24);
    --globe-outline-stroke: rgba(95, 107, 122, 0.16);

    --globe-region-border: rgba(var(--primary-rgb), 0.34);
    --globe-region-fill: rgba(var(--primary-rgb), 0.11);
    --globe-region-glow: rgba(var(--primary-rgb), 0.12);
    --globe-hit-fill-active: rgba(var(--primary-rgb), 0.18);
    --globe-hit-border-active: rgba(var(--primary-rgb), 0.88);
    --globe-hit-glow-active: rgba(var(--primary-rgb), 0.24);
  }
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #020304;
  --card: #090c10;
  --text: #e6e9ef;
  --muted: #aab2c0;
  --border: rgba(179, 143, 69, 0.24);
  --primary: #b38f45;
  --primary-rgb: 180, 143, 69;

  --theme-pills-bg: rgba(9, 12, 16, 0.96);
  --theme-pills-shadow: none;

  --region-chip-border: rgba(179, 143, 69, 0.30);
  --region-chip-bg: rgba(179, 143, 69, 0.06);
  --region-chip-bg-hover: rgba(179, 143, 69, 0.10);
  --region-chip-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  --region-chip-shadow-hover: 0 8px 22px rgba(0, 0, 0, 0.20);

  --globe-sphere-glow-inner: rgba(179, 143, 69, 0.16);
  --globe-sphere-core: rgba(17, 14, 10, 0.96);
  --globe-sphere-outer: rgba(7, 6, 5, 1);
  --globe-grid-stroke: rgba(179, 143, 69, 0.10);
  --globe-land-fill: rgba(179, 143, 69, 0.18);
  --globe-land-stroke: rgba(179, 143, 69, 0.18);
  --globe-outline-stroke: rgba(170, 178, 192, 0.14);

  --globe-region-border: rgba(var(--primary-rgb), 0.44);
  --globe-region-fill: rgba(var(--primary-rgb), 0.085);
  --globe-region-glow: rgba(var(--primary-rgb), 0.15);
  --globe-hit-fill-active: rgba(var(--primary-rgb), 0.20);
  --globe-hit-border-active: rgba(var(--primary-rgb), 0.92);
  --globe-hit-glow-active: rgba(var(--primary-rgb), 0.30);
}

html[data-theme="light"] {
  color-scheme: light;
  --danger: #e5484d;
  --input-bg: #ffffff;
  --choice-bg: #ffffff;
  --border: rgba(15, 23, 42, 0.18);

  --shadow: 0 10px 28px rgba(15, 23, 42, 0.10);

  --region-chip-border: rgba(100, 116, 139, 0.42);
  --region-chip-bg: rgba(255, 255, 255, 0.86);
  --region-chip-bg-hover: rgba(248, 250, 252, 0.98);
  --region-chip-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  --region-chip-shadow-hover: 0 6px 16px rgba(15, 23, 42, 0.10);

  --globe-sphere-glow-inner: rgba(79, 124, 255, 0.10);
  --globe-sphere-core: rgba(231, 239, 252, 0.98);
  --globe-sphere-outer: rgba(209, 221, 243, 1);
  --globe-grid-stroke: rgba(79, 124, 255, 0.16);
  --globe-land-fill: rgba(79, 124, 255, 0.18);
  --globe-land-stroke: rgba(79, 124, 255, 0.24);
  --globe-outline-stroke: rgba(95, 107, 122, 0.16);

  --globe-region-border: rgba(var(--primary-rgb), 0.34);
  --globe-region-fill: rgba(var(--primary-rgb), 0.11);
  --globe-region-glow: rgba(var(--primary-rgb), 0.12);
  --globe-hit-fill-active: rgba(var(--primary-rgb), 0.18);
  --globe-hit-border-active: rgba(var(--primary-rgb), 0.88);
  --globe-hit-glow-active: rgba(var(--primary-rgb), 0.24);
}

html[data-theme="soft"] {
  color-scheme: light;
  --danger: #c2414b;
  --input-bg: #f6faf5;
  --choice-bg: #d5e4d6;

  --shadow: 0 10px 28px rgba(22, 37, 27, 0.10);

  --region-chip-border: rgba(47, 111, 76, 0.24);
  --region-chip-bg: #f6faf5;
  --region-chip-bg-hover: #eaf3e9;
  --region-chip-shadow: 0 4px 12px rgba(22, 37, 27, 0.06);
  --region-chip-shadow-hover: 0 6px 16px rgba(22, 37, 27, 0.10);

  --globe-sphere-glow-inner: rgba(47, 159, 103, 0.14);
  --globe-sphere-core: rgba(218, 234, 218, 0.98);
  --globe-sphere-outer: rgba(183, 207, 185, 1);
  --globe-grid-stroke: rgba(47, 159, 103, 0.16);
  --globe-land-fill: rgba(47, 159, 103, 0.22);
  --globe-land-stroke: rgba(47, 159, 103, 0.28);
  --globe-outline-stroke: rgba(80, 100, 87, 0.18);

  --globe-region-border: rgba(var(--primary-rgb), 0.38);
  --globe-region-fill: rgba(var(--primary-rgb), 0.13);
  --globe-region-glow: rgba(var(--primary-rgb), 0.14);
  --globe-hit-fill-active: rgba(var(--primary-rgb), 0.20);
  --globe-hit-border-active: rgba(var(--primary-rgb), 0.90);
  --globe-hit-glow-active: rgba(var(--primary-rgb), 0.26);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page {
  min-height: 100vh;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: 24px 16px;
}

.root-page {
  gap: 16px;
}

.root-header-surface,
.root-page > .public-announcement {
  width: 100%;
  max-width: 700px;
}

.root-header-surface {
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.root-page > .public-announcement {
  margin: 0;
}

.card {
  width: 100%;
  max-width: 700px;
  min-height: 470px;
  padding: 14px 18px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.card {
  position: relative;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.05;
  color: var(--heading);
}

.header-left {
  display: grid;
  gap: 8px;
  min-width: 0;
  flex: 1 1 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Desktop root-page header layout
   Keeps theme/menu controls on the brand row while allowing the hero title
   and copy to use the full card width. */
@media (min-width: 641px) {
  .header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px 18px;
  }

  .header-left {
    display: contents;
  }

  .title {
    grid-column: 1;
    grid-row: 1;
  }

  .header-right {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    margin-left: 0;
    width: auto;
  }

  .hero-title {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: 34rem;
  }

  .hero-copy {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

.root-summary {
  margin: 12px 0 0;
  max-width: 38rem;
  color: var(--muted);
}

.root-summary-title {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.25;
}

.root-summary-copy {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
}

.content {
  display: grid;
  gap: 14px;
  padding-top: 8px;
}

.hero-title {
  margin: 0;
  font-size: clamp(1.25rem, 3.6vw, 1.75rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--text);
}

.globe-stage {
  display: grid;
  place-items: center;
  min-height: 290px;
  margin-top: 4px;
}

.globe-root {
  width: min(100%, 430px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: none;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  position: relative;
  touch-action: none;
}

.globe-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.globe-status {
  min-height: 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

.region-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.region-chip {
  appearance: none;
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--text) 50%, var(--region-chip-bg));
  border-radius: 12px;
  background: var(--region-chip-bg);
  color: var(--text);
  min-height: 44px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: normal;
  cursor: pointer;
  box-shadow: var(--region-chip-shadow);
  transition:
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

.region-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: none;
  flex: 0 0 auto;
}

.region-chip:hover,
.region-chip:focus-visible {
  border-color: var(--public-action-arrow, var(--primary));
  background: var(--region-chip-bg-hover);
  box-shadow: var(--region-chip-shadow-hover);
  outline: none;
}

.region-chip:focus-visible {
  outline: 2px solid var(--public-action-arrow, var(--primary));
  outline-offset: 3px;
  box-shadow: var(--public-action-focus-ring, var(--focus-ring));
}

@media (max-width: 640px) {
  .page {
    padding: 16px;
  }

  .root-header-surface,
  .root-page > .public-announcement {
    max-width: 390px;
  }

  .root-header-surface {
    padding: 12px 14px;
  }

  .card {
    max-width: 390px;
    min-height: auto;
    padding: 12px 14px 18px;
  }

  .header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 12px;
    row-gap: 12px;
  }

  .header-left {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    padding-right: 0;
  }

  .title {
    padding-right: 112px;
  }

  .header-right.header-right--site-nav {
    display: contents;
  }

  .header-right.header-right--site-nav .site-nav {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    margin-left: 0;
  }

  .header-right.header-right--site-nav .theme-pills {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    width: fit-content;
    max-width: 100%;
    justify-content: center;
  }

  .content {
    gap: 10px;
    padding-top: 6px;
  }

  .root-summary {
    margin-top: 10px;
  }

  .root-summary-title {
    font-size: 0.95rem;
  }

  .root-summary-copy {
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .globe-stage {
    min-height: 128px;
    margin-top: 0;
  }

  .globe-status {
    min-height: 18px;
    font-size: 0.85rem;
  }

  .globe-root {
    width: min(100%, 180px);
    touch-action: pan-y;
  }

  .region-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}

@media (max-width: 390px) {
  .region-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) and (min-height: 780px) {
  .globe-stage {
    min-height: 160px;
  }

  .globe-root {
    width: min(100%, 230px);
  }
}

@media (max-width: 640px) and (max-height: 620px) {
  .globe-stage,
  .globe-status {
    display: none;
  }
}

@media (min-width: 641px) {
  .globe-stage {
    min-height: clamp(210px, 34vh, 290px);
  }

  .globe-root {
    width: min(100%, clamp(280px, 42vh, 430px));
  }
}

@media (min-width: 641px) and (max-height: 760px) {
  .page {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .card {
    padding-top: 12px;
    padding-bottom: 14px;
  }

  .header-left {
    gap: 6px;
  }

  .content {
    gap: 10px;
    padding-top: 6px;
  }

  .globe-stage {
    min-height: 190px;
    margin-top: 0;
  }

  .globe-root {
    width: min(100%, 300px);
  }

  .globe-status {
    min-height: 20px;
  }

  .region-chip {
    min-height: 40px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .region-chip {
    transition: none;
  }
}

.region-chip::before {
  content: none;
}

/* ==========================================================================
   Dark theme panel elevation
   --------------------------------------------------------------------------
   Adds subtle surface separation for the root page card in dark themes.
   ========================================================================== */

html[data-theme="dark"] .card {
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.028) 0%,
      rgba(255, 255, 255, 0.010) 100%
    ),
    var(--card);
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(255, 255, 255, 0.035),
    inset 0 1px 0 rgba(255, 255, 255, 0.050);
}

html[data-theme="system"] .card {
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.032) 0%,
      rgba(255, 255, 255, 0.012) 100%
    ),
    var(--card);
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(255, 255, 255, 0.035),
    inset 0 1px 0 rgba(255, 255, 255, 0.050);
}
