/* ============================================================
   CULTURILY — APP SHELL + SKILL TREE + LANDING PAGE
   Requires: global.css, components.css
   ============================================================ */


/* ─────────────────────────────────────────────────────────── */
/* APP TOP BAR (2-row: HUD + XP bar)                           */
/* ─────────────────────────────────────────────────────────── */

.app-top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: var(--z-sticky);
  display: flex;
  flex-direction: column;
}

.app-top-bar-row {
  height: var(--top-bar-h);
  display: flex;
  align-items: center;
  padding-inline: var(--sp-4);
}

.app-top-bar-row-inner {
  width: 100%;
  max-width: var(--app-width);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.top-bar-culture-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2) var(--sp-1) var(--sp-1);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
  flex-shrink: 0;
}
.top-bar-culture-btn:hover { background: var(--surface-2); }

.top-bar-flag { font-size: 22px; line-height: 1; }

.top-bar-culture-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.top-bar-culture-name {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.2;
}

.top-bar-username {
  font-size: 11px;
  color: var(--text-subtle);
  line-height: 1;
  font-weight: 400;
}

.top-bar-hud {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex: 1;
  justify-content: flex-end;
}

/* ── Profile / sign-out dropdown ──────────────────────────── */

.top-bar-profile-wrap {
  position: relative;
  flex-shrink: 0;
}

.top-bar-profile-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  color: var(--text-subtle);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.top-bar-profile-btn:hover,
.top-bar-profile-btn[aria-expanded="true"] {
  background: var(--surface-3);
  color: var(--text-primary);
}

.top-bar-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 148px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: var(--z-dropdown);
}

.top-bar-dropdown[hidden] { display: none; }

.top-bar-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.top-bar-dropdown-item:hover {
  background: var(--surface-3);
}

/* ── Phosphor icon sizing in top bar buttons ─────────────── */

.theme-toggle-btn i[class*="ph-"] { font-size: 17px; }
.top-bar-profile-btn i[class*="ph-"] { font-size: 20px; }

/* ── Theme toggle button ─────────────────────────────────── */

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-subtle);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle-btn:hover {
  background: var(--surface-3);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.top-bar-dropdown-item.is-danger { color: var(--error); }
.top-bar-dropdown-item.is-danger:hover { background: var(--error-dim); }

.app-top-bar-xp {
  padding: 0 var(--sp-4) var(--sp-2);
}

.app-top-bar-xp-inner {
  width: 100%;
  max-width: var(--app-width);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.xp-level-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-subtle);
  min-width: 22px;
  line-height: 1;
}

.xp-bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
  border: 1px solid var(--border);
}

.xp-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width 600ms var(--ease-out);
  min-width: 3px;
}

/* Light mode: explicit grey track so lime fill is always visible */
html.theme-light .xp-bar-track {
  background: #E0E0E0;
  border-color: #D0D0D0;
}


/* ─────────────────────────────────────────────────────────── */
/* APP SCROLL AREA                                              */
/* ─────────────────────────────────────────────────────────── */

.app-scroll-area {
  padding-top: 88px;
  padding-bottom: calc(var(--nav-bottom-h) + var(--sp-4));
  min-height: 100dvh;
}


/* ─────────────────────────────────────────────────────────── */
/* LOADING SPLASH                                               */
/* ─────────────────────────────────────────────────────────── */

.app-loading {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  z-index: var(--z-modal);
}

.app-loading-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.app-loading-logo-mark {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-loading-logo-mark svg { width: 20px; height: 20px; }

.app-loading-logo-name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
}


/* ─────────────────────────────────────────────────────────── */
/* CULTURE TREE HEADER                                          */
/* ─────────────────────────────────────────────────────────── */

.culture-tree-header {
  padding: var(--sp-6) var(--sp-4) var(--sp-4);
  max-width: var(--app-width);
  margin-inline: auto;
}

.culture-tree-flag {
  font-size: 52px;
  line-height: 1;
  margin-bottom: var(--sp-3);
}

.culture-tree-title {
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--sp-1);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.culture-tree-subtitle {
  font-size: var(--text-sm);
  color: var(--text-subtle);
  margin-bottom: var(--sp-4);
}

.culture-tree-overall {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.culture-tree-overall-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.culture-tree-overall-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}

.culture-tree-overall-fill {
  height: 100%;
  background: var(--culture-accent);
  border-radius: var(--r-full);
  transition: width 600ms var(--ease-out);
  min-width: 3px;
}

.culture-tree-overall-pct {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-subtle);
  min-width: 32px;
  text-align: right;
}


/* ─────────────────────────────────────────────────────────── */
/* SKILL TREE (accordion)                                       */
/* ─────────────────────────────────────────────────────────── */

.skill-tree {
  width: 100%;
  max-width: var(--app-width);
  margin-inline: auto;
  padding: 0 var(--sp-4) var(--sp-10);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}


/* ── Unit accordion card ────────────────────────────────────── */

.unit-accordion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
}

.unit-accordion.is-locked {
  opacity: 0.5;
}


/* ── Unit header ────────────────────────────────────────────── */

.unit-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast) var(--ease);
}

.unit-accordion-header:hover:not([aria-disabled]) {
  background: var(--surface-2);
}

.unit-accordion.is-locked .unit-accordion-header {
  cursor: default;
}

.unit-accordion-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  /* fallback for browsers without color-mix() support */
  background: var(--surface-4);
  background: color-mix(in srgb, var(--unit-color, var(--accent)) 15%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}

.unit-accordion.is-locked .unit-accordion-icon {
  background: var(--surface-3);
}

.unit-accordion-info {
  flex: 1;
  min-width: 0;
}

.unit-accordion-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

.unit-accordion-sub {
  font-size: var(--text-xs);
  color: var(--text-subtle);
  font-weight: 500;
  margin-top: 2px;
}

.unit-accordion-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.unit-complete-icon {
  font-size: 20px;
  line-height: 1;
}

/* Chevron arrow — CSS-drawn so no extra deps */
.unit-accordion-chevron {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--t-base) var(--ease);
}

.unit-accordion-chevron::after {
  content: '';
  display: block;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg) translate(-1px, -2px);
  transition: transform var(--t-base) var(--ease);
}

.unit-accordion-chevron.is-open::after {
  transform: rotate(-135deg) translate(-2px, -1px);
}


/* ── Unit progress bar ──────────────────────────────────────── */

.unit-accordion-progress {
  height: 3px;
  background: var(--surface-3);
  margin: 0 var(--sp-4) var(--sp-1);
  border-radius: var(--r-full);
  overflow: hidden;
}

.unit-accordion-progress-fill {
  height: 100%;
  background: var(--unit-color, var(--accent));
  border-radius: var(--r-full);
  transition: width 600ms var(--ease-out);
  min-width: 0;
}


/* ── Lessons list ───────────────────────────────────────────── */

.unit-lessons-list {
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}


/* ── Lesson row ─────────────────────────────────────────────── */

.lesson-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  position: relative;
  transition: background var(--t-fast) var(--ease),
              transform  var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.lesson-item.is-next {
  background: #CCFF00;
}

.lesson-item.is-complete {
  background: var(--surface-2);
  opacity: 0.72;
}

.lesson-item.is-locked {
  opacity: 0.4;
}

.lesson-item:not(.is-locked) {
  cursor: pointer;
}

.lesson-item:not(.is-locked):hover {
  background: var(--surface-3);
}

.lesson-item.is-next:hover {
  background: #d4f500;
}

.lesson-item:not(.is-locked):active {
  transform: scale(0.98);
}

.lesson-item-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  /* fallback for browsers without color-mix() support */
  background: var(--surface-4);
  background: color-mix(in srgb, var(--unit-color, var(--accent)) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}

.lesson-item.is-locked .lesson-item-icon {
  background: var(--surface-3);
}

.lesson-item.is-complete .lesson-item-icon {
  opacity: 0.6;
}

.lesson-item-title {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: var(--leading-snug);
}

.lesson-item.is-next .lesson-item-title {
  color: #0e0e0e;
}

.lesson-item.is-next .lesson-item-icon {
  background: rgba(0, 0, 0, 0.10);
}

.lesson-item.is-next .lesson-star {
  color: rgba(0, 0, 0, 0.20);
}

.lesson-item.is-locked .lesson-item-title {
  color: var(--text-subtle);
}

.lesson-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.lesson-item-stars {
  display: flex;
  gap: 2px;
}

.lesson-star {
  font-size: 12px;
  line-height: 1;
  color: var(--surface-4);
}

.lesson-star.earned {
  color: #fbbf24;
}

.lesson-start-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #CCFF00;
  background: #0e0e0e;
  padding: 2px 7px;
  border-radius: var(--r-full);
  white-space: nowrap;
}


/* ─────────────────────────────────────────────────────────── */
/* LANDING PAGE                                                 */
/* ─────────────────────────────────────────────────────────── */

.landing-page { min-height: 100dvh; }

/* Nav */
.landing-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(23, 23, 23, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  align-items: center;
  padding-inline: var(--sp-5);
}

.landing-nav-inner {
  width: 100%;
  max-width: var(--wide-width);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.landing-nav-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
}

.landing-nav-logo-mark {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.landing-nav-logo-mark svg { width: 17px; height: 17px; }

.landing-nav-logo-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: var(--text-xl);
  font-weight: 500;
  color: #ffffff;  /* nav is always dark rgba(14,14,14) so always white */
}

/* Phosphor icon sizing inside how-card-icon */
.how-card-icon i[class*="ph-"] {
  font-size: 36px;
  color: var(--accent);
  display: block;
  line-height: 1;
}


.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* Hero */
.landing-hero {
  padding: clamp(var(--sp-16), 10vh, var(--sp-20)) var(--sp-5)
           clamp(var(--sp-12), 8vh, var(--sp-16));
  text-align: center;
  background: var(--bg);
}

.landing-hero-inner { max-width: 640px; margin-inline: auto; }

.landing-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-4);
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--sp-6);
}

.landing-hero-headline {
  font-family: var(--font-display);
  font-size: clamp(var(--text-4xl), 8vw, 64px);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: var(--sp-5);
}

.landing-hero-headline em {
  font-style: normal;
  color: var(--accent);
}

.landing-hero-subline {
  font-size: clamp(var(--text-lg), 2.5vw, var(--text-xl));
  color: var(--accent);
  font-weight: 500;
  margin-bottom: var(--sp-5);
}

.landing-hero-sub {
  font-size: clamp(var(--text-base), 2.2vw, var(--text-lg));
  color: var(--text-subtle);
  line-height: var(--leading-relaxed);
  max-width: 500px;
  margin-inline: auto;
  margin-bottom: var(--sp-8);
}

.landing-hero-ctas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.landing-hero-note {
  font-size: var(--text-xs);
  color: var(--text-subtle);
}

/* Proof strip */
.landing-proof {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
  padding: var(--sp-6) var(--sp-5);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.landing-proof-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.landing-proof-value {
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
  font-size: var(--text-3xl);
  font-weight: 500;
  color: var(--accent);
  line-height: 1;
}

.landing-proof-label {
  font-size: var(--text-xs);
  color: var(--text-subtle);
  font-weight: 500;
  text-align: center;
}

/* How it works */
.landing-how {
  padding: clamp(var(--sp-12), 8vw, var(--sp-16)) var(--sp-5);
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* Black section → grey cards (base .how-card is already var(--surface)) */

.landing-how-inner {
  max-width: var(--wide-width);
  margin-inline: auto;
}

.landing-section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-3);
}

.landing-section-heading {
  font-family: var(--font-display);
  font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl));
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-2);
}

.landing-section-body {
  font-size: var(--text-base);
  color: var(--text-subtle);
  max-width: 520px;
  line-height: var(--leading-relaxed);
  margin-bottom: var(--sp-8);
}

.how-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}

@media (min-width: 600px) {
  .how-grid { grid-template-columns: repeat(3, 1fr); }
}

.how-card {
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.how-card-icon {
  font-size: 36px;
  line-height: 1;
}

.how-card-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.how-card-body {
  font-size: var(--text-sm);
  color: var(--text-subtle);
  line-height: var(--leading-relaxed);
}

/* Features */
.landing-features {
  padding: clamp(var(--sp-12), 8vw, var(--sp-16)) var(--sp-5);
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.landing-features-inner {
  max-width: var(--wide-width);
  margin-inline: auto;
}

/* Grey section → black cards */
.landing-features .how-card {
  background: var(--bg);
}

/* Culture cards */
.landing-cultures {
  padding: clamp(var(--sp-12), 8vw, var(--sp-16)) var(--sp-5);
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.landing-cultures-inner {
  max-width: var(--wide-width);
  margin-inline: auto;
}

/* Black section → grey cards (base .culture-card is already var(--surface)) */

.culture-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-4);
}

/* Bottom CTA */
.landing-cta-section {
  padding: clamp(var(--sp-16), 10vh, var(--sp-20)) var(--sp-5);
  text-align: center;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.landing-cta-inner { max-width: 520px; margin-inline: auto; }

.landing-cta-headline {
  font-family: var(--font-display);
  font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl));
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-4);
}

.landing-cta-sub {
  font-size: var(--text-base);
  color: var(--text-subtle);
  margin-bottom: var(--sp-8);
  line-height: var(--leading-relaxed);
}

/* Footer */
.landing-footer {
  padding: var(--sp-8) var(--sp-5);
  border-top: 1px solid var(--border);
}

.landing-footer-inner {
  max-width: var(--wide-width);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  text-align: center;
}

@media (min-width: 640px) {
  .landing-footer-inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.landing-footer-copy {
  font-size: var(--text-sm);
  color: var(--text-subtle);
}

.landing-footer-links {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.landing-footer-link {
  font-size: var(--text-sm);
  color: var(--text-subtle);
  transition: color var(--t-fast) var(--ease);
}
.landing-footer-link:hover { color: var(--text-muted); }
