/* ============================================================================
   grow.myflowchamp.com — section stylesheet
   ----------------------------------------------------------------------------
   This file holds LAYOUT and COMPONENTS only. Every colour, radius, shadow,
   spacing step and font comes from the main site's token file, which is
   <link>ed ahead of this one. No token value is ever duplicated here — if a
   value needs to change, it changes in tokens-daylight.css and this section
   follows automatically.

   Chrome is always LIGHT (Daylight Focus). The learning modules render in
   their own dark theme inside an iframe; see .module-frame, which is
   deliberately styled as a dark "canvas" so the switch reads as intentional
   framing rather than a broken page.
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* viewport-fit=cover is set on every page, so the insets resolve to real
     values on notched phones instead of 0. */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

img { max-width: 100%; display: block; }

a { color: var(--pri-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--r-xs);
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--s4);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--s2);
  background: var(--surface);
  color: var(--ink);
  padding: var(--s2) var(--s4);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-2);
  z-index: 100;
}
.skip-link:focus { left: var(--s4); }

/* ---------------------------------------------------------------- header -- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.site-head__inner {
  display: flex;
  align-items: center;
  gap: var(--s4);
  height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand img { width: 26px; height: 26px; border-radius: var(--r-xs); }

/* "Grow" is a sub-brand of MyFlowChamp, not a separate product. The divider
   and lighter weight say "section of", the way a masthead kicker would. */
.brand__sub {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  color: var(--ink-2);
  font-weight: 600;
}
.brand__sub::before {
  content: "";
  width: 1px;
  height: 18px;
  background: var(--line);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--s1);
  margin-left: auto;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--s3);
  border-radius: var(--r-pill);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
}
.site-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--pri-ink); background: var(--pri-soft); }

/* Account: the one piece of the header that proves the shared session works.
   Signed in, it names the user and opens their dashboard on the main site. */
.site-nav .account {
  gap: var(--s2);
  margin-left: var(--s2);
  padding: 0 var(--s3) 0 4px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface);
}
.site-nav .account:hover { background: var(--surface-2); }
.site-nav .account--signin { padding: 0 var(--s4); color: var(--pri-ink); border-color: var(--pri-line); }

.account__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--pri-grad);
  color: var(--on-pri);
  font-size: 13px;
  font-weight: 800;
}
.account__name {
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

/* ---------------------------------------------------------------- buttons - */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 44px;
  padding: 0 var(--s5);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform .12s ease, background .16s ease, border-color .16s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn--primary { background: var(--pri-grad); color: var(--on-pri); box-shadow: var(--sh-1); }
.btn--primary:hover:not([disabled]) { background: var(--pri-hover); }

.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover:not([disabled]) { background: var(--surface-2); }

.btn--quiet { background: transparent; color: var(--ink-2); }
.btn--quiet:hover:not([disabled]) { background: var(--surface-2); color: var(--ink); }

.btn--sm { min-height: 36px; padding: 0 var(--s3); font-size: 13px; }

/* ------------------------------------------------------------------ cards - */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}

/* The *-soft tints are translucent, so a pill's real background depends on
   whatever it is placed over. On --bg (#FAF8F5) the green tint lifted --ok
   from its validated 5.21:1 to 4.40:1 — under the AA floor. Painting the tint
   as a background-image over an opaque --surface underlay makes every variant
   composite against the colour its token was validated on, anywhere on the
   page. Variants therefore override background-image, never background. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  border: 1px solid var(--line);
  background-color: var(--surface);
  background-image: linear-gradient(var(--surface-2), var(--surface-2));
  color: var(--ink-2);
}
.pill--pri  { background-image: linear-gradient(var(--pri-soft),  var(--pri-soft));  border-color: var(--pri-line);  color: var(--pri-ink); }
.pill--acc  { background-image: linear-gradient(var(--acc-soft),  var(--acc-soft));  border-color: var(--acc-line);  color: var(--acc); }
.pill--ok   { background-image: linear-gradient(var(--ok-soft),   var(--ok-soft));   border-color: var(--ok-line);   color: var(--ok); }
.pill--warn { background-image: linear-gradient(var(--warn-soft), var(--warn-soft)); border-color: var(--warn-line); color: var(--warn); }
.pill--dang { background-image: linear-gradient(var(--dang-soft), var(--dang-soft)); border-color: var(--dang-line); color: var(--dang); }
.pill--info { background-image: linear-gradient(var(--info-soft), var(--info-soft)); border-color: var(--info-line); color: var(--info); }

/* -------------------------------------------------------------- page head - */

/* Block-direction only. .page-head is applied TOGETHER with .wrap, and a
   `padding` shorthand here would reset .wrap's side gutter to 0 — same
   specificity, declared later — leaving headings flush to the screen edge. */
.page-head { padding-top: var(--s7); padding-bottom: var(--s5); }
.page-head h1 {
  margin: 0 0 var(--s2);
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.page-head p {
  margin: 0;
  max-width: 62ch;
  color: var(--ink-2);
  font-size: 16px;
}

.eyebrow {
  display: block;
  margin-bottom: var(--s2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--pri-ink);
}

/* ------------------------------------------------------------------ forms - */

.field { display: block; margin-bottom: var(--s4); }

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}

.input, .textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 11px var(--s3);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--pri);
  box-shadow: var(--focus);
}

.textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.6;
  font-family: var(--mono);
  font-size: 13px;
}

.field-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--s2);
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
}
.field-meta .over { color: var(--dang); font-weight: 700; }

/* ------------------------------------------------------------------ footer- */

.site-foot {
  margin-top: var(--s8);
  border-top: 1px solid var(--line);
  padding: var(--s5) 0 calc(var(--s5) + env(safe-area-inset-bottom));
  color: var(--ink-3);
  font-size: 13px;
}
.site-foot__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4);
  align-items: center;
  justify-content: space-between;
}
.site-foot nav { display: flex; flex-wrap: wrap; gap: var(--s4); }
.site-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--ink-2);
}

/* ------------------------------------------------------------ states ------ */

.state {
  text-align: center;
  padding: var(--s8) var(--s4);
  color: var(--ink-2);
}
.state h2 { margin: 0 0 var(--s2); font-size: 18px; color: var(--ink); }
.state p { margin: 0 auto var(--s4); max-width: 46ch; }

.spinner {
  width: 26px; height: 26px;
  margin: 0 auto var(--s4);
  border: 3px solid var(--line);
  border-top-color: var(--pri);
  border-radius: 50%;
  animation: grow-spin .8s linear infinite;
}
@keyframes grow-spin { to { transform: rotate(360deg); } }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================== responsive = */

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: var(--s2);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--sh-2);
    display: none;
  }
  .site-nav[data-open="true"] { display: flex; }
  .site-nav a { min-height: 44px; border-radius: var(--r-sm); padding: 0 var(--s3); }
  .site-nav .account { margin: var(--s2) 0 0; padding: 0 var(--s3); }
  .account__name { max-width: none; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 var(--s4); }
  .page-head { padding-top: var(--s5); padding-bottom: var(--s4); }
  .btn { width: 100%; }
  .btn--inline, .btn--sm { width: auto; }

  /* iOS Safari zooms the whole page when a focused control renders below
     16px. `input[type]` (0,1,1) is used rather than a bare `input` (0,0,1)
     so this cannot lose to a typed selector declared earlier. */
  input, input[type], select, textarea,
  .input, .input[type], .textarea {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
