/* ===============================================================
   App pages: MyoLoad and Helix Log
   ---------------------------------------------------------------
   Loaded after style.css on /myoload/ and /helix-log/. Same tokens and locks:
   cards 28px, nested elements 16px, controls full pill, one accent.
   The phone frame is shared with the home page's app section, so
   it lives in style.css; everything here is page-specific.
   =============================================================== */

/* ---------------------------------------------------------------
   1. HERO
   --------------------------------------------------------------- */

.app-hero {
  position: relative;
  padding-top: calc(var(--header-height) + clamp(1rem, 4vh, 3rem));
  padding-bottom: var(--section-y);
  overflow: clip;
}

.app-hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(42rem circle at 72% 40%, var(--color-primary-wash), transparent 64%);
}

.app-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  max-width: var(--content-wide);
  margin-inline: auto;
}

.app-hero-copy .hero-intro {
  max-width: 40ch;
}

.app-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.app-facts li {
  padding: 0.4rem 0.9rem;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
}

.app-hero-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding-block: 1rem;
}

.phone-hero {
  width: min(78%, 20rem);
}

/* ---------------------------------------------------------------
   2. SECTIONS
   --------------------------------------------------------------- */

.app-section {
  max-width: calc(var(--content-wide) + 2 * var(--gutter));
  margin-inline: auto;
  padding-block: var(--section-y);
}

.app-heading {
  display: grid;
  gap: 1.1rem;
  max-width: 50rem;
  margin-bottom: clamp(2.5rem, 6vh, 4rem);
}

.app-heading h2 {
  font-size: var(--text-2xl);
}

.app-heading > p:not(.eyebrow, .lead) {
  color: var(--color-muted);
}

/* Features */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
}

.feature-card {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  padding: clamp(1.4rem, 3vw, 2rem);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.feature-index,
.science-index {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: 0.06em;
  color: var(--color-primary);
}

.feature-card h3 {
  font-size: var(--text-xl);
  line-height: 1.05;
}

.feature-card p {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

/* Screens: a horizontal rail that snaps one phone at a time. */

.screen-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(13.5rem, 62vw, 17rem);
  gap: clamp(1rem, 2.5vw, 1.75rem);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  margin-inline: calc(var(--gutter) * -1);
  padding: 0.5rem var(--gutter) 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}

.screen-rail:focus-visible {
  outline-offset: -2px;
}

.screen-item {
  scroll-snap-align: start;
}

.screen-item figure {
  display: grid;
  gap: 1rem;
  margin: 0;
}

.screen-item figcaption {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.screen-item figcaption strong {
  display: block;
  margin-bottom: 0.15rem;
  font-family: var(--font-display);
  font-size: var(--text-base);
  color: var(--color-text);
}

@media (min-width: 1200px) {
  /* Six phones fit on a wide screen: no scrolling needed. */
  .screen-rail {
    grid-auto-flow: row;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-columns: auto;
    overflow: visible;
    margin-inline: 0;
    padding-inline: 0;
  }
}

/* Science */

.science-list {
  display: grid;
  max-width: 58rem;
  border-top: 1px solid var(--color-border);
}

.science-item {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  gap: 0 1rem;
  padding-block: clamp(1.75rem, 4vh, 2.5rem);
  border-bottom: 1px solid var(--color-border);
}

.science-index {
  padding-top: 0.35rem;
}

.science-body {
  display: grid;
  gap: 0.9rem;
}

.science-body h3 {
  font-size: var(--text-xl);
  line-height: 1.08;
}

.science-body p,
.science-body li {
  color: var(--color-muted);
}

.science-body strong {
  color: var(--color-text);
}

.cite {
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  margin-left: 0.2rem;
  padding-inline: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: super;
  color: var(--color-primary);
  background: var(--color-primary-wash);
  border-radius: var(--radius-pill);
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.cite:hover,
.cite:focus-visible {
  color: var(--color-on-primary);
  background: var(--color-primary);
}

.rule-list {
  display: grid;
  gap: 0.6rem;
  padding-left: 1.1rem;
  list-style: disc;
}

.rule-list li::marker {
  color: var(--color-primary);
}

.worked-example {
  display: grid;
  gap: 0.5rem;
  padding: clamp(1.1rem, 2.5vw, 1.5rem);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-inner);
  background: var(--color-surface);
}

.worked-example h4 {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.worked-example p {
  font-size: var(--text-sm);
}

.formula {
  justify-self: start;
  padding: 0.8rem 1.25rem;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text) !important;
  background: var(--color-surface-2);
  border-radius: var(--radius-inner);
}

.science-limits h3 {
  color: var(--color-primary);
}

/* Privacy */

.privacy-card {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding: clamp(1.6rem, 4vw, 3rem);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.privacy-card h2 {
  margin-top: 0.8rem;
  font-size: var(--text-xl);
  line-height: 1.05;
}

.privacy-points {
  display: grid;
  gap: 0.85rem;
}

.privacy-points li {
  position: relative;
  padding-left: 1.6rem;
  color: var(--color-muted);
}

.privacy-points li::before {
  content: "";
  position: absolute;
  top: 0.55em;
  left: 0;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--color-primary);
}

.privacy-card .text-link {
  grid-column: 2;
}

/* Get the app: reuses the closing colour-block from the home page. */

.get-copy > p {
  max-width: 48ch;
}

.store-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.75rem;
  width: min(100%, 36rem);
}

.store-status li {
  display: grid;
  gap: 0.15rem;
  padding: 1rem 1.25rem;
  border: 1px solid rgb(255 255 255 / 34%);
  border-radius: var(--radius-inner);
  background: rgb(4 34 56 / 32%);
}

.store-name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
}

.store-state {
  font-size: var(--text-sm);
  color: rgb(255 255 255 / 92%);
}

.get-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.get-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  padding: 0.9rem 1.6rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--brand-navy);
  background: #fff;
  border: 1px solid #fff;
  border-radius: var(--radius-pill);
  isolation: isolate;
  transition: transform var(--t-fast) var(--ease-out);
}

.get-button::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: #d9ecfa;
  transform: translateY(101%);
  transition: transform var(--t-med) var(--ease-out);
}

.get-button:hover::before {
  transform: translateY(0);
}

.get-button:active {
  transform: scale(0.97);
}

.get-button.is-ghost {
  color: #fff;
  background: transparent;
  border-color: rgb(255 255 255 / 70%);
}

.get-button.is-ghost::before {
  background: rgb(255 255 255 / 14%);
}

.get-button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.get-note {
  font-size: var(--text-sm) !important;
  color: rgb(255 255 255 / 88%) !important;
  max-width: 60ch !important;
}

.get-note a {
  color: #fff;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.get-note a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Sources */

.app-heading .sources-title {
  font-size: var(--text-xl);
}

.sources {
  display: grid;
  gap: 0.9rem;
  max-width: 58rem;
  padding-left: 1.4rem;
  list-style: decimal;
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.sources li {
  padding-left: 0.3rem;
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.sources li::marker {
  font-weight: 700;
  color: var(--color-primary);
}

.sources li:target {
  color: var(--color-text);
}

.sources cite {
  font-style: italic;
}

.sources a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------
   3. RESPONSIVE
   --------------------------------------------------------------- */

@media (max-width: 900px) {
  .app-hero-inner {
    grid-template-columns: 1fr;
  }

  .app-hero-stage {
    order: 1;
  }

  .phone-hero {
    width: min(70%, 17rem);
  }

  .privacy-card {
    grid-template-columns: 1fr;
  }

  .privacy-card .text-link {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .science-item {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .get-button {
    flex: 1 1 100%;
    justify-content: center;
  }
}

/* Without app.js (blocked, failed, or disabled) nothing is hidden,
   the same as on the home and peptide pages. */
html:not([data-enhanced]) .reveal,
html:not([data-enhanced]) [data-hero-part] {
  opacity: 1;
  transform: none;
}

/* A plain link inside the science copy (the source numbers use .cite). */
.science-body p a:not(.cite) {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
