/* Tendril — shared styles
   Layout: one centered column (max 960px), soft rounded panels, tactile pill buttons.
   Palette: teal anchor, pink + sun-yellow accents, mint-tinted neutrals. */

:root {
  /* Neon night: always dark. Deep navy ground, pink / purple / blue accents. */
  color-scheme: dark;
  --bg: #070A1F;
  --surface: #11163A;
  --surface-2: #1A2050;
  --ink: #F4F4FF;
  --muted: #A0A6D0;
  --line: #2A3166;
  --deep: #F4F4FF;

  --primary: #3DA9FC;          /* blue */
  --primary-dark: #1C6FB8;
  --primary-light: #12305A;
  --on-primary: #04213D;
  --link: #7CC4FF;

  --secondary: #FF4FA3;        /* pink */
  --secondary-dark: #B8236E;
  --secondary-light: #3E1238;
  --on-secondary: #2E0016;
  --pink-text: #FF7DBA;

  --accent: #9B5DE5;           /* purple */
  --accent-dark: #6A30B5;
  --on-accent: #FFFFFF;
  --lav: #9B5DE5;
  --lav-dark: #6A30B5;
  --lav-light: #2B1B54;

  --good: #34D399;
  --warn: #FFC857;
  --on-warn: #2A1E00;

  --band: rgba(61, 169, 252, 0.18);
  --band-pink: rgba(255, 79, 163, 0.17);
  --band-lav: rgba(155, 93, 229, 0.22);
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 16px rgba(0, 0, 0, 0.35);

  --font-display: "Fredoka", "Nunito", ui-rounded, system-ui, sans-serif;
  --font-body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-xl: 32px;
  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
  color: var(--deep);
}
h1 { font-size: clamp(2rem, 6vw, 3.1rem); }
h2 { font-size: clamp(1.35rem, 3.5vw, 1.75rem); }
h3 { font-size: 1.15rem; }
p { margin: 0; }

a { color: var(--link); }

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

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 21;
  background: var(--bg);
}
.header-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "brand nav";
  align-items: center;
  gap: 8px 16px;
  padding-block: 10px;
}
.brand { grid-area: brand; }
.nav { grid-area: nav; }
.header-inner .quick-exit { grid-area: exit; }
@media (max-width: 760px) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "brand" "nav";
    padding-block: 10px 6px;
  }
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--deep) !important;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
}
.brand svg { width: 30px; height: 30px; flex: none; }
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-inline: -4px;
  padding: 2px 4px;
}
.nav::-webkit-scrollbar { display: none; }
.nav a.navlink {
  flex: none;
  min-width: 6.4em;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--ink);
  white-space: nowrap;
  transition: background-color .25s ease, transform .15s ease;
}
@media (hover: hover) { .nav a.navlink:hover { background: var(--surface-2); } }
.nav a.navlink:active { transform: scale(0.95); background: var(--surface-2); }
.nav a.navlink[aria-current="page"] { background: var(--primary-light); }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  border-radius: 999px;
  padding: 11px 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary {
  background: var(--primary);
  color: var(--on-primary) !important;
  box-shadow: 0 5px 0 var(--primary-dark), var(--shadow-sm);
}
.btn-primary:hover { transform: translateY(2px); box-shadow: 0 3px 0 var(--primary-dark), var(--shadow-sm); }
.btn-primary:active { transform: translateY(5px); box-shadow: 0 0 0 var(--primary-dark); }
.btn-pink {
  background: var(--secondary);
  color: var(--on-secondary) !important;
  box-shadow: 0 5px 0 var(--secondary-dark), var(--shadow-sm);
}
.btn-pink:hover { transform: translateY(2px); box-shadow: 0 3px 0 var(--secondary-dark), var(--shadow-sm); }
.btn-pink:active { transform: translateY(5px); box-shadow: 0 0 0 var(--secondary-dark); }
.btn-soft {
  background: var(--primary-light);
  color: var(--ink) !important;
}
.btn-soft:hover { background: var(--primary); color: var(--on-primary) !important; }
.btn-small { padding: 7px 16px; font-size: 0.88rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* Quick exit */
.quick-exit {
  background: var(--secondary-light);
  color: var(--ink) !important;
  border: 2px solid var(--secondary);
  padding: 6px 14px;
  font-size: 0.85rem;
}
.quick-exit:hover { background: var(--secondary); color: var(--on-secondary) !important; }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 28px);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.chip.live { background: var(--primary-light); color: var(--ink); }
.chip.soon { background: var(--secondary-light); color: var(--ink); }

.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}
.site-footer .wrap { padding-block: 24px 40px; display: grid; gap: 8px; }


.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Section tabs (Voice, Health) ---------- */
.voice-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface);
  justify-self: start;
}
.voice-tabs a {
  text-decoration: none;
  font-weight: 800;
  padding: 8px 22px;
  border-radius: 999px;
  color: var(--ink);
}
.voice-tabs a[aria-current="page"] { background: var(--primary); color: var(--on-primary); box-shadow: 0 3px 0 var(--primary-dark); }

.check-line { display: flex; align-items: flex-start; gap: 10px; font-size: 0.92rem; cursor: pointer; }
.check-line input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--primary); }

/* ---------- Page scaffolding ---------- */
.page { padding-block: 28px 0; display: grid; gap: 24px; }
.page-intro { display: grid; gap: 10px; max-width: 62ch; }
.page-intro .lede { color: var(--muted); font-size: 1.05rem; }
.small { font-size: 0.86rem; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }

.callout {
  border: 2px dashed var(--accent-dark);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}
.callout.soft { border-style: solid; border-color: transparent; background: var(--surface-2); }

.empty {
  display: grid;
  justify-items: start;
  gap: 12px;
  padding: 28px;
  border-radius: var(--r-lg);
  border: 2px dashed var(--line);
}

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .field > legend { font-weight: 800; font-size: 0.86rem; }
.field .hint { font-size: 0.8rem; color: var(--muted); font-weight: 400; }
.input, select.input, textarea.input {
  font: inherit;
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.input:focus { border-color: var(--primary); outline: none; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills label { position: relative; }
.pills input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pills span {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  font-weight: 700;
  font-size: 0.88rem;
  border: 2px solid transparent;
}
.pills input:checked + span { background: var(--primary-light); border-color: var(--primary); }
.pills input:focus-visible + span { outline: 3px solid var(--secondary); outline-offset: 2px; }

/* ---------- Sheet (dialog) ---------- */
dialog.sheet {
  border: 0;
  padding: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
}
dialog.sheet::backdrop { background: rgba(3, 4, 16, 0.7); }
.sheet-body { padding: 22px; display: grid; gap: 16px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.icon-btn {
  appearance: none; border: 0; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-2); color: var(--ink);
  display: grid; place-items: center; font-size: 1.2rem; line-height: 1;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--deep);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 50;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 32px);
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
}

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

.update-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 20px; border-radius: 18px; width: min(520px, calc(100vw - 32px)); }

/* ---------- App lock ---------- */
html.is-locked body > *:not(#lock):not(.toast) { visibility: hidden; }
.lock {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  overflow-y: auto;
}
.lock-inner { width: min(320px, 100%); display: grid; justify-items: center; gap: 18px; text-align: center; }
.lock-logo { width: 44px; height: 44px; }
.lock-title { font-size: 1.5rem; }
.lock-dots { display: flex; gap: 12px; min-height: 16px; }
.lock-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.lock-dots span.on { background: var(--secondary); border-color: var(--secondary); }
.lock-msg { min-height: 1.4em; font-size: 0.9rem; color: var(--pink-text); font-weight: 700; }
.lock-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; }
.lock-pad button {
  width: 72px; height: 72px; border-radius: 50%;
  appearance: none; border: 0; cursor: pointer;
  background: var(--surface-2); color: var(--ink);
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, background .12s ease;
}
.lock-pad button:active { transform: scale(0.94); background: var(--primary-light); }
.lock-pad .lock-quiet { background: transparent; font-size: 1.1rem; font-family: var(--font-body); font-weight: 800; color: var(--muted); }
.lock-foot { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
.lock-link { appearance: none; border: 0; background: none; color: var(--link); font: inherit; font-weight: 700; cursor: pointer; padding: 6px; }
.lock-forgot { display: grid; gap: 12px; justify-items: center; font-size: 0.9rem; color: var(--muted); background: var(--surface); border-radius: var(--r-md); padding: 16px; }
.lock.busy .lock-pad { opacity: 0.5; pointer-events: none; }
.lock.shake .lock-dots { animation: lock-shake .35s ease; }
@keyframes lock-shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }
@media (max-height: 640px) { .lock-pad { grid-template-columns: repeat(3, 60px); gap: 10px; } .lock-pad button { width: 60px; height: 60px; } }

/* Four voice tabs on a phone */
@media (max-width: 560px) {
  .voice-tabs { display: flex; justify-self: stretch; }
  .voice-tabs a { flex: 1 1 auto; text-align: center; padding: 8px 8px; font-size: 0.88rem; }
}

/* Date and time inputs: same size as other fields on phones */
input.input[type="date"], input.input[type="datetime-local"], input.input[type="time"], input.input[type="month"] {
  display: block; max-width: 100%; min-width: 0; min-height: 46px; line-height: 1.4; text-align: left;
}
@supports (-webkit-touch-callout: none) {
  /* iPhone: drop the native chrome that makes date fields taller and wider */
  input.input[type="date"], input.input[type="datetime-local"], input.input[type="time"] { -webkit-appearance: none; }
}
input.input[type="date"]::-webkit-date-and-time-value, input.input[type="datetime-local"]::-webkit-date-and-time-value { text-align: left; min-height: 1.4em; }
.field { min-width: 0; }

/* ---------- Soft touch ---------- */
/* No grey/blue squares when tapping; a gentle press instead. */
html { -webkit-tap-highlight-color: transparent; }
:focus:not(:focus-visible) { outline: none; }
a, button, .btn, .voice-tabs a, .pills span, .chip { -webkit-tap-highlight-color: transparent; }
.btn { transition: transform .15s ease, background-color .25s ease, box-shadow .25s ease, color .25s ease; }
.btn:not(.btn-primary):not(.btn-pink):active { transform: scale(0.97); }
.voice-tabs a { transition: background-color .25s ease, color .25s ease, transform .15s ease; }
.voice-tabs a:active { transform: scale(0.96); }

/* Pages fade into each other instead of flashing (browsers that support it). */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; animation-timing-function: ease; }
::view-transition-group(site-header) { animation: none; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* The page background reaches every edge (no light strip by the phone's navigation bar). */
html { background: var(--bg); }
/* Inside the installed app's container, pages fade in softly. */
html.in-frame body { animation: tendril-page-in .2s ease backwards; }
@keyframes tendril-page-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { html.in-frame body { animation: none; } }
