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

/* ── Theme variables ───────────────────────────────── */
:root {
  --primary: #333333;
  --on-primary: #ffffff;
  --background: #ffffff;
  --surface: #f8f8f8;
  --dark-gray: #666666;
  --border: #e0e0e0;
  --text: #333333;
  --primary-shadow: #f0f0f0;
  --header-bg: #333333;
  --delete: #bc5839;
  --info: #496a6d;
  --card-radius: 20px;
  --board-chip-bg: #f0f0f0;
  --board-chip-text: #333333;
  --overlay: rgba(0, 0, 0, 0.04);
  --macro-calories: #3a3a3a;
  --macro-carbs: #8ead70;
  --macro-protein: #81b2d0;
  --macro-fat: #cda462;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #ffffff;
    --on-primary: #333333;
    --background: #141414;
    --surface: #1e1e1e;
    --dark-gray: #cccccc;
    --border: #3c3c3c;
    --text: #ffffff;
    --primary-shadow: #505050;
    --header-bg: #1a1a1a;
    --board-chip-bg: #333333;
    --board-chip-text: #ffffff;
    --overlay: rgba(255, 255, 255, 0.04);
    --macro-calories: #aaaaaa;
  }
}

/* Explicit dark mode (overrides media query) */
html[data-theme="dark"] {
  --primary: #ffffff;
  --on-primary: #333333;
  --background: #141414;
  --surface: #1e1e1e;
  --dark-gray: #cccccc;
  --border: #3c3c3c;
  --text: #ffffff;
  --primary-shadow: #505050;
  --header-bg: #1a1a1a;
  --board-chip-bg: #333333;
  --board-chip-text: #ffffff;
  --overlay: rgba(255, 255, 255, 0.04);
  --macro-calories: #aaaaaa;
}

/* Explicit light mode (overrides media query) */
html[data-theme="light"] {
  --primary: #333333;
  --on-primary: #ffffff;
  --background: #ffffff;
  --surface: #f8f8f8;
  --dark-gray: #666666;
  --border: #e0e0e0;
  --text: #333333;
  --primary-shadow: #f0f0f0;
  --header-bg: #333333;
  --board-chip-bg: #f0f0f0;
  --board-chip-text: #333333;
  --overlay: rgba(0, 0, 0, 0.04);
  --macro-calories: #3a3a3a;
}

/* ── Base ───────────────────────────────────────────── */
body {
  font-family:
    "Poppins",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  background: var(--background);
  color: var(--text);
  overflow-x: hidden;
}

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

/* ── Site header ─────────────────────────────────── */
.site-header {
  background: var(--header-bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.site-header .logo .logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.site-header nav {
  display: flex;
  gap: 24px;
  font-size: 14px;
  font-weight: 500;
}

.site-header nav a {
  color: rgba(255, 255, 255, 0.8);
  transition: color 0.15s;
}

.site-header nav a:hover {
  color: #fff;
}

/* Hamburger button – hidden on desktop */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  position: relative;
  width: 32px;
  height: 32px;
}

.nav-toggle i {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition:
    opacity 0.2s ease,
    transform 0.25s ease;
}

.nav-toggle .nav-icon-hide {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg);
}

.nav-toggle .nav-icon-show {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg);
}

/* ── Site footer ─────────────────────────────────── */
.site-footer {
  margin-top: 80px;
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--dark-gray);
  border-top: 1px solid var(--border);
}

/* ── Hero section ────────────────────────────────── */
.hero {
  background: var(--header-bg);
  color: #fff;
  text-align: center;
  padding: 80px 24px 100px;
}

.hero h1 {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero p {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  opacity: 0.8;
  max-width: 480px;
  margin: 0 auto 32px;
  line-height: 1.5;
}

.hero .app-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: #333;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  transition: opacity 0.15s;
}

.hero .app-btn:hover {
  opacity: 0.9;
}

/* ── Content container ───────────────────────────── */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Feature section ─────────────────────────────── */
.features {
  padding: 64px 24px;
  max-width: 900px;
  margin: 0 auto;
}

.features h2 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 40px;
  color: var(--text);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--surface);
  border-radius: var(--card-radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feature-card .icon {
  width: 44px;
  height: 44px;
  background: var(--primary-shadow);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-card .icon i {
  font-size: 22px;
  color: var(--text);
}

.feature-card h3 {
  font-size: 16px;
  font-weight: 700;
}

.feature-card p {
  font-size: 14px;
  color: var(--dark-gray);
  line-height: 1.55;
}

/* ── CTA section ─────────────────────────────────── */
.cta {
  background: var(--surface);
  padding: 64px 24px;
  text-align: center;
}

.cta h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.cta p {
  color: var(--dark-gray);
  font-size: 15px;
  margin-bottom: 28px;
}

.btn-primary {
  display: inline-block;
  background: var(--primary);
  color: var(--on-primary);
  padding: 12px 28px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  transition: opacity 0.15s;
}

.btn-primary:hover {
  opacity: 0.8;
}

.btn-secondary {
  display: inline-block;
  background: transparent;
  color: var(--primary);
  padding: 10px 24px;
  border-radius: 12px;
  border: 2px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.btn-secondary:hover {
  border-color: var(--primary);
  background: var(--overlay);
}

/* ── Home: How It Works section ──────────────────── */
.home-hiw {
  padding: 64px 24px;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.home-hiw > h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.home-hiw-subtitle {
  font-size: 15px;
  color: var(--dark-gray);
  margin-bottom: 40px;
}

.home-hiw-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 28px;
  text-align: center;
}

.home-hiw-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.home-hiw-step .hiw-number {
  margin-bottom: 4px;
}

.home-hiw-step h3 {
  font-size: 16px;
  font-weight: 700;
}

.home-hiw-step p {
  font-size: 14px;
  color: var(--dark-gray);
  line-height: 1.55;
  max-width: 220px;
}

.home-hiw-step a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.home-hiw-more {
  margin-top: 36px;
}

/* ── Detail page (recipe) ─────────────────────────── */
.detail-page {
  min-height: 100vh;
}

.detail-hero {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.detail-hero img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--primary-shadow);
}

.detail-hero .gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.45) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  pointer-events: none;
}

.detail-body {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 25px 100px;
}

.detail-body h1 {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
}

.detail-body .description {
  margin-top: 16px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--dark-gray);
}

/* ── Tags / chips ──────────────────────────────────── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.tag-chip.board {
  background: var(--board-chip-bg);
  color: var(--primary);
}

.tag-chip.board i {
  font-size: 14px;
  color: var(--primary);
}

.tag-chip.colored {
  border: 1px solid var(--chip-color, #888);
  color: var(--chip-color, #888);
  background: transparent;
}

.tag-chip.colored .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chip-color, #888);
}

/* ── Sections ───────────────────────────────────────── */
.recipe-section {
  margin-top: 28px;
}

.recipe-section h2 {
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Directions ─────────────────────────────────────── */
.direction-step {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}

.step-number {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.step-heading {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.step-text {
  font-size: 15px;
  line-height: 1.55;
  color: var(--dark-gray);
}

/* ── Ingredients ────────────────────────────────────── */
.ingredient-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.ingredient-item:last-child {
  border-bottom: none;
}

.ingredient-qty {
  font-weight: 600;
  white-space: nowrap;
  min-width: 70px;
}

.ingredient-name {
  flex: 1;
}

/* ── Nutrition ──────────────────────────────────────── */
.nutrition-summary {
  margin-bottom: 18px;
}

.nutrition-summary .energy-line {
  font-size: 15px;
  margin-bottom: 4px;
}

.nutrition-summary .energy-label {
  color: var(--dark-gray);
}

.nutrition-summary .energy-value {
  font-weight: 600;
}

.macros-line {
  font-size: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: baseline;
}

.macro-label {
  color: var(--dark-gray);
}

.macro-value {
  font-weight: 600;
}

.macro-sep {
  color: var(--dark-gray);
  margin: 0 4px;
}

.nutrition-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.nutrition-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nutrition-bar-label {
  font-size: 13px;
  font-weight: 600;
  min-width: 64px;
  text-align: right;
}

.nutrition-bar-track {
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: var(--primary-shadow);
  overflow: hidden;
}

.nutrition-bar-fill {
  height: 100%;
  border-radius: 5px;
}

.nutrition-bar-amount {
  font-size: 13px;
  color: var(--dark-gray);
  min-width: 44px;
}

.nutrition-items {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

.nutrition-items th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--dark-gray);
  padding: 6px 8px;
  border-bottom: 2px solid var(--border);
}

.nutrition-items th:not(:first-child) {
  text-align: right;
}

.nutrition-items td {
  font-size: 14px;
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
}

.nutrition-items td:not(:first-child) {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--dark-gray);
}

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

/* ── Video embed ────────────────────────────────────── */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Branding footer ────────────────────────────────── */
.platify-footer {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 25px 40px;
  text-align: center;
}

.platify-footer .badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  background: var(--primary-shadow);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s;
}

.platify-footer .badge .badge-icon {
  width: 24px;
  height: 24px;
  border-radius: 5px;
}

.platify-footer .badge:hover {
  opacity: 0.75;
}

/* ── Placeholder image ──────────────────────────────── */
.placeholder-img {
  background: var(--primary-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
}

/* ── Error state ────────────────────────────────────── */
.error-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--dark-gray);
}

.error-state h2 {
  font-size: 22px;
  margin-bottom: 8px;
  color: var(--text);
}

.error-state p {
  font-size: 15px;
  line-height: 1.5;
}

/* ── Theme toggle button ────────────────────────────── */
.theme-toggle-btn {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition:
    background 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}

.theme-toggle-btn:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ── Info pages (shared) ─────────────────────────────── */
.info-hero {
  background: var(--header-bg);
  color: #fff;
  text-align: center;
  padding: 60px 24px 70px;
}

.info-hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.info-hero p {
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  opacity: 0.8;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.5;
}

.info-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 0;
}

/* ── FAQ page ───────────────────────────────────────── */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--surface);
  border-radius: var(--card-radius);
  overflow: hidden;
  transition: background 0.15s;
}

.faq-question {
  display: flex;
  align-items: center;
  padding: 18px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::before {
  content: "\EA13";
  font-family: "remixicon" !important;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 400;
  margin-right: 16px;
  transition: transform 0.25s ease;
}

details[open] > .faq-question::before {
  transform: rotate(45deg);
}

.faq-answer {
  padding: 0 24px 0 68px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--dark-gray);
  overflow: hidden;
}

details[open] > .faq-answer {
  padding: 0 24px 20px 68px;
}

.faq-answer a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Contact page ───────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.contact-card {
  background: var(--surface);
  border-radius: var(--card-radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-shadow);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-icon i {
  font-size: 22px;
  color: var(--text);
}

.contact-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
}

.contact-card p {
  font-size: 14px;
  color: var(--dark-gray);
  line-height: 1.55;
}

.contact-link {
  display: inline-block;
  margin-top: auto;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-all;
}

.contact-note {
  text-align: center;
  font-size: 14px;
  color: var(--dark-gray);
  line-height: 1.55;
}

.contact-note a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── How It Works page ──────────────────────────────── */
.hiw-step {
  display: flex;
  gap: 20px;
  margin-bottom: 40px;
}

.hiw-number {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
}

.hiw-content h2 {
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
  margin-bottom: 8px;
}

.hiw-content p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--dark-gray);
}

.hiw-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hiw-extras {
  margin-top: 24px;
  margin-bottom: 48px;
}

.hiw-extras > h2 {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 28px;
}

.hiw-extras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}

.hiw-extra-card {
  background: var(--surface);
  border-radius: var(--card-radius);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hiw-extra-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-shadow);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hiw-extra-icon i {
  font-size: 20px;
  color: var(--text);
}

.hiw-extra-card h3 {
  font-size: 15px;
  font-weight: 700;
}

.hiw-extra-card p {
  font-size: 14px;
  color: var(--dark-gray);
  line-height: 1.55;
}

.hiw-cta {
  text-align: center;
  padding: 48px 0;
  border-top: 1px solid var(--border);
}

.hiw-cta h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.hiw-cta p {
  font-size: 15px;
  color: var(--dark-gray);
  margin-bottom: 24px;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 600px) {
  .nav-toggle {
    display: block;
  }

  .site-header nav {
    display: flex;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--header-bg);
    flex-direction: column;
    padding: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition:
      max-height 0.3s ease,
      opacity 0.2s ease,
      padding 0.3s ease;
  }

  .site-header nav.open {
    max-height: 300px;
    opacity: 1;
    padding: 8px 0 16px;
  }

  .site-header nav a {
    padding: 12px 24px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.85);
    transform: translateY(-8px);
    opacity: 0;
    transition:
      transform 0.25s ease,
      opacity 0.25s ease,
      background 0.15s;
  }

  .site-header nav.open a {
    transform: translateY(0);
    opacity: 1;
  }

  .site-header nav.open a:nth-child(1) {
    transition-delay: 0.05s;
  }
  .site-header nav.open a:nth-child(2) {
    transition-delay: 0.1s;
  }
  .site-header nav.open a:nth-child(3) {
    transition-delay: 0.15s;
  }
  .site-header nav.open a:nth-child(4) {
    transition-delay: 0.2s;
  }

  .site-header nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
  }

  .detail-body {
    padding: 16px 16px 80px;
  }

  .platify-footer {
    padding: 0 16px 40px;
  }
}
