/* Making Healthy Choices portal */
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(/fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(/fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(/fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 700; font-display: swap; src: url(/fonts/inter-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 800; font-display: swap; src: url(/fonts/inter-latin-800-normal.woff2) format('woff2'); }

:root {
  --teal: #1D4F5C;
  --teal-hover: #173F4A;
  --teal-soft: #E6EEF0;
  --ink: #2C2C2C;
  --slate: #476D87;
  --muted: #5F6B6D;
  --bg: #F7FAFA;
  --card: #FFFFFF;
  --line: #E1E8E7;
  --brick: #A63D40;
  --mustard: #E2B448;
  --sand: #D4B483;
  --aqua: #4CA6A8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 79, 92, .06), 0 6px 18px rgba(29, 79, 92, .08);
  --rail: 72px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); }
button { font: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons and fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 10px; border: 2px solid var(--teal);
  background: var(--teal); color: #fff; font-weight: 700; text-decoration: none; transition: background .15s;
}
.btn:hover { background: var(--teal-hover); border-color: var(--teal-hover); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--teal); }
.btn.secondary:hover { background: var(--teal-soft); }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.field input[type=text], .field input[type=email] {
  width: 100%; min-height: 48px; padding: 10px 14px; font: inherit; color: var(--ink);
  border: 1.5px solid #C9D4D3; border-radius: 10px; background: #fff;
}
.field input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(76, 166, 168, .3); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; margin: 8px 0 20px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--teal); flex: none; }
.error-text { color: var(--brick); font-weight: 600; font-size: 15px; margin: -4px 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ---------- centered card screens (entry, review, status) */
.screen { min-height: 100dvh; display: flex; flex-direction: column; }
.screen-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.card {
  width: 100%; max-width: 520px; background: var(--card); border-radius: 18px;
  box-shadow: var(--shadow); padding: 36px 32px;
}
.card.wide { max-width: 680px; }
.wordmark { font-weight: 800; color: var(--teal); letter-spacing: -.01em; line-height: 1.15; }
.wordmark small { display: block; font-weight: 600; font-size: .5em; color: var(--slate); letter-spacing: 0; margin-top: 4px; }
.card .wordmark { font-size: 30px; margin: 0 0 6px; }
.card h1 { font-size: 26px; line-height: 1.25; margin: 0 0 10px; letter-spacing: -.01em; }
.card h2 { font-size: 18px; margin: 26px 0 8px; }
.card p { margin: 0 0 14px; }
.willie { width: 108px; height: 108px; margin: 0 0 18px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 24px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.terms { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; font-size: 15px; max-height: 340px; overflow: auto; }
.terms ol { margin: 8px 0; padding-left: 22px; }
.terms li { margin-bottom: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 18px 0; }
.fact { background: var(--teal-soft); border-radius: 12px; padding: 12px 14px; }
.fact b { display: block; font-size: 18px; color: var(--teal); }
.fact span { font-size: 14px; color: var(--muted); }
.site-footer { text-align: center; font-size: 13px; color: var(--muted); padding: 18px 16px 24px; }
.site-footer img { height: 22px; width: auto; margin: 0 auto 6px; opacity: .9; }

/* ---------- app shell: rail (desktop) + top bar (mobile) */
.shell { min-height: 100dvh; }
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail); background: var(--teal);
  display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 4px; z-index: 20;
}
.rail .mark { width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.12); color: #fff; font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; letter-spacing: .02em; }
.rail-btn {
  position: relative; width: 52px; height: 52px; border: 0; border-radius: 12px; background: transparent; color: #DCE8EA;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
}
.rail-btn:hover, .rail-btn[aria-current=page] { background: rgba(255,255,255,.14); color: #fff; }
.rail-btn svg { width: 24px; height: 24px; }
.rail-btn .tip {
  position: absolute; left: 62px; top: 50%; transform: translateY(-50%); white-space: nowrap;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.rail-btn:hover .tip, .rail-btn:focus-visible .tip { opacity: 1; }
.rail .spacer { flex: 1; }
.main { margin-left: var(--rail); min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { display: none; }

.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px 36px 20px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 30px; font-weight: 800; color: var(--teal); letter-spacing: -.015em; line-height: 1.15; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.review-band {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #FBF4E3; border: 1px solid #EED9A6;
  border-radius: 12px; padding: 10px 16px; margin-bottom: 22px; font-size: 15px;
}
.review-band .tag { background: var(--mustard); color: var(--ink); font-weight: 700; font-size: 13px; border-radius: 6px; padding: 2px 8px; }
.review-band button { background: none; border: 0; color: var(--teal); font-weight: 700; text-decoration: underline; padding: 0; }
.continue-btn { min-height: 44px; }

/* ---------- chapter grid */
.grid { display: grid; gap: 26px 22px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { all: unset; display: block; cursor: pointer; border-radius: var(--radius); }
.tile .art { position: relative; border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.tile:hover .art { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(29,79,92,.08), 0 12px 28px rgba(29,79,92,.14); }
.tile .art img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.tile .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 4px 0; font-size: 14px; }
.tile .meta b { font-weight: 700; }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.status.opened { color: var(--teal); font-weight: 600; }
.badge {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--teal); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 3px #fff;
}
.badge svg { width: 18px; height: 18px; }

/* ---------- viewer */
.viewer { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.vbar {
  flex: none; height: 48px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 8px; background: #fff; border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
  height: calc(48px + env(safe-area-inset-top));
}
.vbar button { border: 0; background: transparent; color: var(--teal); font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 8px; }
.vbar button:hover { background: var(--teal-soft); }
.vbar .vnext { justify-self: end; }
.vbar .vmenu { justify-self: start; }
.vbar .vtitle { font-weight: 700; font-size: 15px; color: var(--ink); }
.vbar svg { width: 20px; height: 20px; }
.vframe { position: relative; flex: 1; min-height: 0; }
.vframe iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }
.watermark {
  position: absolute; inset: 0; pointer-events: none; z-index: 2; opacity: .12;
  background-repeat: repeat; background-size: 340px 200px;
}
.rotate-hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3;
  background: rgba(44,44,44,.88); color: #fff; font-size: 14px; border-radius: 10px; padding: 10px 14px;
  display: flex; gap: 10px; align-items: center; max-width: calc(100% - 32px);
}
.rotate-hint button { background: none; border: 0; color: #fff; font-weight: 700; text-decoration: underline; padding: 0; }

/* ---------- dialog */
.overlay { position: fixed; inset: 0; background: rgba(29, 79, 92, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.dialog { background: #fff; border-radius: 18px; box-shadow: var(--shadow); width: 100%; max-width: 560px; max-height: calc(100dvh - 32px); overflow: auto; padding: 28px; }
.dialog h2 { margin: 0 0 10px; font-size: 22px; color: var(--teal); }
.dialog .close-row { display: flex; justify-content: flex-end; margin-top: 18px; }
.install-steps { padding-left: 22px; margin: 10px 0 0; }
.install-steps li { margin-bottom: 8px; }

/* ---------- mobile layout */
body.layout-mobile .rail { display: none; }
body.layout-mobile .main { margin-left: 0; }
body.layout-mobile .topbar {
  display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between;
  background: var(--teal); color: #fff; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
}
.topbar .wordmark { color: #fff; font-size: 18px; }
.topbar .wordmark small { color: #CFE3E6; }
.topbar button { border: 0; background: rgba(255,255,255,.14); color: #fff; width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.topbar svg { width: 24px; height: 24px; }
.mobile-menu { position: fixed; inset: 0; z-index: 40; background: rgba(29,79,92,.45); display: flex; justify-content: flex-end; }
.mobile-menu nav { width: min(320px, 86vw); height: 100%; background: #fff; padding: 18px 12px; padding-top: calc(18px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 2px; }
.mobile-menu nav button, .mobile-menu nav a {
  border: 0; background: none; display: flex; align-items: center; gap: 14px; text-align: left; min-height: 52px; padding: 0 14px;
  border-radius: 10px; color: var(--ink); font-weight: 600; text-decoration: none; font-size: 16px;
}
.mobile-menu nav button:hover, .mobile-menu nav a:hover { background: var(--teal-soft); }
.mobile-menu nav svg { width: 22px; height: 22px; color: var(--teal); }
body.layout-mobile .content { padding: 20px 16px 16px; }
body.layout-mobile .page-head h1 { font-size: 24px; }
body.layout-mobile .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; }
body.layout-mobile .tile .art {
  border-radius: 22%; aspect-ratio: 1 / 1;
  box-shadow: 0 1px 1px rgba(0,0,0,.06), 0 6px 14px rgba(29,79,92,.16), inset 0 0 0 1px rgba(255,255,255,.6);
}
body.layout-mobile .tile .art::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.75), inset 0 -3px 6px rgba(29,79,92,.10);
}
body.layout-mobile .tile .art img { aspect-ratio: 1 / 1; height: 100%; }
body.layout-mobile .tile .meta { justify-content: center; padding-top: 6px; font-size: 13px; }
body.layout-mobile .tile .meta .status { display: none; }
body.layout-mobile .badge { top: 6px; right: 6px; width: 26px; height: 26px; box-shadow: 0 0 0 2px #fff; }
body.layout-mobile .badge svg { width: 16px; height: 16px; }
@media (max-width: 379px) { body.layout-mobile .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .card { padding: 28px 20px; } .card h1 { font-size: 23px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* fixes after visual check */
.btn svg { width: 20px; height: 20px; flex: none; }
.continue-btn { white-space: nowrap; }
body.layout-mobile .badge { top: auto; bottom: 6px; right: 6px; }
body.layout-mobile .review-band { font-size: 14px; padding: 8px 12px; gap: 8px; margin-bottom: 16px; }
body.layout-mobile .continue-btn { min-height: 44px; font-size: 15px; padding: 0 16px; }
