/* ============================================================
   Longdog Apps — shared stylesheet
   Design system: "night trail" — a dark topographic canvas with
   sunset-gradient accents pulled from the Ernie's Hikes app icon.
   Tokens live at the top so every page (index, app detail, legal)
   reads as one consistent product instead of separate one-offs.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400;500;600;700;900&family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;

  /* Base canvas — deep charcoal, not pure black, so the gradient
     accents (amber/coral) have somewhere warm to glow against. */
  --bg: #0a0d12;
  --bg-alt: #12161d;
  --bg-raised: #171c25;

  /* Accent trio, pulled straight from the app icon's sunset:
     amber is the primary brand color, coral is its warm partner,
     cyan is the "high-tech" complementary note used sparingly on
     interactive/data elements so the page doesn't read as one hue. */
  --amber: #f5a623;
  --amber-soft: #ffcf7a;
  --coral: #ff6b4a;
  --cyan: #35d0c4;

  --ink: #f4efe6;          /* primary text — warm off-white, not stark white */
  --ink-dim: #cfc9be;      /* secondary text */
  --muted: #8c93a1;        /* tertiary / meta text */
  --line: rgba(244, 239, 230, 0.12);
  --line-strong: rgba(244, 239, 230, 0.22);

  /* Glass surface used for cards and the nav bar */
  --glass-bg: rgba(23, 28, 37, 0.55);
  --glass-border: rgba(244, 239, 230, 0.10);

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --gradient-brand: linear-gradient(135deg, var(--amber) 0%, var(--coral) 55%, #b8463a 100%);
  --gradient-text: linear-gradient(100deg, var(--amber-soft) 0%, var(--amber) 40%, var(--coral) 100%);

  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 8px 24px -12px rgba(0, 0, 0, 0.5);
}

/* This site commits to a single dark "night trail" identity rather than
   swapping palettes with the OS theme — see artifact-design guidance on
   deliberately single-theme pages. Background/colors are set explicitly
   above so it looks correct regardless of the host page's own theme. */

* { box-sizing: border-box; }

/* Minimal baseline reset. The site's entry page (index.html) gets an
   equivalent reset injected automatically by the artifact host, but the
   supporting pages (ernies-hikes.html, bp-rage-tracker.html, privacy.html,
   terms.html) carry their own <html>/<head>/<body> and are served as
   written, so this reset — safe-area padding, zero body margin, capped
   images, [hidden] support — is declared here once for every page alike. */
:root {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-inline: 0;
}

h1, h2, h3, h4 {
  font-family: 'Unbounded', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
  color: var(--ink);
}

p { margin: 0; }

a { color: inherit; text-decoration: none; }

.mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* Uppercase eyebrow labels get a touch of tracking, per type guidance */
.eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber-soft);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gradient-brand);
  flex: none;
}

/* ---------- Layout shell ---------- */
.shell {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: max(20px, env(safe-area-inset-left, 0px));
  padding-inline-end: max(20px, env(safe-area-inset-right, 0px));
  position: relative;
}

.section {
  padding-block: clamp(56px, 9vw, 108px);
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 640px;
  margin-bottom: clamp(32px, 5vw, 56px);
}

.section-head p {
  color: var(--ink-dim);
  font-size: 1.05rem;
}

/* ---------- Background canvas (topo lines) ---------- */
#topo-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, header, footer { position: relative; z-index: 2; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  background: rgba(10, 13, 18, 0.72);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 16px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Unbounded', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--gradient-brand);
  display: grid;
  place-items: center;
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: #1a0e05;
  flex: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 32px);
  font-size: 0.92rem;
  color: var(--ink-dim);
}

.nav-links a:hover { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.btn-primary {
  background: var(--gradient-brand);
  color: #1a0e05;
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--amber-soft); background: rgba(245, 166, 35, 0.06); }

/* ---------- Glass card ---------- */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow-lg);
}

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(64px, 12vw, 132px) clamp(48px, 8vw, 80px);
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 5vw, 40px);
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  max-width: 16ch;
}

.hero-title .grad {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  max-width: 56ch;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--ink-dim);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  color: var(--muted);
  font-size: 0.85rem;
}

.hero-meta span { display: inline-flex; align-items: center; gap: 8px; }
.hero-meta span::before {
  content: '';
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--cyan);
}

/* ---------- Bento grid (app showcase) ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
}

.app-card {
  grid-column: span 6;
  padding: clamp(24px, 4vw, 36px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: transform 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.app-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }

.app-card.featured { grid-column: span 6; }

@media (min-width: 760px) {
  .app-card.featured { grid-column: span 6; flex-direction: row; align-items: center; }
  .app-card.compact { grid-column: span 3; }
}

.app-icon {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  overflow: hidden;
  flex: none;
  box-shadow: 0 12px 30px -10px var(--app-glow, rgba(245, 166, 35, 0.4));
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }

.app-card.featured .app-icon { width: 116px; height: 116px; }

.app-body { display: flex; flex-direction: column; gap: 10px; flex: 1; }

.app-tagline { color: var(--ink-dim); font-size: 0.98rem; max-width: 52ch; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-dim);
}

.app-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--amber-soft);
  font-weight: 600;
  font-size: 0.92rem;
}

.app-card.compact .app-cta { margin-top: auto; }

.coming-soon {
  opacity: 0.62;
}
.coming-soon .app-cta { color: var(--muted); }

/* ---------- About section photo ---------- */
/* A candid Phil-and-Ernie shot beside the About copy — stacks full-width
   on mobile, sits as a narrower side column next to the text on desktop. */
.about-text { grid-column: span 6; }
.about-photo { grid-column: span 6; }

@media (min-width: 760px) {
  .about-text { grid-column: span 4; }
  .about-photo { grid-column: span 2; }
}

.about-photo img {
  width: 100%;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
}

/* ---------- App groups (Apps section, grouped by release stage) ---------- */
/* Each release-stage group (On the App Store / Beta / In Development /
   Personal) gets its own labeled sub-heading above its own bento grid, so
   the four stages read as distinct rows instead of one undifferentiated
   pile of cards. */
.app-group + .app-group {
  margin-top: clamp(40px, 6vw, 60px);
}

.group-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.group-label .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--muted);
}

/* Status colors: live (green) > beta (amber) > in-development (blue) >
   personal (muted violet-gray), a rough traffic-light of how close each
   stage is to "in your hands today". */
.group-label--live { color: #4ade80; }
.group-label--live .dot { background: #4ade80; box-shadow: 0 0 8px rgba(74, 222, 128, 0.6); }

.group-label--beta { color: var(--amber-soft); }
.group-label--beta .dot { background: var(--amber-soft); box-shadow: 0 0 8px rgba(245, 166, 35, 0.5); }

.group-label--dev { color: #7dd3fc; }
.group-label--dev .dot { background: #7dd3fc; box-shadow: 0 0 8px rgba(125, 211, 252, 0.5); }

.group-label--personal { color: #c4b5fd; }
.group-label--personal .dot { background: #c4b5fd; box-shadow: 0 0 8px rgba(196, 181, 253, 0.45); }

/* A group with a single card (currently "On the App Store") still fills
   the row, matching the old .featured treatment. */
.app-group .bento .app-card.solo { grid-column: span 6; }
@media (min-width: 760px) {
  .app-group .bento .app-card.solo { grid-column: span 6; flex-direction: row; align-items: center; }
  .app-group .bento .app-card.solo .app-icon { width: 116px; height: 116px; }
}

/* ---------- Stat strip ---------- */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 18px;
  padding-block: 32px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat { display: flex; flex-direction: column; gap: 6px; }
.stat b {
  font-family: 'Unbounded', sans-serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-variant-numeric: tabular-nums;
  background: var(--gradient-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat span { color: var(--muted); font-size: 0.85rem; }

/* ---------- Feature list (used on app detail pages) ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.feature {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.25);
  display: grid; place-items: center;
  color: var(--amber-soft);
  flex: none;
}

.feature h3 { font-size: 1.02rem; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; }
.feature p { color: var(--ink-dim); font-size: 0.92rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 40px max(40px, env(safe-area-inset-bottom, 0px));
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
}
.footer-links a:hover { color: var(--ink); }

.footer-note { color: var(--muted); font-size: 0.82rem; }

/* ---------- Legal pages ---------- */
.legal-doc {
  max-width: 74ch;
}
.legal-doc h2 {
  font-size: 1.4rem;
  margin-top: 44px;
  margin-bottom: 14px;
}
.legal-doc h2:first-child { margin-top: 0; }
.legal-doc p, .legal-doc li {
  color: var(--ink-dim);
  font-size: 0.98rem;
  margin-bottom: 12px;
}
.legal-doc ul { padding-left: 22px; }
.legal-doc strong { color: var(--ink); }
.updated-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 24px;
}

/* ---------- App detail hero ---------- */
.app-hero {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-block: clamp(48px, 8vw, 84px) clamp(32px, 6vw, 56px);
}

@media (min-width: 780px) {
  .app-hero { flex-direction: row; align-items: center; }
}

.app-hero-icon {
  width: clamp(140px, 22vw, 220px);
  height: clamp(140px, 22vw, 220px);
  border-radius: 44px;
  overflow: hidden;
  flex: none;
  box-shadow: 0 30px 70px -20px var(--app-glow, rgba(245, 166, 35, 0.45));
}
.app-hero-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Rage meter (BP Rage Tracker) ----------
   Mirrors the app's real reading→color classification (normal through
   hypertensive crisis) as a horizontal five-stage strip, so the site
   shows the app's actual logic rather than a generic progress bar. */
.rage-meter {
  display: flex;
  border-radius: 999px;
  overflow: hidden;
  height: 14px;
  border: 1px solid var(--line-strong);
}
.rage-meter span { flex: 1; }
.rage-meter .s1 { background: #3fbf6a; }
.rage-meter .s2 { background: #e8c547; }
.rage-meter .s3 { background: #f5923a; }
.rage-meter .s4 { background: #e5484d; }
.rage-meter .s5 { background: #9a5cf2; }

.rage-labels {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.rage-labels span { flex: 1; text-align: center; }
.rage-labels span:first-child { text-align: left; }
.rage-labels span:last-child { text-align: right; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 8px;
}
.back-link:hover { color: var(--ink); }

/* ---------- Platform badges ---------- */
.platform-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 0.82rem;
  color: var(--ink-dim);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- Mobile nav ---------- */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  color: var(--ink);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav.open .nav-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: rgba(10, 13, 18, 0.96);
    padding: 20px;
    border-bottom: 1px solid var(--line);
    gap: 16px;
  }
}
