/* ════════════════════════════════════════════
   THE STEADY SYSTEM - Global Stylesheet
   Font: System sans-serif
   Palette: Espresso + Cream, system-aware
════════════════════════════════════════════ */

/* -- TOKENS -- */
:root {
  --bg: #1c1108;
  --surface: #271709;
  --folder-bg: rgba(255,255,255,0.065);
  --folder-border: rgba(255,255,255,0.10);
  --app-bg: rgba(255,255,255,0.08);
  --app-hover: rgba(255,255,255,0.15);
  --text-primary: #f4edde;
  --text-muted: #c4b49a;
  --text-faint: #7a6a56;
  --accent: #9b6a3e;
  --accent-light: #c49a72;
  --accent-glow: rgba(155,106,62,0.20);
  --stroke: rgba(255,255,255,0.10);
  --icon-stroke: rgba(244,237,222,0.88);
  --border-accent: rgba(155,106,62,0.55);
  --video-bg-dark: #2e1c0f;
  --video-bg-deeper: #1a0f06;
  --video-glow: rgba(155,106,62,0.38);
  --play-bg: rgba(245,238,223,0.10);
  --play-border: rgba(245,238,223,0.26);
  --play-hover-bg: rgba(155,106,62,0.45);
  --play-hover-border: rgba(196,154,114,0.5);
  --scanline-stripe: rgba(255,255,255,0.02);
  --scanline-sweep: rgba(255,255,255,0.04);
  --radius-folder: 28px;
  --radius-app: 18px;
  --radius-page: 32px;
  --max-width: 560px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #eee4d2;
    --surface: #e4d8c4;
    --folder-bg: rgba(28,17,8,0.055);
    --folder-border: rgba(28,17,8,0.09);
    --app-bg: rgba(28,17,8,0.065);
    --app-hover: rgba(28,17,8,0.12);
    --text-primary: #1c1108;
    --text-muted: #5c3d20;
    --text-faint: #9a7a55;
    --accent-light: #7a5528;
    --accent-glow: rgba(155,106,62,0.14);
    --stroke: rgba(28,17,8,0.09);
    --icon-stroke: rgba(28,17,8,0.80);
    --border-accent: rgba(155,106,62,0.50);
    --video-bg-dark: #d4c4aa;
    --video-bg-deeper: #c8b594;
    --video-glow: rgba(155,106,62,0.22);
    --play-bg: rgba(28,17,8,0.08);
    --play-border: rgba(28,17,8,0.18);
    --play-hover-bg: rgba(155,106,62,0.20);
    --play-hover-border: rgba(155,106,62,0.40);
    --scanline-stripe: rgba(28,17,8,0.02);
    --scanline-sweep: rgba(28,17,8,0.03);
  }
}

/* -- RESET -- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; border: none; background: none; cursor: pointer; }
a { text-decoration: none; color: inherit; }
svg { display: block; }

::selection {
  background: rgba(155,106,62,0.3);
  color: var(--text-primary);
}

/* -- ACCESSIBILITY -- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; top: -100%; left: 50%; transform: translateX(-50%);
  padding: 8px 16px; background: var(--accent); color: var(--text-primary);
  border-radius: 0 0 8px 8px; font-size: 13px; font-weight: 500;
  z-index: 9999; transition: top 0.2s;
}
.skip-link:focus { top: 0; }

:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}

/* -- BODY LINKS -- */
.subpage-body a,
.category-body a {
  color: var(--accent-light);
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.9;
  transition: opacity 0.14s;
}
.subpage-body a:hover,
.category-body a:hover { opacity: 1; }

/* ════════════════════════════════════════════
   WALLPAPER
════════════════════════════════════════════ */
.wallpaper {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 0; pointer-events: none;
}
.wallpaper::before {
  content: '';
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background:
    radial-gradient(ellipse 70% 55% at 15% 8%, var(--accent-glow) 0%, transparent 55%),
    radial-gradient(ellipse 55% 70% at 85% 92%, rgba(155,106,62,0.11) 0%, transparent 55%),
    radial-gradient(ellipse 90% 90% at 50% 50%, var(--surface) 0%, var(--bg) 100%);
}
.wallpaper::after {
  content: '';
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.032'/%3E%3C/svg%3E");
}

/* ════════════════════════════════════════════
   SCREEN WRAPPER (homepage)
════════════════════════════════════════════ */
.screen {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 16px 0;
}

/* -- STATUS BAR -- */
.status-bar {
  width: 100%; max-width: var(--max-width);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 4px; margin-bottom: 18px;
  font-size: 11px; font-weight: 500; letter-spacing: 0.06em;
  color: var(--text-faint);
}
.status-right { display: flex; gap: 5px; align-items: center; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-light); }

/* -- WORDMARK -- */
.wordmark {
  text-align: center; margin-bottom: 24px;
  opacity: 0;
  animation: enterCard 0.45s cubic-bezier(0.16,1,0.3,1) 0.02s forwards;
}
.wordmark-name {
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 700; letter-spacing: -0.02em;
  color: var(--text-primary); line-height: 1;
}
.wordmark-sub {
  font-size: 10px; font-weight: 400; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent-light);
  margin-top: 7px; opacity: 0.8;
}

/* ════════════════════════════════════════════
   HOMEPAGE GRID
════════════════════════════════════════════ */
.app-grid {
  width: 100%; max-width: var(--max-width);
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; flex: 1;
}

/* -- FOLDER CARD -- */
.folder {
  background: var(--folder-bg);
  border: 1px solid var(--folder-border);
  border-radius: var(--radius-folder);
  backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
  display: flex; flex-direction: column; overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  opacity: 0; animation: enterCard 0.5s cubic-bezier(0.16,1,0.3,1) forwards;
}
.folder:nth-child(1) { animation-delay: 0.06s; }
.folder:nth-child(2) { animation-delay: 0.13s; }
.folder:nth-child(3) { animation-delay: 0.20s; }
.folder:hover {
  transform: scale(1.013);
  box-shadow: 0 20px 60px rgba(0,0,0,0.30), 0 0 0 1px var(--accent-glow);
}

/* -- APP ICONS INNER GRID -- */
.app-grid-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  padding: 14px 14px 8px;
}

.app-icon {
  aspect-ratio: 1;
  border-radius: var(--radius-app);
  background: var(--app-bg);
  border: 1px solid var(--stroke);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
  padding: 8px 4px 6px;
  transition: background 0.14s ease, transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.14s ease;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none; color: inherit;
}
.app-icon:hover {
  background: var(--app-hover);
  transform: scale(1.09);
  box-shadow: 0 8px 24px rgba(0,0,0,0.20);
}
.app-icon:active { transform: scale(0.94); }
.app-icon.empty { opacity: 0; pointer-events: none; }
.app-icon svg {
  width: clamp(22px, 5.5vw, 28px); height: clamp(22px, 5.5vw, 28px);
  stroke: var(--icon-stroke); stroke-width: 1.5; fill: none;
  stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}
.app-label {
  font-size: clamp(9px, 2vw, 10px); font-weight: 400;
  color: var(--text-muted); text-align: center; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* -- FOLDER LABEL -- */
.folder-label {
  padding: 10px 16px 16px;
  border-top: 1px solid var(--stroke);
}
.folder-label-link {
  text-decoration: none; color: inherit; display: block;
}
.folder-name {
  font-size: clamp(15px, 3.2vw, 18px); font-weight: 600;
  color: var(--text-primary); letter-spacing: -0.01em;
  display: flex; align-items: center; justify-content: space-between;
}
.folder-arrow {
  font-size: 16px; color: var(--accent-light); opacity: 0.6; flex-shrink: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.folder:hover .folder-arrow { transform: translateX(3px); opacity: 1; }
.folder-desc {
  font-size: clamp(10px, 2.1vw, 12px); font-weight: 300;
  color: var(--accent-light); margin-top: 4px; line-height: 1.45; opacity: 0.80;
}

/* ════════════════════════════════════════════
   VIDEO BACKGROUND (shared)
════════════════════════════════════════════ */
.video-bg {
  position: relative;
  background:
    radial-gradient(ellipse 60% 70% at 42% 38%, var(--video-glow) 0%, transparent 62%),
    linear-gradient(148deg, var(--video-bg-dark) 0%, var(--video-bg-deeper) 100%);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.video-bg::before {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background: repeating-linear-gradient(90deg, transparent 0px, transparent 34px, var(--scanline-stripe) 34px, var(--scanline-stripe) 36px);
}
.video-bg::after {
  content: ''; position: absolute; left: 0; right: 0; top: -100%; height: 35%;
  background: linear-gradient(to bottom, transparent, var(--scanline-sweep), transparent);
  animation: scanline 4.5s linear infinite;
}
@keyframes scanline { to { top: 220%; } }

/* -- PLAY BUTTON (shared) -- */
.play-btn {
  border-radius: 50%;
  background: var(--play-bg); border: 1.5px solid var(--play-border);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
  transition: background 0.2s ease, transform 0.2s cubic-bezier(0.34,1.56,0.64,1), border-color 0.2s;
}
.play-btn svg { fill: var(--text-primary); stroke: none; }
.play-btn--sm { width: clamp(44px,11vw,56px); height: clamp(44px,11vw,56px); }
.play-btn--sm svg { width: clamp(16px,4vw,20px); height: clamp(16px,4vw,20px); margin-left: 3px; }
.play-btn--lg { width: 64px; height: 64px; }
.play-btn--lg svg { width: 20px; height: 20px; margin-left: 3px; }

/* -- VIDEO CARD (homepage) -- */
.video-card {
  background: var(--folder-bg); border: 1px solid var(--folder-border);
  border-radius: var(--radius-folder);
  backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  opacity: 0; animation: enterCard 0.5s cubic-bezier(0.16,1,0.3,1) 0.27s forwards;
  text-decoration: none; color: inherit;
}
.video-card:hover {
  transform: scale(1.013);
  box-shadow: 0 20px 60px rgba(0,0,0,0.30), 0 0 0 1px var(--accent-glow);
}
.video-thumb { flex: 1; min-height: 100px; }
.video-card:hover .play-btn {
  background: var(--play-hover-bg); border-color: var(--play-hover-border); transform: scale(1.12);
}
.video-label { padding: 10px 16px 16px; border-top: 1px solid var(--stroke); flex-shrink: 0; }
.video-label-name {
  font-size: clamp(15px,3.2vw,18px); font-weight: 600; color: var(--text-primary);
  letter-spacing: -0.01em; display: flex; align-items: center; justify-content: space-between;
}
.video-label-desc { font-size: clamp(10px,2.1vw,12px); font-weight: 300; color: var(--accent-light); margin-top: 4px; opacity: 0.80; }

/* ════════════════════════════════════════════
   X CLOSE BUTTON
════════════════════════════════════════════ */
.close-btn-wrap {
  display: flex; justify-content: center;
  width: 100%; max-width: var(--max-width);
  margin: 0 auto 28px;
}
.close-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--app-bg); border: 1.5px solid var(--border-accent);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--accent-light);
  transition: background 0.15s, transform 0.2s cubic-bezier(0.34,1.56,0.64,1), border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.close-btn:hover {
  background: var(--accent-glow); border-color: var(--accent-light);
  transform: scale(1.1) rotate(90deg);
}
.close-btn svg { width: 14px; height: 14px; stroke: var(--accent-light); stroke-width: 2; fill: none; stroke-linecap: round; }

/* ════════════════════════════════════════════
   CATEGORY PAGE
════════════════════════════════════════════ */
.category-screen {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  padding: 28px 20px 0;
}
.category-header {
  width: 100%; max-width: var(--max-width); margin-bottom: 28px;
  opacity: 0; animation: enterCard 0.4s cubic-bezier(0.16,1,0.3,1) 0.05s forwards;
}
.category-eyebrow {
  font-size: 10px; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent-light); margin-bottom: 10px; opacity: 0.8;
}
.category-title {
  font-size: clamp(24px, 5.5vw, 34px); font-weight: 700;
  letter-spacing: -0.02em; color: var(--text-primary); line-height: 1.1; margin-bottom: 16px;
}
.category-body {
  font-size: clamp(14px, 3vw, 16px); font-weight: 300;
  color: var(--text-muted); line-height: 1.75;
}
.category-container {
  width: 100%; max-width: var(--max-width);
  border: 1.5px solid var(--border-accent); border-radius: var(--radius-page);
  padding: 20px; background: var(--folder-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  opacity: 0; animation: enterCard 0.45s cubic-bezier(0.16,1,0.3,1) 0.15s forwards;
}
.category-icon-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr; gap: 10px;
}
.category-app-icon {
  aspect-ratio: 1; border-radius: var(--radius-app);
  background: var(--app-bg); border: 1px solid var(--stroke);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  padding: 10px 6px 8px;
  transition: background 0.14s ease, transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.14s;
  -webkit-tap-highlight-color: transparent; text-decoration: none; color: inherit;
}
.category-app-icon:hover { background: var(--app-hover); transform: scale(1.08); box-shadow: 0 8px 24px rgba(0,0,0,0.20); }
.category-app-icon:active { transform: scale(0.94); }
.category-app-icon.empty { opacity: 0; pointer-events: none; }
.category-app-icon svg { width: clamp(24px, 6vw, 32px); height: clamp(24px, 6vw, 32px); stroke: var(--icon-stroke); stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.category-app-label { font-size: clamp(9px, 2.2vw, 11px); font-weight: 400; color: var(--text-muted); text-align: center; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ════════════════════════════════════════════
   SUB-PAGE
════════════════════════════════════════════ */
.subpage-screen {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  padding: 28px 20px 0;
}
.subpage-container {
  width: 100%; max-width: var(--max-width);
  border: 1.5px solid var(--border-accent); border-radius: var(--radius-page);
  padding: 32px 28px 36px; background: var(--folder-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  opacity: 0; animation: enterCard 0.45s cubic-bezier(0.16,1,0.3,1) 0.08s forwards;
}
.subpage-eyebrow {
  font-size: 10px; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent-light); margin-bottom: 10px; opacity: 0.8;
}
.subpage-title {
  font-size: clamp(22px, 5vw, 30px); font-weight: 700;
  letter-spacing: -0.02em; color: var(--text-primary); line-height: 1.12; margin-bottom: 18px;
}
.subpage-rule { width: 36px; height: 1.5px; background: linear-gradient(90deg, var(--accent-light), transparent); margin-bottom: 20px; }
.subpage-body { font-size: clamp(14px, 3vw, 15px); font-weight: 300; color: var(--text-muted); line-height: 1.78; }
.subpage-body p + p { margin-top: 16px; }
.subpage-price {
  font-size: 13px; font-weight: 500; letter-spacing: 0.06em;
  color: var(--accent-light); margin-bottom: 14px; opacity: 0.9;
}

/* -- CTA -- */
.subpage-cta { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--stroke); }
.subpage-cta-label {
  font-size: 11px; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent-light); opacity: 0.8; margin-bottom: 12px;
}
.subpage-cta-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em;
  padding: 12px 20px; background: var(--app-bg);
  border: 1px solid var(--border-accent); border-radius: 100px;
  transition: background 0.15s, transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent; text-decoration: none;
}
.subpage-cta-link:hover { background: var(--accent-glow); transform: scale(1.03); box-shadow: 0 6px 20px rgba(0,0,0,0.18); }
.subpage-cta-link svg { width: 14px; height: 14px; stroke: var(--accent-light); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.subpage-cta-secondary {
  display: inline-block; margin-top: 10px;
  font-size: 13px; font-weight: 400; color: var(--accent-light);
  text-decoration: underline; text-underline-offset: 3px;
  opacity: 0.8; transition: opacity 0.14s;
  -webkit-tap-highlight-color: transparent;
}
.subpage-cta-secondary:hover { opacity: 1; }

/* ════════════════════════════════════════════
   EMBED PLACEHOLDERS
════════════════════════════════════════════ */
.embed-placeholder {
  margin-top: 24px; border-radius: 18px;
  border: 1px dashed var(--border-accent);
  overflow: hidden;
}
.embed-placeholder-inner {
  padding: 36px 20px; text-align: center;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.embed-placeholder-inner p {
  font-size: 14px; font-weight: 500; color: var(--text-muted);
}
.embed-placeholder-inner span {
  font-size: 11px; color: var(--text-faint); letter-spacing: 0.04em;
}

/* -- VIDEO EMBED (watch page) -- */
.video-embed-wrap { margin-top: 24px; border-radius: 18px; overflow: hidden; }
.video-embed-placeholder {
  aspect-ratio: 16/9;
  flex-direction: column; gap: 14px;
}
.video-placeholder-label {
  font-size: 12px; color: var(--text-faint); letter-spacing: 0.05em;
  text-align: center; position: relative; z-index: 1; padding: 0 20px;
}

/* ════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════ */
.site-footer {
  position: relative; z-index: 1;
  width: 100%; max-width: var(--max-width);
  margin: 28px auto 0;
  padding: 24px 4px 32px;
  border-top: 1px solid var(--stroke);
  display: flex; flex-direction: column; gap: 16px;
  align-items: center; text-align: center;
}
.footer-logo {
  font-size: 14px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text-primary);
}
.footer-tagline {
  font-size: 12px; font-weight: 400; color: var(--text-muted);
  font-style: italic; opacity: 0.85;
}
.footer-location {
  font-size: 11px; font-weight: 400; letter-spacing: 0.06em;
  color: var(--text-faint); line-height: 1.6;
}
.footer-location a {
  color: var(--accent-light); text-decoration: underline;
  text-underline-offset: 3px; opacity: 0.85;
}
.footer-location a:hover { opacity: 1; }
.footer-links {
  display: flex; gap: 20px; flex-wrap: wrap; justify-content: center;
}
.footer-links a {
  font-size: 11px; font-weight: 400; letter-spacing: 0.05em;
  color: var(--text-faint); transition: color 0.14s;
}
.footer-links a:hover { color: var(--accent-light); }
.footer-copy {
  font-size: 10px; font-weight: 300; color: var(--text-faint);
  letter-spacing: 0.04em; opacity: 0.7;
}

/* ════════════════════════════════════════════
   ANIMATIONS
════════════════════════════════════════════ */
@keyframes enterCard {
  from { opacity: 0; transform: scale(0.92) translateY(14px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

/* -- REDUCED MOTION -- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
