/* MagisterX landing page. Mobile-first: the base styles are the phone layout, media queries add columns.
   Colors are the app's tokens (app/src/index.css), so the site and the PWA look like one product. */

:root {
  color-scheme: light dark;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-2: #edf2ef;
  --fg: #0f1a15;
  --muted: #5b6962;
  --border: #dbe4de;
  --accent: #059669;
  --accent-strong: #047857;
  --accent-fg: #ffffff;
  --accent-soft: #d1fae5;
  --protein: #0ea5e9;
  --carbs: #fbbf24;
  --fat: #f43f5e;
  --radius: 24px;
  --gutter: 16px;
  --shadow: 0 1px 2px rgb(15 26 21 / 0.05), 0 12px 32px -12px rgb(15 26 21 / 0.18);
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a100e;
    --surface: #131b18;
    --surface-2: #1b2622;
    --fg: #e7eeea;
    --muted: #93a39b;
    --border: #25312c;
    --accent: #10b981;
    --accent-strong: #34d399;
    --accent-fg: #03140d;
    --accent-soft: #0f2e22;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 16px 40px -16px rgb(0 0 0 / 0.6);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  line-height: 1.2;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

/* ---- Buttons (44 px+ tap targets) ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 150ms,
    transform 150ms;
}

.btn-primary {
  width: 100%;
  min-height: 52px;
  padding: 0 28px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 1.0625rem;
  box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--accent) 70%, transparent);
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-small {
  padding: 0 14px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.875rem;
}

.btn-icon {
  width: 20px;
  height: 20px;
}

/* ---- Header ---- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  min-height: 44px;
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.lang-switch {
  display: flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.lang-switch a {
  display: grid;
  place-items: center;
  min-width: 40px;
  min-height: 36px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}

.lang-switch a[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* Narrow phones: the hero's big button is right below, so the header keeps only brand + language. */
@media (max-width: 379px) {
  .topbar .btn-small {
    display: none;
  }
}

/* ---- Hero ---- */

.hero {
  padding: 40px 0 56px;
}

.hero-inner {
  display: grid;
  gap: 40px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.8125rem;
  font-weight: 600;
}

.eyebrow-icon {
  width: 16px;
  height: 16px;
}

.hero h1 {
  margin-top: 18px;
  font-size: clamp(2rem, 8.5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lead {
  margin-top: 16px;
  color: var(--muted);
  font-size: clamp(1.0625rem, 3.6vw, 1.25rem);
}

.hero .btn-primary {
  margin-top: 28px;
}

.note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

/* ---- Cards ---- */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* Mock of the app's nutrition card */
.hero-visual {
  display: flex;
  justify-content: center;
}

.nutrition {
  width: 100%;
  max-width: 400px;
  padding: 18px;
}

.nutrition-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.meal {
  margin-top: 2px;
  font-weight: 600;
  line-height: 1.3;
}

.kcal {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1;
  white-space: nowrap;
}

.kcal span {
  color: var(--accent-strong);
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.macro-bar {
  display: flex;
  gap: 2px;
  height: 8px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.macro-protein {
  background: var(--protein);
}

.macro-carbs {
  background: var(--carbs);
}

.macro-fat {
  background: var(--fat);
}

.macro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.macro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: 16px;
  background: var(--surface-2);
  text-align: center;
}

.macro-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.25;
}

.macro strong {
  margin-top: auto;
  font-variant-numeric: tabular-nums;
}

.dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.items {
  margin-top: 8px;
}

.items li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.items li:first-child {
  border-top: 0;
}

.items small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.item-kcal {
  flex-shrink: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---- Features ---- */

.features {
  padding: 16px 0 56px;
}

.features h2,
.closing h2 {
  font-size: clamp(1.5rem, 5.5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.015em;
}

.feature-grid {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.feature {
  padding: 20px;
}

.feature-icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.icon {
  width: 22px;
  height: 22px;
}

.feature h3,
.more h3 {
  margin-top: 14px;
  font-size: 1.125rem;
}

.feature p,
.more p {
  margin-top: 6px;
  color: var(--muted);
}

.more {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding: 20px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: var(--radius);
}

.more h3 {
  margin-top: 0;
}

/* ---- Closing ---- */

.closing {
  padding: 8px 0 64px;
}

.closing-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.closing img {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  box-shadow: 0 12px 28px -12px color-mix(in srgb, var(--accent) 70%, transparent);
}

.closing h2 {
  margin-top: 18px;
}

.closing p {
  margin-top: 8px;
  color: var(--muted);
}

.closing .btn-primary {
  margin-top: 24px;
}

/* 404 page: the closing block on its own, centered */
.not-found {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 48px 0;
}

.not-found h1 {
  margin-top: 18px;
  font-size: clamp(1.5rem, 5.5vw, 2.25rem);
  font-weight: 800;
}

/* ---- Footer ---- */

.footer {
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 20px;
  padding-bottom: 20px;
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 4px;
}

.footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  text-decoration: none;
}

.footer nav a:hover {
  color: var(--fg);
}

/* ---- Larger screens ---- */

@media (min-width: 640px) {
  :root {
    --gutter: 24px;
  }

  .btn-primary {
    width: auto;
  }

  .note {
    text-align: left;
  }

  .hero {
    padding: 64px 0 72px;
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}

@media (min-width: 960px) {
  :root {
    --gutter: 32px;
  }

  .hero {
    padding: 88px 0 96px;
  }

  .hero-inner {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: center;
    gap: 64px;
  }

  .hero-visual {
    justify-content: flex-end;
  }

  .nutrition {
    padding: 22px;
    transform: rotate(1.5deg);
  }

  .feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .feature {
    padding: 24px;
  }

  .closing {
    padding-bottom: 88px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }

  .nutrition {
    transform: none !important;
  }
}
