/* =========================
   Fonts — Quicksand (local)
   ========================= */

@font-face {
  font-family: "Quicksand";
  src: url("./assets/fonts/Quicksand/Quicksand-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Quicksand";
  src: url("./assets/fonts/Quicksand/Quicksand-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Quicksand";
  src: url("./assets/fonts/Quicksand/Quicksand-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Quicksand";
  src: url("./assets/fonts/Quicksand/Quicksand-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* =========================
   Global reset & base
   ========================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  color-scheme: light dark;
  height: 100%;
  font-family: "Quicksand", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background-color: var(--bg);
}

/* Prevent placeholder flash for language/theme-specific app screens */
img[data-appscreen] {
  opacity: 0;
  transition: opacity 160ms ease;
}

html.mt-screens-ready img[data-appscreen] {
  opacity: 1;
}

/* =========================
   Theme (auto: light/dark)
   ========================= */

:root {
  color-scheme: light dark;

  --bg: #0e1111;
  --text: #ffffff;
  --muted: #aab7b4;
  --brand: #2f80ed;            /* MilkTune medium blue */
  --brand-strong: #1f6fe0;     /* hover/active */
  --brand-contrast: #ffffff;   /* text on brand */
  --brand-soft: rgba(47, 128, 237, 0.14);

  --header-bg: rgba(14, 17, 17, 0.65);
  --header-link: #e6f0ee;

  --footer-border: rgba(255, 255, 255, 0.08);

  --btn-primary-bg: var(--brand);
  --btn-primary-text: var(--brand-contrast);
  --btn-secondary-bg: rgba(255, 255, 255, 0.14);
  --btn-secondary-text: var(--text);

  --overlay-top: rgba(14, 17, 17, 0.75);
  --overlay-mid: rgba(14, 17, 17, 0.55);
  --overlay-bottom: rgba(14, 17, 17, 0.85);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f8;
    --text: #0e1111;
    --muted: #5f6b67;
    --brand: #2f80ed;
    --brand-strong: #1f6fe0;
    --brand-contrast: #ffffff;
    --brand-soft: rgba(47, 128, 237, 0.12);

    --header-bg: rgba(246, 247, 248, 0.78);
    --header-link: #0e1111;

    --footer-border: rgba(14, 17, 17, 0.10);

    --btn-primary-bg: var(--brand);
    --btn-primary-text: var(--brand-contrast);
    --btn-secondary-bg: rgba(14, 17, 17, 0.08);
    --btn-secondary-text: var(--text);

    --overlay-top: rgba(246, 247, 248, 0.123);
    --overlay-mid: rgba(246, 247, 248, 0.523);
    --overlay-bottom: rgba(246, 247, 248, 0.542);
  }
}

/* =========================
   Header
   ========================= */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 96px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  z-index: 100;
}

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-header .brand a {
  display: flex;
  text-decoration: none;
}

.site-header .brand img {
  height: 72px;
  width: auto;
  border-radius: 10px;
  overflow: hidden;
}

.site-header nav {
  display: flex;
  gap: 36px; /* +50% spacing */
}

.site-header nav a {
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--header-link);
  opacity: 0.9;
  padding: 0 4px; /* subtle breathing room */
  transition: opacity 0.2s ease;
}

.site-header nav a:hover {
  opacity: 1;
}

/* =========================
   Hero / Index
   ========================= */

.hero {
  min-height: 100vh;
  width: 100%;
  padding: 128px 32px 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: url("./assets/images/milkTune_microHerd.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    var(--overlay-top) 0%,
    var(--overlay-mid) 40%,
    var(--overlay-bottom) 100%
  );
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  width: min(1100px, 100%);
}

.hero-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 140px;
}

.hero-app {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 80px;
  padding-right: 0;
}

.hero-app-image {
  width: min(220px, 22vw);
  height: auto;
  border-radius: 42px;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.32),
    0 2px 8px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* App-screen images (language/theme-specific) are already “ready” assets.
   When an app screen is injected via data-appscreen, do NOT apply the old frame.
   Also make it larger on the index hero. */
.hero-app-image[data-appscreen] {
  width: min(520px, 42vw);
  height: auto;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

@media (prefers-color-scheme: light) {
  .hero-app-image {
    border: 1px solid rgba(14, 17, 17, 0.12);
    box-shadow:
      0 18px 44px rgba(0, 0, 0, 0.22),
      0 2px 10px rgba(0, 0, 0, 0.16);
  }
}

.hero-text {
  flex: 1 1 520px;
  max-width: 720px;
  text-align: left;
}

.hero-text h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 20px;
}

/* =========================
   i18n bilingual stack
   - secondary line always small & consistent
   ========================= */

.i18n-stack {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
}

.i18n-primary {
  font: inherit;
  line-height: inherit;
}

/* Secondary line is ALWAYS a small caption (fixed size), regardless of parent font-size */
.i18n-secondary {
  font-size: 0.78rem;
  line-height: 1.15;
  font-weight: 500;
  opacity: 0.72;
}

/* Force the same secondary size inside large headings */
h1 .i18n-secondary,
h2 .i18n-secondary,
h3 .i18n-secondary {
  font-size: 0.78rem;
}

@media (max-width: 640px) {
  .i18n-stack {
    gap: 5px;
  }

  .i18n-secondary,
  h1 .i18n-secondary,
  h2 .i18n-secondary,
  h3 .i18n-secondary {
    font-size: 0.72rem;
  }
}

.hero-text p {
  font-size: 1.05rem;
  line-height: 1.6;
  opacity: 0.92;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  justify-content: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-actions a {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hero-actions a.primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}

.hero-actions a.primary:hover {
  background: var(--brand-strong);
}

.hero-actions a.secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
}

.hero-actions a:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  opacity: 1;
}

.site-header nav a:focus-visible,
.hero-actions a:focus-visible {
  outline: 3px solid var(--brand-soft);
  outline-offset: 3px;
  border-radius: 8px;
}

/* =========================
   Footer
   ========================= */

.site-footer {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  background-color: var(--bg);
  border-top: 1px solid var(--footer-border);
}

/* =========================
   Responsive tweaks
   ========================= */

@media (min-width: 1200px) {
  .hero-app {
    padding-left: 60px;
  }

  .hero-text {
    padding-right: 40px;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding: 0 18px;
    height: 87px;
  }

  .site-header nav {
    gap: 16px;
  }

  .hero {
    padding: 118px 20px 56px;
  }

  .hero-text p {
    font-size: 1rem;
  }

  .hero-layout {
    flex-direction: column;
    gap: 28px;
  }

  .hero-app {
    padding-left: 0;
    padding-right: 0;
  }

  .hero-text {
    text-align: center;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-app-image {
    width: min(200px, 60vw);
    border-radius: 32px;
  }

  .hero-app-image[data-appscreen] {
    width: min(460px, 92vw);
    border: none;
    box-shadow: none;
    border-radius: 0;
  }
}

@media (min-width: 1400px) {
  .hero-layout {
    gap: 180px;
  }

  .hero-app {
    padding-left: 120px;
  }
}

/* =========================
   Text Pages (Manual, Privacy)
   ========================= */

.text-page {
  max-width: 880px;
  margin: 0 auto;
  padding: 140px 24px 80px;
}

.text-page h1 {
  font-size: 2.5rem;
  margin-bottom: 48px;
  color: var(--brand);
  text-align: center;
}

.text-page h3 {
  margin-top: 32px;
  margin-bottom: 12px;
}

.text-page div p {
  font-size: 0.8rem;
  line-height: 1.6;
  margin-left: 54px;
  margin-bottom: 16px;
  opacity: 0.9;
}

.text-page div ul {
  font-size: 0.8rem;
  line-height: 1.6;
  margin-left: 68px;
  margin-bottom: 24px;
  opacity: 0.9;
}

.text-page li {
  margin-bottom: 8px;
}

/* =========================
   Mobile header (hamburger)
   ========================= */

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--header-link);
  font-size: 1.4rem;
  cursor: pointer;
}

/* Mobile layout */
@media (max-width: 768px) {
  .site-header nav {
    position: relative;
  }

  .nav-toggle {
    display: block;
    margin-right: 8px;
  }

  .site-header nav .nav-links {
    position: absolute;
    top: 96px;
    right: 0;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    display: none;
    flex-direction: column;
    gap: 20px;
    padding: 20px 28px;
    border-radius: 0 0 12px 12px;
  }

  /* Open menu when nav is focused */
  .site-header nav:focus-within .nav-links {
    display: flex;
  }
}

/* =========================
   Mobile hero background fix
   ========================= */

@media (max-width: 768px) {
  .hero {
    background-position: left center;
  }
}