:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #fff8ec;
  --ink: #1d2433;
  --muted: #667085;
  --brand: #16615a;
  --brand-2: #e89b3f;
  --brand-soft: #dff2ee;
  --danger: #b42318;
  --success: #147c4d;
  --line: #e6dfd4;
  --shadow: 0 20px 60px rgba(29, 36, 51, 0.08);
  --radius: 22px;
  --radius-sm: 14px;
  --container: 1160px;
  --tap: 46px;
  --heading: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(22, 97, 90, 0.12), transparent 34rem),
    radial-gradient(circle at top right, rgba(232, 155, 63, 0.16), transparent 30rem),
    var(--bg);
  font-family: var(--body);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, canvas, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .56; cursor: not-allowed; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: #fff;
  padding: .7rem 1rem;
  border-radius: 999px;
  z-index: 1000;
}
.skip-link:focus { top: 1rem; }

.container { width: min(100% - 2rem, var(--container)); margin-inline: auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 99;
  backdrop-filter: blur(16px);
  background: rgba(247, 244, 238, .82);
  border-bottom: 1px solid rgba(230, 223, 212, .72);
}
.nav-wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 76px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--ink);
  font-family: var(--heading);
  font-weight: 800;
  letter-spacing: -.04em;
  font-size: 1.12rem;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #0b403b);
  box-shadow: 0 10px 24px rgba(22, 97, 90, .25);
}
.nav-toggle {
  display: none;
  width: var(--tap);
  height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
}
.nav-links { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.nav-links a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: .55rem .8rem;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 700;
  font-size: .92rem;
}
.nav-links a:hover, .nav-links a[aria-current="page"] {
  background: var(--brand-soft);
  text-decoration: none;
  color: #0b403b;
}

.hero { padding: 5rem 0 3rem; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: #0b403b;
  font-weight: 800;
  background: var(--brand-soft);
  border: 1px solid rgba(22, 97, 90, .18);
  border-radius: 999px;
  padding: .38rem .76rem;
  font-size: .86rem;
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(280px, .82fr); gap: 2rem; align-items: center; }
h1, h2, h3 { font-family: var(--heading); line-height: 1.04; letter-spacing: -.045em; margin: 0 0 1rem; }
h1 { font-size: clamp(2.45rem, 7vw, 5.4rem); max-width: 950px; }
h2 { font-size: clamp(1.75rem, 4vw, 3rem); }
h3 { font-size: clamp(1.25rem, 2.6vw, 1.8rem); }
p { margin: 0 0 1rem; color: var(--muted); }
.lede { font-size: clamp(1.05rem, 2vw, 1.24rem); max-width: 780px; color: #475467; }
.hero-card {
  background: rgba(255, 255, 255, .75);
  border: 1px solid rgba(230, 223, 212, .85);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}
.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .8rem; margin-top: 1rem; }
.stat {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 18px;
  padding: 1rem;
}
.stat strong { display: block; font-family: var(--heading); font-size: 1.75rem; letter-spacing: -.05em; color: var(--brand); }
.stat span { color: var(--muted); font-size: .92rem; }

.section { padding: 3rem 0; }
.section-head { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin-bottom: 1.5rem; }
.section-head p { max-width: 670px; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.tool-card {
  position: relative;
  display: flex;
  min-height: 260px;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
  color: var(--ink);
  overflow: hidden;
}
.tool-card::after {
  content: "";
  position: absolute;
  inset: auto -3rem -5rem auto;
  width: 11rem;
  height: 11rem;
  border-radius: 999px;
  background: rgba(232, 155, 63, .16);
}
.tool-card:hover { transform: translateY(-2px); text-decoration: none; border-color: rgba(22, 97, 90, .25); }
.tool-card h2, .tool-card h3 { margin-bottom: .55rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.tag { font-size: .8rem; font-weight: 800; color: #344054; background: #f3eee5; padding: .28rem .6rem; border-radius: 999px; }
.cta-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.4rem; }
.btn {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: .72rem 1.05rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}
.btn:hover { text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 12px 26px rgba(22, 97, 90, .25); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--brand); border-color: rgba(22,97,90,.22); }
.btn.warning { background: #fff1d7; color: #7a4a00; border-color: #ffd99a; }

.tool-hero { padding: 3.2rem 0 2rem; }
.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
.panel, .info-panel {
  background: rgba(255,255,255,.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 2.2vw, 1.5rem);
}
.info-panel { position: sticky; top: 92px; }
.meta-list { display: grid; gap: .7rem; margin: 0; }
.meta-item { border: 1px solid var(--line); border-radius: 16px; padding: .85rem; background: var(--surface); }
.meta-item dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; }
.meta-item dd { margin: .15rem 0 0; font-weight: 800; color: var(--ink); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field { display: grid; gap: .45rem; }
.field.full { grid-column: 1 / -1; }
label { font-weight: 800; color: #344054; }
.hint { font-size: .88rem; color: var(--muted); margin: 0; }
input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid #d6cec1;
  background: #fff;
  color: var(--ink);
  border-radius: 14px;
  padding: .72rem .85rem;
  outline: none;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(22, 97, 90, .12);
}
.error-box, .empty-state, .success-box, .privacy-box {
  border-radius: var(--radius-sm);
  padding: .95rem 1rem;
  margin-top: 1rem;
}
.error-box { background: #fff4f2; color: var(--danger); border: 1px solid #ffd4cc; }
.success-box { background: #f0fff7; color: var(--success); border: 1px solid #b9f0d2; }
.empty-state { background: #f7f3eb; color: var(--muted); border: 1px dashed #d8cebd; }
.privacy-box { background: var(--brand-soft); border: 1px solid rgba(22,97,90,.18); color: #16433f; }
.hidden { display: none !important; }
.result-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0; }
.result-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1rem; }
.result-card span { display: block; color: var(--muted); font-size: .85rem; font-weight: 800; }
.result-card strong { display: block; font-family: var(--heading); font-size: clamp(1.5rem, 3vw, 2.4rem); line-height: 1.1; letter-spacing: -.055em; }
.breakdown-wrap { margin-top: 1rem; }
.breakdown-bar {
  display: flex;
  min-height: 38px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f5f2ec;
}
.breakdown-food { background: linear-gradient(135deg, var(--brand), #1c8178); min-width: 4%; }
.breakdown-margin { background: linear-gradient(135deg, var(--brand-2), #f2c46a); min-width: 4%; flex: 1; }
.legend { display: flex; flex-wrap: wrap; gap: .85rem; margin-top: .65rem; color: var(--muted); font-size: .9rem; }
.legend i { display: inline-block; width: .75rem; height: .75rem; border-radius: 99px; margin-right: .35rem; vertical-align: -1px; }
.legend .food { background: var(--brand); }
.legend .margin { background: var(--brand-2); }

.item-list { display: grid; gap: .8rem; margin-top: 1rem; }
.menu-item-card, .link-card {
  display: grid;
  gap: .4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
}
.menu-item-card-header, .link-card-header { display: flex; justify-content: space-between; gap: .7rem; align-items: start; }
.menu-item-card h3, .link-card h3 { font-size: 1.12rem; letter-spacing: -.03em; margin: 0; }
.small-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.small-btn {
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  color: var(--ink);
  padding: .45rem .7rem;
  font-weight: 800;
  font-size: .86rem;
}
.small-btn.danger { color: var(--danger); border-color: #ffd4cc; }
.insight { padding: .8rem; border-radius: 16px; background: #fff8eb; border: 1px solid #ffe0a8; color: #6d4508; margin-top: 1rem; }

.qr-shell { display: grid; gap: 1rem; align-items: start; grid-template-columns: 310px minmax(0,1fr); }
.qr-box {
  display: grid;
  place-items: center;
  min-height: 312px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1rem;
}
.qr-box canvas, .qr-box img { width: 280px !important; height: 280px !important; image-rendering: pixelated; }
.generated-link {
  display: block;
  overflow-wrap: anywhere;
  background: #f7f3eb;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .85rem;
  color: var(--ink);
}
.print-card-preview {
  max-width: 380px;
  margin-top: 1rem;
  background: #fff;
  color: #10201e;
  border-radius: 24px;
  border: 1px solid var(--line);
  padding: 1.4rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.print-card-preview .card-title { font-family: var(--heading); font-size: 1.75rem; font-weight: 800; letter-spacing: -.05em; margin-bottom: .4rem; color: var(--brand); }
.print-card-preview .card-qr { margin: 1rem auto; display: grid; place-items: center; width: 170px; min-height: 170px; }
.print-card-preview .card-qr canvas, .print-card-preview .card-qr img { width: 160px !important; height: 160px !important; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.template-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: .85rem; }
.template-card textarea { min-height: 140px; margin-top: .5rem; }

.prose { max-width: 900px; }
.prose p { color: #475467; }
.prose ul { color: #475467; }
.prose li + li { margin-top: .35rem; }
.callout { border-left: 4px solid var(--brand); background: rgba(223, 242, 238, .66); padding: 1rem; border-radius: 0 18px 18px 0; margin: 1rem 0; }
.footer { padding: 2.5rem 0; border-top: 1px solid var(--line); margin-top: 3rem; }
.footer-grid { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--muted); }
.footer-links { display: flex; gap: .75rem; flex-wrap: wrap; }
.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: min(420px, calc(100vw - 2rem));
  z-index: 200;
  background: var(--ink);
  color: #fff;
  border-radius: 16px;
  padding: .85rem 1rem;
  box-shadow: 0 16px 40px rgba(0,0,0,.18);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .hero-grid, .tool-layout, .qr-shell { grid-template-columns: 1fr; }
  .info-panel { position: static; }
  .card-grid, .template-grid { grid-template-columns: 1fr; }
  .section-head { display: block; }
  .result-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .nav-toggle { display: inline-grid; place-items: center; }
  .nav-links {
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: calc(100% + .5rem);
    display: none;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: .6rem;
    box-shadow: var(--shadow);
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { justify-content: center; min-height: var(--tap); }
  .hero { padding-top: 3.3rem; }
  .form-grid { grid-template-columns: 1fr; }
  .cta-row .btn { width: 100%; }
  .stat-row { grid-template-columns: 1fr; }
  .tool-card { min-height: auto; }
  .menu-item-card-header, .link-card-header { display: grid; }
}

@media print {
  body { background: #fff; }
  .site-header, .footer, .no-print, .tool-hero, .info-panel, .panel:not(.printable-panel) { display: none !important; }
  .container { width: 100%; }
  .printable-panel { border: 0; box-shadow: none; padding: 0; }
  .print-card-preview { box-shadow: none; border: 2px solid #111; page-break-inside: avoid; margin: 0 auto; max-width: 420px; }
}
