/* Flint Cal — shared "technology" components for the redesign directions (d1 Aurora, d2 Light Lab,
   d3 Rhythm). Loaded after site.css and before theme-dX.css. Every animation is gated by
   html.motion (set by boot.js only when Reduce Motion is off) and switched off for screenshots (.snap). */

.tech {
  --tech: #4FC3F7;            /* cool cyan: the "AI" accent */
  --tech-soft: rgba(79, 195, 247, .10);
  --tech-line: rgba(79, 195, 247, .55);
  --pro: #6521FA;             /* macro colours = ios/Core/DesignSystem/Tokens/Palette.swift */
  --carb: #F2B24C;
  --fat: #3CC8B4;
  --water: #9CCBF2;
}
.tech .typing { display: none; }

/* phone screens always keep the app's dark tokens, even inside light sections */
.tech .device .screen {
  --bg: #171A26; --surface: #21253A; --surface-2: #2B3048; --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.14);
  --ink: #F2F1F7; --ink-2: rgba(242,241,247,.72); --ink-3: rgba(242,241,247,.56);
  color: var(--ink);
}
.tech .device { box-shadow: 0 0 0 1.5px #3A3D52, 0 0 0 calc(var(--w) * .012 + 1.5px) #0B0C14, 0 0 0 calc(var(--w) * .012 + 2.5px) #2C2F44,
  0 2px 6px rgba(0,0,0,.25), 0 30px 60px -20px rgba(8,10,30,.55), 0 70px 120px -40px rgba(8,10,30,.6); }

/* ─────────── AI scan stage (hero) ─────────── */
.scan { width: 100%; max-width: 580px; margin-inline: auto; }
.scan-stage { position: relative; width: 100%; aspect-ratio: 1 / 1.12; }
.scan-stage .plate { position: absolute; inset: 4% 7% 18%; }
.scan-stage .plate svg { width: 100%; height: 100%; }
.scan-grid { position: absolute; inset: 0 0 14%; border-radius: 28px; pointer-events: none;
  background-image: linear-gradient(var(--grid-line, rgba(255,255,255,.05)) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line, rgba(255,255,255,.05)) 1px, transparent 1px);
  background-size: 32px 32px; background-position: center;
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%); mask-image: radial-gradient(closest-side, #000 55%, transparent 100%); }
.scan-stage .scanline { inset-inline: 4%; height: 2px; background: var(--tech); box-shadow: 0 0 18px 2px rgba(79,195,247,.45); z-index: 2; }
.scan-chip { position: absolute; top: 0; inset-inline-start: 0; z-index: 3; display: inline-flex; align-items: center; gap: 8px; font: 600 12.5px/1 var(--font); letter-spacing: .04em; color: var(--tech); padding: 7px 11px; border-radius: 99px; background: var(--tech-soft); border: 1px solid var(--tech-line); }
.scan-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--tech); }

.bbox { position: absolute; border: 1.5px solid var(--tech-line); border-radius: 12px; background: rgba(79,195,247,.05); z-index: 2; }
.bbox > i { position: absolute; width: 14px; height: 14px; border: 2.5px solid var(--tech); }
.bbox .c1 { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.bbox .c2 { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.bbox .c3 { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.bbox .c4 { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.bl { position: absolute; inset-inline-start: -2px; display: grid; grid-template-columns: auto auto; column-gap: 10px; align-items: center; padding: 7px 10px; border-radius: 10px; white-space: nowrap;
  background: rgba(13, 17, 40, .9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.12); color: #F2F1F7; box-shadow: 0 10px 24px -10px rgba(0,0,0,.6); font-size: 12.5px; line-height: 1.35; }
.lb-top .bl { bottom: calc(100% + 6px); }
.lb-bottom .bl { top: calc(100% + 6px); }
.bl b { font-weight: 600; font-size: 13px; }
.bl small { grid-column: 1; color: rgba(242,241,247,.7); font-size: 12px; }
.bl em { grid-column: 2; grid-row: 1 / span 2; font-style: normal; font-weight: 700; font-size: 12px; color: var(--tech); padding: 4px 7px; border-radius: 8px; background: rgba(79,195,247,.12); }
.scan-total { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); display: flex; align-items: center; gap: 16px; padding: 10px 10px 10px 18px; border-radius: 18px; white-space: nowrap; z-index: 3;
  background: rgba(13, 17, 40, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.12); color: #F2F1F7; box-shadow: 0 20px 40px -18px rgba(0,0,0,.7); }
html[dir="rtl"] .scan-total { padding: 10px 18px 10px 10px; }
.scan-total small { display: block; font-size: 11.5px; color: rgba(242,241,247,.62); }
.scan-total b { font-size: 14.5px; }
.st-meta { padding-inline-start: 14px; border-inline-start: 1px solid rgba(255,255,255,.12); }
.st-kcal { padding-inline-start: 14px; border-inline-start: 1px solid rgba(255,255,255,.12); }
.st-kcal b { font-size: 26px; letter-spacing: -.02em; }
.st-kcal small { display: inline; font-size: 13px; }
.scan-total .log { background: var(--violet); color: #fff; font-weight: 600; font-size: 14px; padding: 10px 14px; border-radius: 12px; }
.scan .plate-tabs { margin-top: 26px; }

html.motion .scan-stage.scan .scanline { animation: scan 1.3s var(--ease) .05s 1 forwards; }
html.motion .slide.on .bbox { animation: box-in .45s var(--ease) both; }
html.motion .slide.on .bbox.b1 { animation-delay: .75s; } html.motion .slide.on .bbox.b2 { animation-delay: .95s; }
html.motion .slide.on .bbox.b3 { animation-delay: 1.15s; } html.motion .slide.on .bbox.b4 { animation-delay: 1.35s; }
html.motion .slide.on .scan-total { animation: total-in .5s var(--ease) 1.5s both; }
@keyframes box-in { from { opacity: 0; transform: scale(1.14); } to { opacity: 1; transform: none; } }
@keyframes total-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.snap .scan-total { transform: translateX(-50%) !important; }

/* ─────────── cuisines strip ─────────── */
.cuisines { padding-block: 22px; border-block: 1px solid var(--line); overflow: hidden; }
.cu-head { margin-bottom: 14px; }
.cu-title { font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
html[dir="rtl"] .cu-title { letter-spacing: 0; font-size: 14px; }
.cu-strip { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.cu-track { display: flex; gap: 10px; width: max-content; animation: band 60s linear infinite; }
html[dir="rtl"] .cu-track { animation-name: band-rtl; }
.cu { display: inline-flex; align-items: center; gap: 9px; padding: 9px 15px; border-radius: 99px; border: 1px solid var(--line-2); font-size: 15px; color: var(--ink); white-space: nowrap; background: var(--surface); }
.cu i { width: 8px; height: 8px; border-radius: 50%; background: var(--violet); }
.cu:nth-child(4n+2) i { background: var(--tech); } .cu:nth-child(4n+3) i { background: var(--carb); } .cu:nth-child(4n) i { background: var(--fat); }
.snap .cu-track { animation: none; }

/* ─────────── your day: ring, macro bars, sparkline ─────────── */
.day-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(40px, 6vw, 96px); align-items: center; }
.day-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.day-points li { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 16.5px; }
.dp { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dp-v { background: var(--violet); } .dp-a { background: var(--carb); } .dp-t { background: var(--fat); }
.day-visual { position: relative; display: flex; justify-content: center; padding-block: 20px; }
.day-device { --w: 290px; transform: perspective(1400px) rotateY(-8deg) rotateX(2deg); }
html[dir="rtl"] .day-device { transform: perspective(1400px) rotateY(8deg) rotateX(2deg); }
.today-ui { gap: .7em; }
.ring-wrap { position: relative; width: 74%; margin: .2em auto 0; aspect-ratio: 1; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 13; }
.ring-track { stroke: var(--surface-2); }
.ring-arc { stroke: var(--violet); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 42.7; transition: stroke-dashoffset 1.6s var(--ease) .2s; }
html[dir="rtl"] .ring { transform: rotate(-90deg) scaleY(-1); }
.ring-num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-num b { font-size: calc(var(--w) * .16); line-height: 1; letter-spacing: -.02em; }
.ring-num small { font-size: .8em; color: var(--ink-2); }
.ring-sub { display: flex; justify-content: center; gap: 1.4em; font-size: .82em; color: var(--ink-3); }
.ring-sub b { color: var(--ink); }
.macro-card { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7em; padding: .8em; border-radius: 1em; background: var(--surface); border: 1px solid var(--line); }
.mb small { display: block; font-size: .72em; color: var(--ink-2); }
.mb b { font-size: 1.05em; }
.mb b span { font-size: .7em; font-weight: 400; color: var(--ink-3); }
.mb i { display: block; height: .32em; margin-top: .4em; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.mb s { display: block; height: 100%; border-radius: 9px; transition: width 1.3s var(--ease) .5s; }
.mb-p s { width: 45%; background: var(--pro); } .mb-c s { width: 49%; background: var(--carb); } .mb-f s { width: 80%; background: var(--fat); }
.water-row { display: flex; align-items: center; justify-content: space-between; gap: .5em; font-size: .8em; color: var(--ink-3); padding: .6em .8em; border-radius: 1em; background: var(--surface); border: 1px solid var(--line); }
.cups { display: flex; gap: .25em; }
.cups i { width: .7em; height: .9em; border-radius: .15em .15em .35em .35em; border: 1.5px solid var(--water); }
.cups i.on { background: var(--water); }
.float-card { position: absolute; padding: 14px 16px; border-radius: 18px; background: var(--fc-bg, rgba(20, 24, 54, .78)); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--fc-line, rgba(255,255,255,.12)); color: var(--fc-ink, #F2F1F7); box-shadow: 0 24px 50px -20px rgba(8,10,30,.55); }
.float-card small { color: var(--fc-ink-2, rgba(242,241,247,.66)); font-size: 12px; }
.trend-card { width: 230px; inset-inline-end: -4%; bottom: 14%; }
.fc-head { display: flex; justify-content: space-between; gap: 10px; }
.trend-card > b { display: block; font-size: 24px; margin: 4px 0 6px; }
.trend-card > b small { font-size: 13px; font-weight: 500; }
.spark { width: 100%; height: 60px; display: block; overflow: visible; }
.spark-area { fill: rgba(79,195,247,.12); stroke: none; }
.spark-line { fill: none; stroke: var(--tech); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 0; vector-effect: non-scaling-stroke; transition: stroke-dashoffset 1.6s var(--ease) .8s; }
.spark-dot { fill: var(--tech); }
html[dir="rtl"] .spark { transform: scaleX(-1); }
.count-card { inset-inline-start: -2%; top: 12%; display: grid; gap: 2px; }
.count-card b { font-size: 30px; letter-spacing: -.02em; line-height: 1.1; }

html.motion:not(.snap) [data-play]:not(.play) .ring-arc { stroke-dashoffset: 100; }
html.motion:not(.snap) [data-play]:not(.play) .mb s { width: 0; }
html.motion:not(.snap) [data-play]:not(.play) .spark-line { stroke-dashoffset: 100; }

/* ─────────── coach typing ─────────── */
.tech .coach-ui .typing { display: flex; gap: .3em; padding: .65em .85em; width: max-content; border-radius: 1em; background: var(--surface); overflow: hidden; }
.tech .coach-ui .typing i { width: .45em; height: .45em; border-radius: 50%; background: var(--ink-3); }
html:not(.motion) .tech .coach-ui .typing, .snap .tech .coach-ui .typing { display: none; }
html.motion:not(.snap) .tech [data-play]:not(.play) .coach-ui :is(.bubble.bot, .mealcard, .ideas) { opacity: 0; }
html.motion .tech [data-play].play .coach-ui .typing { animation: typing-life 1.8s linear forwards; }
html.motion .tech [data-play].play .coach-ui .typing i { animation: dot 1s ease-in-out infinite; }
html.motion .tech [data-play].play .coach-ui .typing i:nth-child(2) { animation-delay: .15s; }
html.motion .tech [data-play].play .coach-ui .typing i:nth-child(3) { animation-delay: .3s; }
html.motion .tech [data-play].play .coach-ui .bubble.bot { animation: fade-up .5s var(--ease) 1.8s both; }
html.motion .tech [data-play].play .coach-ui .mealcard { animation: fade-up .5s var(--ease) 2.2s both; }
html.motion .tech [data-play].play .coach-ui .ideas { animation: fade-up .5s var(--ease) 2.5s both; }
@keyframes typing-life { 0%, 88% { opacity: 1; max-height: 3em; } 100% { opacity: 0; max-height: 0; padding-block: 0; } }
@keyframes dot { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-.25em); opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ─────────── responsive ─────────── */
@media (max-width: 900px) {
  .day-grid { grid-template-columns: minmax(0, 1fr); }
  .trend-card { inset-inline-end: 0; bottom: 4%; width: 200px; }
  .count-card { display: none; }
}
@media (max-width: 640px) {
  .bl { grid-template-columns: auto; padding: 5px 8px; font-size: 11px; column-gap: 6px; }
  .bl b { font-size: 11.5px; }
  .bl small, .bl em { display: none; }
  .scan-total { gap: 10px; padding: 8px 8px 8px 12px; }
  html[dir="rtl"] .scan-total { padding: 8px 12px 8px 8px; }
  .scan-total .st-meta { display: none; }
  .st-kcal b { font-size: 21px; }
  .scan-total .log { padding: 8px 10px; font-size: 13px; }
  .day-device { --w: 250px; transform: none; }
  html[dir="rtl"] .day-device { transform: none; }
  .trend-card { width: 168px; padding: 10px 12px; bottom: 2%; }
  .trend-card > b { font-size: 19px; }
  .spark { height: 44px; }
  .count-card { top: 4%; padding: 10px 12px; }
  .count-card b { font-size: 22px; }
}
.meals-mini { display: grid; gap: .4em; padding: .7em .8em; border-radius: 1em; background: var(--surface); border: 1px solid var(--line); font-size: .85em; }
.meals-mini small { font-size: .85em; color: var(--ink-3); }
.meals-mini div { display: flex; justify-content: space-between; }
.meals-mini b { font-weight: 600; }
