/* JustMacros website draft.
   Palette: white / off-white canvas, near-black type, retained blue accent.
   Light only, because every app capture is a light-appearance screen. */

:root {
  color-scheme: light;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --canvas: #ffffff;
  --tint: #f5f5f7;
  --accent: #366f91; /* design/blue-reference/AccentColor.json, light */
  --nav: 52px;
  --w: min(64vw, 280px); /* phone screen width; every device size derives from it */
}

* { box-sizing: border-box; }

html { scroll-padding-top: var(--nav); }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 17px/1.47 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }

h1, h2, h3, p, figure, ol, fieldset { margin: 0; padding: 0; }

h1, h2 { font-weight: 700; letter-spacing: -0.022em; line-height: 1.07; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(2rem, 4.6vw, 3.5rem); }

.lead { font-size: clamp(1.19rem, 1.9vw, 1.5rem); line-height: 1.3; color: var(--muted); text-wrap: balance; }

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

.visually-hidden, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 20; padding: 10px 16px; background: var(--canvas); }

/* MARK: Navigation */

.nav {
  position: sticky; top: 0; z-index: 10;
  background: rgb(255 255 255 / 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgb(0 0 0 / 0.08);
}
.nav-inner {
  display: flex; align-items: center; gap: 28px;
  max-width: 1040px; height: var(--nav); margin: 0 auto; padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 9px; margin-right: auto; font-weight: 600; color: var(--ink); text-decoration: none; }
.brand img, .count img { border-radius: 23%; }
.nav nav { display: none; gap: 28px; }
.nav nav a { color: var(--ink); font-size: 0.82rem; text-decoration: none; padding: 14px 0; opacity: 0.8; }
.nav nav a:hover { opacity: 1; }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 22px; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 500; text-decoration: none;
}
.button:hover { background: #2c5d7b; }
.button-small { min-height: 32px; padding: 0 14px; font-size: 0.82rem; position: relative; }
.button-small::after { content: ""; position: absolute; inset: -6px 0; } /* 44px touch target */

.text-link { display: inline-block; padding: 10px 0; font-size: 1.19rem; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* MARK: iPhone frame (CSS, no device artwork) */

.device {
  flex: none;
  width: calc(var(--w) * 1.056);
  padding: calc(var(--w) * 0.028);
  border-radius: calc(var(--w) * 0.17);
  background: #1d1d1f;
  box-shadow: 0 0 0 1px #3a3a3c inset, 0 30px 60px -20px rgb(0 0 0 / 0.28);
}
.screen {
  position: relative; overflow: hidden;
  aspect-ratio: 900 / 1957;
  border-radius: calc(var(--w) * 0.142);
  background: #f2f2f7;
}
.screen::before { /* Dynamic Island: part of the frame, not an app feature */
  content: ""; position: absolute; z-index: 3; left: 50%; top: calc(var(--w) * 0.035);
  width: calc(var(--w) * 0.31); height: calc(var(--w) * 0.092);
  translate: -50%; border-radius: 999px; background: #000;
}
.screen > img { width: 100%; }

/* Where the finger goes next. Decorative; the caption says the same thing. */
.tap {
  position: absolute; z-index: 2; left: var(--x); top: var(--y);
  width: 15%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  background: rgb(29 29 31 / 0.16);
  border: 2px solid rgb(255 255 255 / 0.95);
  box-shadow: 0 0 0 1px rgb(29 29 31 / 0.25), 0 4px 12px rgb(0 0 0 / 0.18);
}

/* Installed -> Open, once on load: a recreated home screen that opens into the
   genuine Add capture underneath. */
.launch {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-content: center; justify-items: center; gap: calc(var(--w) * 0.02);
  background: linear-gradient(160deg, #eef1f5, #dfe5ec);
  font-size: calc(var(--w) * 0.04); font-weight: 500;
  animation: launch-fade 0.5s 1.1s both;
}
.launch img { width: calc(var(--w) * 0.2); border-radius: 23%; box-shadow: 0 6px 16px rgb(0 0 0 / 0.16); animation: launch-icon 0.6s 1s both cubic-bezier(0.3, 0, 0.2, 1); }
@keyframes launch-icon { to { scale: 9; } }
@keyframes launch-fade { to { opacity: 0; visibility: hidden; } }

/* MARK: Hero and logging steps — static layout (mobile, reduced motion, no JS) */

.hero-copy { padding: 56px 24px 8px; text-align: center; }
.hero-copy .lead { margin-top: 14px; }
.hero-copy .text-link { margin-top: 10px; }

.steps {
  list-style: none;
  display: flex; gap: 28px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 28px calc(50% - var(--w) * 0.528) 64px;
  scrollbar-width: none;
}
.steps::-webkit-scrollbar { display: none; }
.steps li { flex: none; width: calc(var(--w) * 1.056); scroll-snap-align: center; }

.caption { margin-top: 24px; }
.caption h2 { font-size: 1.65rem; letter-spacing: -0.015em; }
.caption p { margin-top: 6px; color: var(--muted); }
.caption .count {
  display: flex; align-items: center; gap: 8px; margin: 0 0 6px;
  font-size: 0.82rem; font-weight: 600; color: var(--accent);
}

@media (min-width: 900px) {
  .nav nav { display: flex; }
  .steps {
    display: grid; grid-template-columns: repeat(3, auto); justify-content: center; gap: 72px 64px;
    overflow: visible; padding: 48px 24px 120px;
  }
}

/* MARK: Hero and logging steps — pinned scroll scene (class set by script.js) */

.pin { scroll-behavior: smooth; }
.pin .scene { --seg: 80svh; --w: min(36.5svh, 400px); position: relative; height: calc(100svh + 6.6 * var(--seg)); }
.pin .stage { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.pin .anchor { position: absolute; top: var(--seg); }

.pin .hero-copy {
  position: absolute; inset: var(--nav) 0 auto; padding-top: 4svh;
  opacity: calc(1 - var(--z, 0) * 2.5);
  translate: 0 calc(var(--z, 0) * -48px);
}
.pin .past-hero .hero-copy { visibility: hidden; }

.pin .steps { display: block; padding: 0; overflow: visible; outline-offset: -4px; }
.pin .steps li {
  position: absolute; inset: var(--nav) 0 0; width: auto;
  display: grid; place-items: center;
  pointer-events: none;
}
/* Later screens fade in over earlier ones, so the frame never flickers. */
.pin .steps .device {
  opacity: 0; transition: opacity 0.4s;
  transform: translateY(calc((1 - var(--z, 0)) * 12svh)) scale(calc(0.68 + 0.32 * var(--z, 0)));
}
.pin .steps .on .device { opacity: 1; }

.pin .caption {
  position: absolute; top: 50%; right: calc(50% + var(--w) * 0.528 + 56px);
  width: min(300px, 50vw - var(--w) * 0.528 - 88px);
  margin: 0; translate: 0 calc(-50% + 12px);
  opacity: 0; transition: opacity 0.35s, translate 0.35s;
}
.pin .caption h2 { font-size: clamp(2rem, 3.4vw, 3rem); }
.pin .caption p { font-size: 1.19rem; line-height: 1.35; }
.pin .zoomed .current .caption { opacity: 1; translate: 0 -50%; }

.pin .tap { opacity: 0; }
.pin .zoomed .current .tap { opacity: 1; animation: tap 1.6s 0.3s infinite; }
@keyframes tap { 0%, 100% { scale: 1; } 50% { scale: 0.8; } }

/* MARK: Feature sections */

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

.feature {
  display: grid; justify-items: center; gap: 48px;
  padding: 96px 24px 0;
  text-align: center;
}
.feature-copy { max-width: 440px; }
.feature .lead { margin-top: 16px; }
.feature > .device { margin-bottom: 96px; }
.note { margin-top: 12px; font-size: 0.82rem; color: var(--muted); }

.segmented {
  display: inline-flex; margin-top: 28px; padding: 3px; border: 0; border-radius: 999px;
  background: rgb(0 0 0 / 0.07);
}
.segmented input { position: absolute; opacity: 0; }
.segmented label { min-width: 104px; padding: 9px 18px; border-radius: 999px; font-weight: 500; cursor: pointer; }
.segmented input:checked + label { background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.14); }
.segmented input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Two genuine captures, cross-faded by the website. Not a recording of the
   app's own card animation. */
.focus-demo .protein { position: absolute; inset: 0; opacity: 0; transition: opacity 0.45s; }
.feature:has(#focus-protein:checked) .protein { opacity: 1; }

/* MARK: Interactive Today cards (website recreation over capture 02)
   Sizes are the app's own, in points: 1pt = screen width / 402. script.js sets
   each card's rectangle and each part's centre; the phase duration is --dur. */

.today-cards {
  --pt: calc(var(--w) / 402);
  --dur: 0s;
  position: absolute; left: 3.98%; top: 17.05%;
  width: calc(370 * var(--pt)); height: calc(164 * var(--pt));
  overflow: hidden; border-radius: calc(26 * var(--pt)); /* the list section's own clip */
  background: #f2f2f7;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
}
.metric, .metric * { transition: all var(--dur) cubic-bezier(0.42, 0, 0.58, 1); } /* SwiftUI easeInOut */
.metric {
  position: absolute; left: calc(var(--x) * var(--pt)); top: calc(var(--y) * var(--pt));
  width: calc(var(--cw) * var(--pt)); height: calc(var(--ch) * var(--pt));
  z-index: var(--z, 0);
  padding: 0; border: 0; border-radius: calc(12 * var(--pt)); overflow: hidden;
  background: #fff; color: #000; font: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.metric:focus-visible { outline-offset: -3px; }
.metric > * {
  position: absolute; left: calc(var(--px) * var(--pt)); top: calc(var(--py) * var(--pt));
  translate: 0 -50%; scale: var(--ps); white-space: nowrap; line-height: 1;
}
.m-icon {
  width: calc(var(--iw) * var(--pt)); height: calc(var(--ih) * var(--pt));
  background: #8a8a8e; -webkit-mask: var(--glyph) center / 100% 100% no-repeat; mask: var(--glyph) center / 100% 100% no-repeat;
}
.hero .m-icon { background: var(--accent); }
.m-label { font: calc(15 * var(--pt)) / 1 system-ui, sans-serif; color: #8a8a8e; }
.m-value { display: flex; align-items: baseline; transform-origin: calc(var(--nw) * var(--pt) / 2) 50%; }
.m-value .num { font-size: calc(36 * var(--pt)); font-weight: 700; }
.m-value .tilde, .m-value .unit { font-size: calc(22 * var(--pt)); font-weight: 600; color: #8a8a8e; }
/* The unit appears late in the grow and leaves early in the shrink, as in the app. */
.m-value .unit {
  margin-left: calc(3 * var(--pt)); transform-origin: 0 50%; scale: 0.3; opacity: 0;
  transition: scale 0.12s cubic-bezier(0, 0, 0.58, 1) 0.08s, opacity 0.12s cubic-bezier(0, 0, 0.58, 1) 0.08s;
}
.hero .m-value .unit { scale: 1; opacity: 1; }

/* The phone runs off the section's lower edge, which also keeps the capture's
   overlapping tab bar out of view. */
.cut { overflow: hidden; padding: 0 40px; border-bottom: 1px solid var(--line); }
.cut .device { margin-bottom: calc(var(--w) * -0.245); }

/* MARK: Interactive meal size (website recreation over capture 14)
   Positions are the capture's own pixel coordinates as percentages. White
   patches hide the captured values and slider; live ones sit on top. */

.meal-demo .live {
  position: absolute; right: 7.4%; top: var(--y); translate: 0 -50%;
  width: 39%; padding-right: 0.97%; background: #fff; /* patch runs just past the captured text */
  font-size: calc(var(--w) * 0.0423); line-height: 1.5; text-align: right; white-space: nowrap;
  color: #8a8a8e; font-variant-numeric: tabular-nums;
}
.size-control {
  position: absolute; left: 5%; width: 90%; top: 54.92%; height: 4.96%;
  background:
    radial-gradient(circle at 8.56% 75%, #c7c7cc 0 calc(var(--w) * 0.0035), transparent calc(var(--w) * 0.0035 + 0.5px)),
    radial-gradient(circle at 50% 75%, #c7c7cc 0 calc(var(--w) * 0.0035), transparent calc(var(--w) * 0.0035 + 0.5px)),
    radial-gradient(circle at 91.4% 75%, #c7c7cc 0 calc(var(--w) * 0.0035), transparent calc(var(--w) * 0.0035 + 0.5px)),
    #fff;
}
/* --at is the thumb position (0 to 1) and --lift how far it is lifted (0 to 1);
   script.js sets both every frame. Proportions come from the simulator recording. */
.size-control { --at: 0.5; --lift: 0; touch-action: pan-y; cursor: grab; }
.size-control:active { cursor: grabbing; }
.size-control::after { content: ""; position: absolute; inset: -8px 0; } /* taller touch target */
.size-control .track {
  --thumb-w: calc(var(--w) * 0.0945);
  /* Resting, the thumb stays inside the track; lifted, its centre sits on the fill's end. */
  --centre: calc(
    (1 - var(--lift)) * (var(--thumb-w) / 2 + var(--at) * (100% - var(--thumb-w))) + var(--lift) * var(--at) * 100%
  );
  position: absolute; left: 3.31%; width: 93.28%; top: 44.6%; translate: 0 -50%;
  height: calc(var(--w) * 0.0133); border-radius: 999px; background: #e6e6e6;
}
.size-control .fill { width: var(--centre); height: 100%; border-radius: 999px; background: var(--accent); }
.size-control .thumb {
  position: absolute; left: var(--centre); top: 50%;
  width: var(--thumb-w); height: calc(var(--w) * 0.0597);
  translate: -50% -50%; scale: calc(1 + 0.58 * var(--lift));
  border-radius: 999px;
  background: rgb(255 255 255 / calc(1 - 0.86 * var(--lift)));
  backdrop-filter: brightness(calc(1 + 0.22 * var(--lift)));
  -webkit-backdrop-filter: brightness(calc(1 + 0.22 * var(--lift)));
  box-shadow:
    0 0 0 0.5px rgb(0 0 0 / calc(0.08 + 0.2 * var(--lift))),
    inset 0 0 calc(var(--w) * 0.012) rgb(255 255 255 / calc(0.9 * var(--lift))),
    0 calc(var(--w) * 0.006) calc(var(--w) * 0.02) rgb(0 0 0 / 0.16);
}
/* The real control for keyboards and screen readers; pointer input is handled on the wrapper. */
.size-control input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.size-control:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

@media (min-width: 900px) {
  .feature {
    grid-template-columns: minmax(0, 440px) auto; justify-content: center; align-items: center; gap: 120px;
    padding-top: 140px; text-align: left;
    --w: 300px;
  }
  .feature > .device { margin-bottom: 140px; }
  .feature.reverse .feature-copy { order: 2; }
  .cut { align-self: end; }
}

/* MARK: Close and footer */

.close { padding: 120px 24px; text-align: center; }
.quiet {
  display: grid; gap: 28px; max-width: 720px; margin: 48px auto 0;
  text-align: left; color: var(--muted);
}
.quiet h3 { font-size: 1.06rem; color: var(--ink); }
.sheet { max-width: 880px; margin: 40px auto 48px; }
.sheet { overflow-x: auto; } /* stays readable on a phone by scrolling sideways */
.sheet img { min-width: 680px; border: 1px solid var(--line); border-radius: 10px; }
.sheet figcaption { margin-top: 10px; font-size: 0.76rem; color: var(--muted); }

@media (min-width: 700px) {
  .quiet { grid-template-columns: 1fr 1fr; gap: 56px; }
}

footer {
  max-width: 1040px; margin: 0 auto; padding: 28px 24px 40px;
  font-size: 0.76rem; color: var(--muted);
}
footer strong { color: var(--ink); }
footer p + p { margin-top: 4px; }

/* MARK: Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .launch { display: none; }
  * { transition: none !important; animation: none !important; }
}
