/* Leanbud website — palette mirrors lib/app/theme/colors.dart. */

@font-face {
  font-family: 'DM Sans';
  src: url('/assets/DMSans-Variable.ttf') format('truetype');
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  --forest: #163d2f;
  --lime: #d9f99d;
  --lime-fg: #365314;
  --bg: #f6f3e9;
  --surface: #fffdf4;
  --tint: #efe9e3;
  --divider: #e8e2dc;
  --text: #0f1a14;
  --text-2: #6b7065;
  --link: #163d2f;
  --hero-bg: #163d2f;
  --hero-text: #f6f3e9;
  color-scheme: light;
}

/* Light is the default; theme.js sets data-theme="dark" when the visitor
   picks dark with the header switch. */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #16130f;
  --surface: #221f1a;
  --tint: #2a2620;
  --divider: #322d26;
  --text: #f0edea;
  --text-2: #a8a29c;
  --link: #d9f99d;
  --hero-bg: #0f2a20;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

a {
  color: var(--link);
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}

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

.site-header {
  padding: 20px 0;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  font-size: 20px;
}

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

.site-header nav a {
  color: inherit;
  text-decoration: none;
  margin-left: 20px;
  font-size: 15px;
  opacity: 0.85;
}

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

.site-header nav {
  display: flex;
  align-items: center;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: 18px;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  opacity: 0.85;
  cursor: pointer;
}

.theme-toggle:hover {
  opacity: 1;
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

/* Show the moon in light mode (tap for dark), the sun in dark mode. */
.theme-toggle .sun,
:root[data-theme='dark'] .theme-toggle .moon {
  display: none;
}

:root[data-theme='dark'] .theme-toggle .sun {
  display: block;
}

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

.hero {
  background: var(--hero-bg);
  color: var(--hero-text);
  padding: 0 0 80px;
}

.hero .site-header {
  margin-bottom: 40px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 48px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(36px, 6vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}

.hero h1 em {
  font-style: normal;
  color: var(--lime);
}

.hero p.lede {
  font-size: 19px;
  margin: 0 0 32px;
  opacity: 0.85;
  max-width: 34em;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.badges a {
  display: inline-block;
  line-height: 0;
}

.badge-apple {
  height: 48px;
  width: auto;
}

/* Google's PNG has transparent padding baked in; scale it up and pull the
   padding back so both badges read at the same visual size. */
.badge-google {
  height: 71px;
  width: auto;
  margin: -11.5px -9px;
}

/* Mock scan-result card in the hero. */
.scan-card {
  background: var(--surface);
  color: var(--text);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  max-width: 380px;
  justify-self: center;
  width: 100%;
}

.scan-card .label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 0 0 6px;
}

.scan-card .meal {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 16px;
  line-height: 1.2;
}

.scan-card .kcal {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 16px;
}

.scan-card .kcal strong {
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.scan-card .kcal span {
  color: var(--text-2);
}

.macros {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.macro {
  background: var(--tint);
  border-radius: 14px;
  padding: 10px 12px;
}

.macro b {
  display: block;
  font-size: 18px;
}

.macro small {
  color: var(--text-2);
  font-size: 13px;
}

.macro i {
  display: block;
  height: 4px;
  border-radius: 2px;
  margin-top: 8px;
}

.score {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--divider);
  padding-top: 16px;
  font-size: 15px;
}

.score .ring {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #047857;
  background: radial-gradient(var(--surface) 62%, transparent 63%),
    conic-gradient(#10b981 0 80%, var(--divider) 80% 100%);
}

/* ---------- Sections ---------- */

section {
  padding: 80px 0;
}

section h2 {
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}

section p.sub {
  color: var(--text-2);
  margin: 0 0 40px;
  max-width: 36em;
}

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.feature {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 20px;
  padding: 24px;
}

.feature .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--lime);
  color: var(--lime-fg);
  margin-bottom: 16px;
}

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

.feature h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.feature p {
  margin: 0;
  color: var(--text-2);
  font-size: 16px;
}

.pro {
  background: var(--tint);
}

.pro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

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

.pro li {
  padding: 12px 0 12px 32px;
  border-bottom: 1px solid var(--divider);
  position: relative;
}

.pro li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 17px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--forest)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d9f99d' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E")
    center / 12px no-repeat;
}

.support-box {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 20px;
  padding: 32px;
}

.support-box p {
  margin: 0 0 12px;
}

.support-box p:last-child {
  margin-bottom: 0;
}

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

.site-footer {
  border-top: 1px solid var(--divider);
  padding: 32px 0 48px;
  color: var(--text-2);
  font-size: 15px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
}

.site-footer nav a {
  color: inherit;
  margin-right: 20px;
}

/* ---------- Legal pages ---------- */

.legal {
  padding: 24px 0 80px;
}

.legal .wrap {
  max-width: 760px;
}

.legal h1 {
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 24px 0 8px;
}

.legal .meta {
  color: var(--text-2);
  margin: 0 0 32px;
}

.legal h2 {
  font-size: 22px;
  margin: 40px 0 12px;
}

.legal ul {
  padding-left: 22px;
}

.legal li {
  margin-bottom: 8px;
}

.table-scroll {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--divider);
  border-radius: 14px;
  background: var(--surface);
}

.legal table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
}

.legal th,
.legal td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
}

.legal tr:last-child td {
  border-bottom: none;
}

.legal th {
  background: var(--tint);
  font-weight: 600;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .hero {
    padding-bottom: 64px;
  }

  .hero .site-header {
    margin-bottom: 24px;
  }

  .hero-grid,
  .pro-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .scan-card {
    justify-self: start;
  }

  .features {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }

  .wrap {
    padding: 0 16px;
  }

  .site-header nav a {
    margin-left: 14px;
  }

  .theme-toggle {
    margin-left: 14px;
  }

  .features {
    grid-template-columns: 1fr;
  }

  section {
    padding: 56px 0;
  }

  .support-box {
    padding: 24px;
  }
}

/* Logo + three links + switch don't fit on the narrowest phones; the
   Features anchor is the least needed. */
@media (max-width: 420px) {
  .site-header nav a.nav-features {
    display: none;
  }
}
