/* ==========================================================================
   Local1st Portal — Material 3 Expressive System
   Seeded from Brand Tri-color (Green #307336 / Blue #1A73E8 / Amber #F59E0B)
   ========================================================================== */

/* ---------- Font Setup ---------- */
@font-face {
  font-family: 'Roboto Flex';
  src: url('fonts/RobotoFlex.ttf') format('truetype');
  font-weight: 100 1000;
  font-stretch: 25% 151%;
  font-display: swap;
}

/* ---------- CSS Tokens (Light & Dark Tonal Palettes) ---------- */
:root {
  /* Surface & Containers (Light) */
  --surface: #f8faf2;
  --surface-dim: #d8dad2;
  --surface-bright: #ffffff;
  --surface-c-lowest: #ffffff;
  --surface-c-low: #f2f4ec;
  --surface-c: #ecefe6;
  --surface-c-high: #e6e9e0;
  --surface-c-highest: #e0e3db;
  --on-surface: #191c18;
  --on-surface-var: #424940;

  /* Primary (Local1st Forest Emerald) */
  --primary: #236a32;
  --on-primary: #ffffff;
  --primary-c: #a6f2ab;
  --on-primary-c: #002107;

  /* Secondary (Privli Nature Green / Orange) */
  --secondary: #43664e;
  --on-secondary: #ffffff;
  --secondary-c: #c5eccd;
  --on-secondary-c: #00210f;

  /* Tertiary (XFiles Dynamic Tech Indigo / Blue) */
  --tertiary: #1965a3;
  --on-tertiary: #ffffff;
  --tertiary-c: #d0e4ff;
  --on-tertiary-c: #001d36;

  /* Accent Amber / Alert */
  --accent-amber: #b26800;
  --accent-amber-c: #ffe0b3;
  --on-accent-amber: #2b1700;

  /* Outlines & Borders */
  --outline: #72796f;
  --outline-var: #c2c9bd;
  --outline-subtle: rgba(114, 121, 111, 0.15);

  /* Inverse */
  --inverse-surface: #2e312c;
  --inverse-on-surface: #f0f1ea;
  --inverse-primary: #8bd591;

  /* Brand Accents */
  --brand-green: #34a853;
  --brand-blue: #1a73e8;
  --brand-orange: #f2994a;
  --brand-amber: #f59e0b;
  --brand-purple: #8b5cf6;

  /* Aliases used by components. Point at tokens that actually exist. */
  --primary-container: var(--primary-c);
  --on-primary-container: var(--on-primary-c);
  --on-surface-variant: var(--on-surface-var);
  --outline-strong: var(--outline);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 14px rgba(25, 28, 24, 0.08), 0 2px 6px rgba(25, 28, 24, 0.04);
  --shadow-lg: 0 10px 30px rgba(25, 28, 24, 0.10), 0 4px 12px rgba(25, 28, 24, 0.06);
  --shadow-xl: 0 20px 40px rgba(25, 28, 24, 0.14), 0 8px 16px rgba(25, 28, 24, 0.08);

  /* Easing & Radii */
  --ease-emph: cubic-bezier(0.2, 0, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-xl: 36px;
  --r-2xl: 52px;
  --r-pill: 9999px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #101411;
    --surface-dim: #101411;
    --surface-bright: #363a35;
    --surface-c-lowest: #0b0f0c;
    --surface-c-low: #191d19;
    --surface-c: #1d211d;
    --surface-c-high: #272b27;
    --surface-c-highest: #323631;
    --on-surface: #e1e3de;
    --on-surface-var: #c2c9bd;

    --primary: #8bd591;
    --on-primary: #003912;
    --primary-c: #06531d;
    --on-primary-c: #a6f2ab;

    --secondary: #a9d0b2;
    --on-secondary: #143722;
    --secondary-c: #2b4e37;
    --on-secondary-c: #c5eccd;

    --tertiary: #9ccaff;
    --on-tertiary: #003258;
    --tertiary-c: #00497d;
    --on-tertiary-c: #d0e4ff;

    --accent-amber: #ffb86f;
    --accent-amber-c: #472600;
    --on-accent-amber: #ffe0b3;

    --outline: #8c9388;
    --outline-var: #424940;
    --outline-subtle: rgba(140, 147, 136, 0.2);

    --inverse-surface: #e1e3de;
    --inverse-on-surface: #2e312c;
    --inverse-primary: #236a32;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.6);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --surface: #101411;
  --surface-dim: #101411;
  --surface-bright: #363a35;
  --surface-c-lowest: #0b0f0c;
  --surface-c-low: #191d19;
  --surface-c: #1d211d;
  --surface-c-high: #272b27;
  --surface-c-highest: #323631;
  --on-surface: #e1e3de;
  --on-surface-var: #c2c9bd;

  --primary: #8bd591;
  --on-primary: #003912;
  --primary-c: #06531d;
  --on-primary-c: #a6f2ab;

  --secondary: #a9d0b2;
  --on-secondary: #143722;
  --secondary-c: #2b4e37;
  --on-secondary-c: #c5eccd;

  --tertiary: #9ccaff;
  --on-tertiary: #003258;
  --tertiary-c: #00497d;
  --on-tertiary-c: #d0e4ff;

  --accent-amber: #ffb86f;
  --accent-amber-c: #472600;
  --on-accent-amber: #ffe0b3;

  --outline: #8c9388;
  --outline-var: #424940;
  --outline-subtle: rgba(140, 147, 136, 0.2);

  --inverse-surface: #e1e3de;
  --inverse-on-surface: #2e312c;
  --inverse-primary: #236a32;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
  --shadow-xl: 0 20px 40px rgba(0,0,0,0.6);

  color-scheme: dark;
}

/* ---------- Base & Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  font-family: 'Roboto Flex', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--surface);
  color: var(--on-surface);
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;
  /* WebKit keeps the old used value of a transitioned background-color or
     color when only the custom property changes, so theme colors snap. */
}

img, svg {
  display: block;
  max-width: 100%;
}

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

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

.wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Material 3 Expressive Typography ---------- */
.d-hero {
  font-size: clamp(2.5rem, 5.5vw, 4.4rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--on-surface);
}

.d-section {
  font-size: clamp(2rem, 3.8vw, 3.1rem);
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -0.025em;
  color: var(--on-surface);
}

.t-title-lg {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.t-title {
  font-size: 1.3rem;
  font-weight: 650;
  line-height: 1.3;
}

.t-body-lg {
  font-size: clamp(1.1rem, 1.8vw, 1.3rem);
  line-height: 1.55;
  color: var(--on-surface-var);
}

.t-body {
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--on-surface-var);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 12px;
}

.kicker-tertiary {
  color: var(--tertiary);
}

.hl-green {
  background: linear-gradient(120deg, var(--brand-green), #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hl-blue {
  background: linear-gradient(120deg, var(--brand-blue), #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hl-gradient {
  background: linear-gradient(135deg, var(--brand-green) 0%, var(--brand-blue) 60%, var(--brand-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- Expressive Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: var(--r-pill);
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  transition: transform 0.22s var(--ease-spring), filter 0.22s var(--ease-emph);
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-sm {
  padding: 8px 18px;
  font-size: 0.88rem;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.08rem;
}

.btn-filled {
  background-color: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-sm);
}
.btn-filled:hover {
  background-color: color-mix(in srgb, var(--primary) 88%, white 12%);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-filled-blue {
  background-color: var(--tertiary);
  color: var(--on-tertiary);
  box-shadow: var(--shadow-sm);
}
.btn-filled-blue:hover {
  background-color: color-mix(in srgb, var(--tertiary) 88%, white 12%);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-tonal {
  background-color: var(--surface-c-high);
  color: var(--on-surface);
}
.btn-tonal:hover {
  background-color: var(--surface-c-highest);
  transform: translateY(-2px);
}

.btn-tonal-green {
  background-color: var(--primary-c);
  color: var(--on-primary-c);
}
.btn-tonal-green:hover {
  filter: brightness(0.96);
  transform: translateY(-2px);
}

.btn-tonal-blue {
  background-color: var(--tertiary-c);
  color: var(--on-tertiary-c);
}
.btn-tonal-blue:hover {
  filter: brightness(0.96);
  transform: translateY(-2px);
}

.btn-outlined {
  border: 1.5px solid var(--outline-var);
  color: var(--on-surface);
}
.btn-outlined:hover {
  background-color: var(--surface-c-low);
  border-color: var(--outline);
  transform: translateY(-2px);
}

/* ---------- Top Floating App Bar ---------- */
.topbar {
  position: sticky;
  top: 14px;
  z-index: 100;
  width: 100%;
  padding: 0 16px;
  pointer-events: none;
}

.toolbar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--surface-c-lowest) 82%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--outline-subtle);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: auto;
}

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

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease-spring);
}
.brand-link:hover .brand-logo {
  transform: rotate(-6deg) scale(1.06);
}

.brand-title {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background-color: var(--primary-c);
  color: var(--on-primary-c);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-item {
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--on-surface-var);
}

.nav-item:hover {
  background-color: var(--surface-c);
  color: var(--on-surface);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 1;
}

.nav-github-btn {
  flex-shrink: 0;
}

/* ================= Language Dropdown (M3 Expressive) ================= */
.lang-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.lang-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px 0 10px;
  border-radius: var(--r-pill);
  background-color: var(--surface-c);
  border: 1px solid var(--outline-subtle);
  color: var(--on-surface);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  min-width: 0;
  max-width: 100%;
}

.lang-trigger-btn:hover,
.lang-dropdown.open .lang-trigger-btn {
  background-color: var(--surface-c-high);
  border-color: var(--outline-strong);
  color: var(--primary);
}

.lang-globe-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.lang-current-label {
  white-space: nowrap;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.lang-chevron {
  flex-shrink: 0;
  opacity: 0.65;
  transition: transform 0.25s var(--ease-emph);
}

.lang-dropdown.open .lang-chevron {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  max-height: 380px;
  background-color: var(--surface-c-lowest);
  border: 1px solid var(--outline-subtle);
  border-radius: var(--r-xl);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 1200;
  display: none;
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top right;
  transition: opacity 0.2s var(--ease-emph), transform 0.2s var(--ease-emph);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.lang-dropdown.open .lang-menu {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Custom smooth scrollbar for lang menu */
.lang-menu::-webkit-scrollbar {
  width: 5px;
}
.lang-menu::-webkit-scrollbar-track {
  background: transparent;
}
.lang-menu::-webkit-scrollbar-thumb {
  background: var(--outline-subtle);
  border-radius: var(--r-pill);
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  color: var(--on-surface);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  user-select: none;
}

.lang-option:hover {
  background-color: var(--surface-c);
  color: var(--primary);
}

.lang-option.active {
  background-color: var(--primary-container);
  color: var(--on-primary-container);
  font-weight: 700;
}

.lang-option-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.lang-option-name {
  font-size: 0.82rem;
}

.lang-option-code {
  font-size: 0.7rem;
  opacity: 0.6;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lang-option-check {
  flex-shrink: 0;
  opacity: 0;
  color: currentColor;
  transition: opacity 0.15s ease;
}

.lang-option.active .lang-option-check {
  opacity: 1;
}

.theme-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--surface-c);
  color: var(--on-surface);
  flex-shrink: 0;
}
.theme-btn:hover {
  background-color: var(--surface-c-high);
}

/* ---------- Hero Section ---------- */
.hero {
  position: relative;
  padding: 70px 0 80px;
  text-align: center;
  overflow: hidden;
}

.hero-deco-bg {
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 500px;
  background: radial-gradient(circle at 40% 40%, rgba(52, 168, 83, 0.18) 0%, rgba(26, 115, 232, 0.15) 50%, transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  z-index: -1;
}

.hero-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 18px;
  border-radius: var(--r-pill);
  background-color: var(--surface-c-high);
  border: 1px solid var(--outline-subtle);
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--primary);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.hero-sub {
  max-width: 780px;
  margin: 22px auto 36px;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  margin-bottom: 36px;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  background-color: var(--surface-c-low);
  border: 1px solid var(--outline-subtle);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--on-surface);
}

.hero-cta-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 60px;
}

/* Showcase Twins Card */
.twins-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 1120px;
  margin: 0 auto;
}

.twin-card {
  position: relative;
  background-color: var(--surface-c-low);
  border-radius: var(--r-2xl);
  border: 1px solid var(--outline-subtle);
  padding: 36px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s var(--ease-spring);
}

.twin-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
}

.twin-card-privli {
  border-top: 4px solid var(--brand-green);
}

.twin-card-xfiles {
  border-top: 4px solid var(--brand-blue);
}

.twin-head {
  margin-bottom: 16px;
}

.twin-app-badge {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
}

.twin-app-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.twin-app-meta {
  flex: 1;
  min-width: 0;
}

.twin-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.twin-title-row h3 {
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.twin-app-sub {
  font-size: 0.92rem;
  font-weight: 550;
  color: var(--on-surface-var);
  line-height: 1.4;
}

.twin-tag {
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  flex-shrink: 0;
}

.tag-privli {
  background: var(--primary-c);
  color: var(--on-primary-c);
}

.tag-xfiles {
  background: var(--tertiary-c);
  color: var(--on-tertiary-c);
}

.twin-desc {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--on-surface-var);
  margin-bottom: 20px;
}

.twin-visual {
  margin: 16px 0 24px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background-color: var(--surface-c-lowest);
  border: 1px solid var(--outline-subtle);
  position: relative;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.twin-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease-emph);
}

.twin-card:hover .twin-visual img {
  transform: scale(1.04);
}

.twin-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--outline-subtle);
}

.twin-link {
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.link-green {
  color: var(--primary);
}
.link-blue {
  color: var(--tertiary);
}

/* ---------- Section Common ---------- */
.section {
  padding: 90px 0;
}

.section-head {
  max-width: 800px;
  margin-bottom: 48px;
}

.section-head.center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

/* ---------- Bento Grid (Privli) ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 22px;
}

.bcard {
  border-radius: var(--r-xl);
  background-color: var(--surface-c-low);
  border: 1px solid var(--outline-subtle);
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.28s var(--ease-emph);
  overflow: hidden;
  position: relative;
}

.bcard:hover {
  background-color: var(--surface-c);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.col-8 { grid-column: span 8; }
.col-7 { grid-column: span 7; }
.col-6 { grid-column: span 6; }
.col-5 { grid-column: span 5; }
.col-4 { grid-column: span 4; }
.col-12 { grid-column: span 12; }

/* Expressive Shape Icons */
.shape-bubble {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  margin-bottom: 20px;
  color: white;
}

.bubble-green { background: linear-gradient(135deg, var(--brand-green), #1b5e20); }
.bubble-blue { background: linear-gradient(135deg, var(--brand-blue), #0d47a1); }
.bubble-orange { background: linear-gradient(135deg, var(--brand-orange), #b71c1c); }
.bubble-amber { background: linear-gradient(135deg, var(--brand-amber), #e65100); }
.bubble-purple { background: linear-gradient(135deg, var(--brand-purple), #4a148c); }

.os-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.os-pill {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: 0.85rem;
  font-weight: 700;
  background-color: var(--surface-c-highest);
  color: var(--on-surface);
}

.eco-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.eco-tag {
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: 0.82rem;
  font-weight: 600;
  background-color: var(--primary-c);
  color: var(--on-primary-c);
}

/* Clipboard Sync Interactive Simulator */
.clip-sim {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  background-color: var(--surface-c-lowest);
  padding: 14px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--outline-subtle);
}

.clip-badge {
  font-size: 0.78rem;
  font-weight: 750;
  padding: 4px 10px;
  border-radius: var(--r-xs);
  background: var(--surface-c-high);
}

.clip-arrow {
  color: var(--primary);
  animation: pulseX 1.8s infinite ease-in-out;
}

@keyframes pulseX {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

/* ---------- XFiles Deep Showcase ---------- */
.edition-tabs-container {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}

.edition-tabs {
  display: inline-flex;
  padding: 6px;
  border-radius: var(--r-pill);
  background-color: var(--surface-c-high);
  border: 1px solid var(--outline-subtle);
  box-shadow: var(--shadow-sm);
}

.privli-dl-card {
  margin-top: 48px;
}

.edition-btn {
  padding: 10px 24px;
  border-radius: var(--r-pill);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--on-surface-var);
  display: flex;
  align-items: center;
  gap: 8px;
}

.edition-btn.active {
  background-color: var(--surface-c-lowest);
  color: var(--tertiary);
  box-shadow: var(--shadow-sm);
}

.edition-content {
  display: none;
}

.edition-content.active {
  display: block;
  animation: fadeIn 0.35s var(--ease-emph);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Feature Grid for Editions */
.features-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-bottom: 32px;
}

.feature-tile {
  background-color: var(--surface-c-low);
  border-radius: var(--r-xl);
  border: 1px solid var(--outline-subtle);
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s var(--ease-emph);
}

.feature-tile:hover {
  background-color: var(--surface-c);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.feature-tile-thumb {
  width: 100%;
  height: 180px;
  border-radius: var(--r-md);
  overflow: hidden;
  background-color: var(--surface-c-lowest);
  margin-bottom: 20px;
  border: 1px solid var(--outline-subtle);
}

.feature-tile-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.3s var(--ease-emph);
}

.feature-tile:hover .feature-tile-thumb img {
  transform: scale(1.05);
}

/* Comparison Matrix Table */
.matrix-card {
  border-radius: var(--r-xl);
  background-color: var(--surface-c-low);
  border: 1px solid var(--outline-subtle);
  padding: 36px;
  margin-top: 36px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 680px;
}

.matrix-table th, .matrix-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--outline-subtle);
  font-size: 0.95rem;
}

.matrix-table th {
  font-weight: 750;
  color: var(--on-surface);
  background-color: var(--surface-c);
}

.matrix-table th:first-child {
  border-top-left-radius: var(--r-md);
}
.matrix-table th:last-child {
  border-top-right-radius: var(--r-md);
}

.matrix-badge-oss {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background-color: var(--primary-c);
  color: var(--on-primary-c);
  font-weight: 700;
  font-size: 0.8rem;
}

.matrix-badge-pro {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background-color: var(--tertiary-c);
  color: var(--on-tertiary-c);
  font-weight: 700;
  font-size: 0.8rem;
}

.check-icon {
  color: var(--brand-green);
  font-weight: 800;
}
.cross-icon {
  color: var(--outline);
  opacity: 0.6;
}

/* ---------- Local-First Philosophy Section ---------- */
.manifesto-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.manifesto-card {
  background: var(--surface-c-low);
  border-radius: var(--r-xl);
  border: 1px solid var(--outline-subtle);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.manifesto-number {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--outline-var);
  line-height: 1;
}

/* ---------- Verification & Audit Section ---------- */
.audit-card {
  border-radius: var(--r-2xl);
  background: linear-gradient(135deg, var(--surface-c-high) 0%, var(--surface-c-low) 100%);
  border: 1px solid var(--outline-subtle);
  padding: 48px;
  box-shadow: var(--shadow-md);
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}

.audit-step {
  background-color: var(--surface-c-lowest);
  border-radius: var(--r-lg);
  padding: 24px;
  border: 1px solid var(--outline-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.code-snippet {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  background-color: var(--surface-c);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  color: var(--primary);
  border: 1px solid var(--outline-subtle);
  overflow-x: auto;
  user-select: all;
}

/* ---------- Store & Download Links Grid ---------- */
.store-badges-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 24px;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-radius: var(--r-lg);
  background-color: var(--surface-c-high);
  border: 1px solid var(--outline-subtle);
  transition: transform 0.22s var(--ease-emph);
}

.store-badge:hover {
  background-color: var(--surface-c-highest);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.store-badge svg {
  width: 26px;
  height: 26px;
}

.store-badge-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.store-badge-sub {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.8;
  line-height: 1.1;
}

.store-badge-name {
  font-size: 0.98rem;
  font-weight: 750;
  line-height: 1.2;
}

/* ---------- Footer ---------- */
.footer {
  background-color: var(--surface-c-low);
  border-top: 1px solid var(--outline-subtle);
  padding: 70px 0 40px;
  margin-top: 80px;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 50px;
}

.footer-brand h4 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
  line-height: 1;
}

.footer-col h5 {
  font-size: 0.95rem;
  font-weight: 750;
  margin-bottom: 16px;
  color: var(--on-surface);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  font-size: 0.9rem;
  color: var(--on-surface-var);
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--outline-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--on-surface-var);
  flex-wrap: wrap;
  gap: 16px;
}

/* ---------- Toast / Snackbar ---------- */
.snackbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--inverse-surface);
  color: var(--inverse-on-surface);
  padding: 12px 24px;
  border-radius: var(--r-pill);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: transform 0.3s var(--ease-spring), opacity 0.3s var(--ease-spring);
  z-index: 999;
  pointer-events: none;
}

.snackbar.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Desktop label defaults */
.label-full { display: inline; }
.label-short { display: none; }

.matrix-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.matrix-scroll-hint {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--tertiary);
  background-color: var(--tertiary-c);
  padding: 4px 10px;
  border-radius: var(--r-pill);
}

/* ---------- Responsive Breakpoints ---------- */
@media (max-width: 1100px) {
  /* Six labels plus the language control no longer fit inside the pill. */
  .nav-links {
    display: none;
  }
}

@media (max-width: 1024px) {
  .twins-container {
    grid-template-columns: 1fr;
  }
  .bcard.col-8, .bcard.col-7, .bcard.col-6, .bcard.col-5, .bcard.col-4 {
    grid-column: span 12;
  }
  .features-grid-3 {
    grid-template-columns: 1fr;
  }
  .manifesto-grid {
    grid-template-columns: 1fr;
  }
  .audit-grid {
    grid-template-columns: 1fr;
  }
  .footer-top {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .wrap {
    padding: 0 16px;
  }
  .section {
    padding: 32px 0;
  }
  .hero {
    padding: 24px 0 8px;
  }
  .section-head {
    margin-bottom: 20px;
  }
  .d-hero {
    font-size: clamp(1.95rem, 6.5vw, 2.75rem);
    letter-spacing: -0.025em;
  }
  .d-section {
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    letter-spacing: -0.02em;
  }
  .hero-pill-badge {
    font-size: 0.8rem;
    padding: 5px 12px;
    margin-bottom: 18px;
  }
  .hero-sub {
    margin: 16px auto 26px;
    font-size: 1rem;
    line-height: 1.5;
  }
  .hero-chips {
    gap: 8px;
    margin-bottom: 28px;
  }
  .hero-chip {
    padding: 6px 12px;
    font-size: 0.82rem;
  }
  .hero-cta-group {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
    margin: 0 auto 24px;
    gap: 12px;
  }
  .hero-cta-group .btn {
    width: 100%;
  }

  /* Toolbar */
  .nav-links {
    display: none;
  }
  .toolbar {
    padding: 8px 14px;
  }

  /* Twins Cards */
  .twin-card {
    padding: 22px 18px;
    border-radius: var(--r-xl);
  }
  .twin-app-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }
  .twin-app-meta h3 {
    font-size: 1.25rem;
  }
  .twin-visual {
    height: 180px;
    margin: 12px 0 18px;
    border-radius: var(--r-md);
  }

  /* Bento Cards */
  .bcard {
    padding: 22px 18px;
    border-radius: var(--r-lg);
  }
  .t-title-lg {
    font-size: 1.35rem;
  }
  .t-title {
    font-size: 1.15rem;
  }
  .shape-bubble {
    width: 44px;
    height: 44px;
    margin-bottom: 14px;
    border-radius: 12px;
  }

  /* Store Badges */
  .store-badges-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .store-badge {
    flex: 1 1 calc(50% - 6px);
    min-width: 130px;
    padding: 10px 12px;
    border-radius: var(--r-md);
  }
  .store-badge svg {
    width: 22px;
    height: 22px;
  }
  .store-badge-name {
    font-size: 0.88rem;
  }
  .subdomain-btn {
    width: 100% !important;
    margin-left: 0 !important;
    margin-top: 8px;
    padding: 13px 20px !important;
    justify-content: center;
    text-align: center;
  }

  .bento,
  .features-grid-3,
  .manifesto-grid {
    gap: 14px;
  }
  .twins-container {
    gap: 16px;
  }
  .privli-dl-card {
    margin-top: 40px;
  }
  .matrix-card {
    margin-top: 20px;
  }

  /* Edition Switcher */
  .edition-tabs-container {
    width: 100%;
    margin-bottom: 16px;
  }
  .edition-tabs {
    width: 100%;
    max-width: 100%;
    display: flex;
    padding: 4px;
  }
  .edition-btn {
    flex: 1;
    justify-content: center;
    padding: 9px 8px;
    font-size: 0.84rem;
    text-align: center;
    white-space: normal;
    gap: 6px;
  }
  .edition-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }
  .label-full { display: none; }
  .label-short { display: inline; }

  .feature-tile {
    padding: 20px 16px;
    border-radius: var(--r-lg);
  }
  .feature-tile-thumb {
    height: 160px;
    margin-bottom: 16px;
  }
  #contentXFilesOss > div:last-child,
  #contentXFilesPro > div:last-child {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }
  #contentXFilesOss > div:last-child .btn,
  #contentXFilesPro > div:last-child .btn {
    width: 100%;
  }

  /* Matrix Table */
  .matrix-card {
    padding: 20px 14px;
    border-radius: var(--r-lg);
    -webkit-overflow-scrolling: touch;
  }
  .matrix-scroll-hint {
    display: inline-flex;
  }
  .matrix-table th, .matrix-table td {
    padding: 12px 14px;
    font-size: 0.86rem;
  }

  /* Manifesto & Audit */
  .manifesto-card {
    padding: 22px 18px;
    border-radius: var(--r-lg);
    gap: 12px;
  }
  .manifesto-number {
    font-size: 1.8rem;
  }
  .audit-card {
    padding: 24px 16px;
    border-radius: var(--r-xl);
  }
  .audit-grid {
    gap: 16px;
    margin-top: 22px;
  }
  .audit-step {
    padding: 18px 14px;
    border-radius: var(--r-md);
  }
  .code-snippet {
    font-size: 0.74rem;
    padding: 8px 10px;
    word-break: break-all;
    white-space: pre-wrap;
  }

  /* Footer */
  .footer {
    padding: 28px 0 20px;
    margin-top: 0;
  }
  .footer-top {
    grid-template-columns: 1fr;
    gap: 28px;
    margin-bottom: 35px;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 0 10px;
    top: 10px;
  }
  .toolbar {
    padding: 7px 12px;
    border-radius: var(--r-xl);
  }
  .brand-logo {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }
  .brand-title {
    font-size: 1.1rem;
  }
  .brand-badge {
    display: none;
  }
  .nav-github-btn {
    display: none;
  }
  .toggle-opt {
    padding: 4px 8px;
    font-size: 0.76rem;
  }
  .theme-btn {
    width: 32px;
    height: 32px;
  }
  .twin-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    text-align: center;
  }
  .twin-bottom .btn-sm {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .twin-title-row {
    flex-wrap: wrap;
    gap: 6px;
  }
}

@media (max-width: 380px) {
  .store-badge {
    flex: 1 1 100%;
  }
  .edition-btn {
    font-size: 0.78rem;
    padding: 8px 4px;
  }
}

/* ================= RTL Support (Arabic / dir="rtl") ================= */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .topbar .toolbar {
  flex-direction: row;
}

[dir="rtl"] .brand-link {
  flex-direction: row;
}

[dir="rtl"] .brand-title {
  margin-left: 0;
  margin-right: 10px;
}

[dir="rtl"] .nav-actions {
  flex-direction: row;
}

[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
  transform-origin: top left;
}

[dir="rtl"] .lang-option {
  text-align: right;
  flex-direction: row;
}

[dir="rtl"] .section-head.center {
  text-align: center;
}

[dir="rtl"] .manifesto-card,
[dir="rtl"] .bcard,
[dir="rtl"] .feature-tile,
[dir="rtl"] .audit-step {
  text-align: right;
}

[dir="rtl"] .matrix-table th,
[dir="rtl"] .matrix-table td {
  text-align: right;
}

[dir="rtl"] .matrix-card > div:last-child {
  text-align: left !important;
}

[dir="rtl"] .code-snippet {
  direction: ltr;
  text-align: left;
}

[dir="rtl"] .footer-brand,
[dir="rtl"] .footer-col {
  text-align: right;
}

[dir="rtl"] .footer-links {
  padding-right: 0;
}

[dir="rtl"] .twin-link svg,
[dir="rtl"] .btn svg:last-child {
  transform: scaleX(-1);
}

[dir="rtl"] .matrix-scroll-hint svg {
  transform: scaleX(-1);
}

/* ---------- Mobile Language Selector Adaptations ---------- */
@media (max-width: 640px) {
  .lang-trigger-btn {
    padding: 0 8px;
    height: 34px;
    gap: 5px;
    font-size: 0.78rem;
  }
  .lang-menu {
    min-width: 200px;
    max-height: 320px;
  }
}
