/* =========================================================================
   FFPombo — component stylesheet
   Every screen in /screens uses this file plus tokens.css. Class names are
   the component vocabulary: reuse them when porting to React/Vue/RN.
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--c-ink);
  background: #111;                 /* page chrome around the device shell  */
  display: flex; justify-content: center; align-items: flex-start;
  padding: 24px;
}

/* ---- Device shell (preview only — drop this in the real app) ----------- */
.device {
  width: 375px; min-height: 812px;
  background: var(--c-bg);
  border-radius: 44px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}
.screen { position: relative; min-height: 812px; display: flex; flex-direction: column; }
.screen--scroll { min-height: 812px; }

/* ---- iOS status bar ---------------------------------------------------- */
.statusbar {
  height: 44px; flex: 0 0 44px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 27px 0 27px;
  font-size: 15px; font-weight: 600; letter-spacing: -.2px;
}
.statusbar__icons { display: flex; gap: 5px; align-items: center; }
.statusbar__icons svg { display: block; }

/* ---- Home indicator ---------------------------------------------------- */
.home-indicator { height: 34px; flex: 0 0 34px; display: flex; align-items: center; justify-content: center; }
.home-indicator::after { content: ""; width: 140px; height: 5px; border-radius: 3px; background: var(--c-ink); opacity: .9; }

/* ---- Top app bar (back / title / settings) ----------------------------- */
.appbar {
  height: 56px; flex: 0 0 56px;
  display: grid; grid-template-columns: 24px 1fr 24px; align-items: center;
  gap: var(--s-4); padding: 0 var(--gutter);
}
.appbar__title { grid-column: 2; text-align: center; font-size: var(--t-label); line-height: var(--lh-label); font-weight: 500; }
.appbar__icon { width: 24px; height: 24px; display: grid; place-items: center; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }
.appbar--tinted { background: var(--cat-hero, transparent); }

/* Circular settings button used on Home */
.icon-btn-circle {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--c-surface); border: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--c-ink);
}

/* ---- Typography helpers ------------------------------------------------ */
.t-display { font-size: var(--t-display); line-height: var(--lh-display); font-weight: var(--fw-display); letter-spacing: -.5px; margin: 0; }
.t-h1      { font-size: var(--t-h1);      line-height: var(--lh-h1);      font-weight: var(--fw-h1); letter-spacing: -.4px; margin: 0; }
.t-h2      { font-size: var(--t-h2);      line-height: var(--lh-h2);      font-weight: var(--fw-h2); letter-spacing: -.3px; margin: 0; }
.t-h3      { font-size: var(--t-h3);      line-height: var(--lh-h3);      font-weight: var(--fw-h3); margin: 0; }
.t-body    { font-size: var(--t-body);    line-height: var(--lh-body);    margin: 0; }
.t-body-lg { font-size: var(--t-body-lg); line-height: var(--lh-body-lg); margin: 0; }
.t-label   { font-size: var(--t-label);   line-height: var(--lh-label);   margin: 0; }
.t-caption { font-size: var(--t-caption); line-height: var(--lh-caption); margin: 0; }
.t-muted   { color: var(--c-muted); }

/* ---- Page body --------------------------------------------------------- */
.page { flex: 1 1 auto; padding: 0 var(--gutter) var(--s-9); }
.page--flush { padding-left: 0; padding-right: 0; }
.section-title { margin: var(--s-7) 0 var(--s-1); }
.section-sub   { color: var(--c-muted); margin-bottom: var(--s-4); }

/* =========================================================================
   HERO CARD — the Home carousel slide (3 category variants)
   Applies a category theme via .is-legal / .is-vital / .is-econ
   ========================================================================= */
.hero { background: var(--cat-hero); padding: 0 0 var(--s-4); border-radius: 0 0 24px 24px; }
.hero__brand { display: flex; align-items: center; justify-content: space-between; padding: var(--s-4) var(--gutter) 0; }
.hero__brand-name { font-size: var(--t-h3); font-weight: 500; }
.hero__art { height: 232px; display: grid; place-items: center; }
.hero__art img, .hero__art svg { max-height: 100%; }
.hero__meta { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--gutter); }
.hero__eyebrow { font-size: var(--t-label); line-height: var(--lh-label); }
.hero__headline { padding: var(--s-1) var(--gutter) var(--s-5); font-size: 20px; line-height: 26px; font-weight: 500; }

/* pager dots */
.dots { display: flex; gap: 4px; align-items: center; }
.dots i { width: 4px; height: 4px; border-radius: 2px; background: rgba(26,26,26,.35); display: block; }
.dots i.is-active { width: 14px; background: var(--c-ink); }

/* ---- Category themes --------------------------------------------------- */
.is-legal { --cat-hero: var(--c-legal-hero); --cat-row: var(--c-legal-row); --cat-chip: var(--c-legal-chip); }
.is-vital { --cat-hero: var(--c-vital-hero); --cat-row: var(--c-vital-row); --cat-chip: var(--c-vital-chip); }
.is-econ  { --cat-hero: var(--c-econ-hero);  --cat-row: var(--c-econ-row);  --cat-chip: var(--c-econ-chip);  }

/* =========================================================================
   NAV LIST — tinted rows inside a rounded card (the app's primary affordance)
   Prototype frames 19/20/21 are the standalone component specs.
   Row height 57px, 16px h-padding, 1px hairline between rows.
   ========================================================================= */
.nav-list { margin: 0 var(--s-2); border-radius: var(--r-card); overflow: hidden; background: var(--cat-row, var(--c-surface)); }
.nav-list__row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: 57px; padding: var(--s-4);
  font-size: var(--t-body); line-height: var(--lh-body);
  color: var(--c-ink); text-decoration: none;
  border-bottom: 1px solid rgba(26,26,26,.07);
}
.nav-list__row:last-child { border-bottom: 0; }
.nav-list__row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-list__row svg { flex: 0 0 auto; }

/* =========================================================================
   CONTENT CARD — white card with title + 2-line description + arrow
   (section list screens: "Cuentas bancarias", "Ayudas", settings groups)
   ========================================================================= */
.card-list { display: flex; flex-direction: column; gap: var(--s-3); }
.card {
  background: var(--c-surface); border-radius: var(--r-card);
  padding: var(--card-pad); box-shadow: var(--shadow-card);
}
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.card__title { font-size: var(--t-h3); line-height: var(--lh-h3); font-weight: 500; }
.card__desc  { color: var(--c-muted); margin-top: var(--s-2); }
.card--link { text-decoration: none; color: inherit; display: block; }

/* ---- Horizontal content carousel (Home: "Más reciente"/"Más consultado") */
.carousel { display: flex; gap: var(--s-3); overflow-x: auto; padding: 0 var(--gutter) var(--s-2); scroll-snap-type: x mandatory; }
.carousel::-webkit-scrollbar { display: none; }
.content-card {
  flex: 0 0 259px; scroll-snap-align: start;
  background: var(--c-surface); border-radius: var(--r-card);
  padding: var(--card-pad); min-height: 210px;
  display: flex; flex-direction: column; position: relative;
}
.content-card__top { display: flex; align-items: center; justify-content: space-between; }
.chip { background: var(--cat-chip, var(--c-legal-chip)); border-radius: var(--r-pill); padding: 6px 12px; font-size: var(--t-caption); line-height: var(--lh-caption); }
.content-card__title { margin: var(--s-4) 0 var(--s-2); font-size: var(--t-h3); line-height: var(--lh-h3); font-weight: 500; }
.content-card__excerpt { color: var(--c-muted); }
.content-card__go { position: absolute; right: var(--card-pad); bottom: var(--card-pad); width: 32px; height: 32px; border-radius: 50%; background: #EFEBE7; display: grid; place-items: center; }

/* =========================================================================
   BUTTONS
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  width: 100%; min-height: 56px; padding: 0 var(--s-6);
  border: 0; border-radius: var(--r-pill); cursor: pointer;
  font: inherit; font-size: var(--t-body-lg); font-weight: 500;
}
.btn--primary { background: var(--c-btn-primary-bg); color: var(--c-btn-primary-fg); }
.btn--ghost   { background: var(--c-btn-ghost-bg);   color: var(--c-btn-ghost-fg); }
.btn-floating { position: absolute; left: 50%; transform: translateX(-50%); bottom: 96px; width: auto; min-height: 48px; }

/* =========================================================================
   BOTTOM TAB BAR — floating pill, 4 tabs, sits above the home indicator
   ========================================================================= */
.tabbar {
  position: sticky; bottom: 0; margin: 0 var(--s-4) var(--s-2);
  background: var(--c-surface); border-radius: var(--r-pill);
  box-shadow: var(--shadow-nav);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: var(--s-2) var(--s-3);
}
.tabbar__item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: var(--t-tab); line-height: var(--lh-tab);
  color: var(--c-muted); text-decoration: none; padding: var(--s-1) 0;
}
.tabbar__item.is-active { color: var(--c-ink); }

/* =========================================================================
   BOTTOM SHEET / MODAL  (frames 14, 17, 18)
   Scrim over the underlying screen; sheet pinned to the bottom.
   ========================================================================= */
.scrim { position: absolute; inset: 0; background: rgba(26,26,26,.55); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--c-surface);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: var(--s-3) var(--gutter) var(--s-8);
  box-shadow: var(--shadow-sheet);
  text-align: center;
}
.sheet__grabber { width: 36px; height: 4px; border-radius: 2px; background: #DCD7D2; margin: 0 auto var(--s-6); }
.sheet__icon  { margin: var(--s-6) auto var(--s-6); }
.sheet__title { margin-bottom: var(--s-3); }
.sheet__body  { color: var(--c-muted); margin-bottom: var(--s-8); }
.sheet__actions { display: flex; flex-direction: column; gap: var(--s-3); }

/* ---- Star rating ------------------------------------------------------- */
.rating { display: flex; justify-content: center; gap: var(--s-3); margin: var(--s-4) 0 var(--s-6); }
.rating__label { color: var(--c-ink); font-size: var(--t-body); }

/* =========================================================================
   SETTINGS ROWS — icon + label (+ description) + control
   ========================================================================= */
.setting { background: var(--c-surface); border-radius: var(--r-card); padding: var(--card-pad); box-shadow: var(--shadow-card); }
.setting__row { display: flex; align-items: flex-start; gap: var(--s-3); }
.setting__icon { flex: 0 0 24px; margin-top: 1px; }
.setting__text { flex: 1 1 auto; }
.setting__label { font-size: var(--t-h3); line-height: var(--lh-h3); font-weight: 500; }
.setting__desc  { color: var(--c-muted); margin-top: var(--s-1); }
.setting__value { color: var(--c-muted); display: flex; align-items: center; gap: var(--s-1); font-size: var(--t-body); }
.group-title { margin: var(--s-7) 0 var(--s-3); font-size: var(--t-h3); font-weight: 500; }

/* iOS-style switch */
.switch { flex: 0 0 auto; width: 52px; height: 32px; border-radius: var(--r-pill); background: #DCD7D2; position: relative; border: 0; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch[aria-checked="true"] { background: var(--c-ink-2); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* =========================================================================
   ARTICLE PREVIEW  (frame 8)
   ========================================================================= */
.article-hero { background: var(--cat-hero); padding: var(--s-2) var(--gutter) var(--s-7); }
.article-hero__close { margin-bottom: var(--s-6); }
.article-hero__meta { display: flex; gap: var(--s-6); margin-top: var(--s-4); font-size: var(--t-label); }
.article-hero__meta span { display: inline-flex; align-items: center; gap: var(--s-2); }
.article-hero__q { margin-top: var(--s-7); font-weight: 500; font-size: var(--t-body-lg); }
.article-hero__a { margin-top: var(--s-2); font-size: var(--t-body); line-height: var(--lh-body); }

.keypoints { background: var(--c-bg); border-radius: var(--r-sheet) var(--r-sheet) 0 0; padding: var(--s-6) var(--gutter) var(--s-9); margin-top: -16px; }
.keypoint { text-decoration: none; color: inherit; display: flex; align-items: flex-start; gap: var(--s-4); background: var(--c-surface); border-radius: var(--r-card); padding: var(--card-pad); margin-bottom: var(--s-3); box-shadow: var(--shadow-card); }
.keypoint__n { flex: 0 0 20px; color: var(--c-ink); font-size: var(--t-body); }
.keypoint__t { flex: 1 1 auto; font-size: var(--t-body); line-height: var(--lh-body); }

/* =========================================================================
   ARTICLE READER  (frames 9 light / 10 dark)
   ========================================================================= */
.reader { background: var(--c-bg-2); }
.reader__bar { display: flex; align-items: center; justify-content: space-between; padding: var(--s-4) var(--gutter); }
.reader__tools { display: flex; gap: var(--s-6); }
.reader__body { padding: 0 var(--gutter) var(--s-9); }
.reader__body h1 { font-size: var(--t-h1); line-height: var(--lh-h1); font-weight: 500; margin: var(--s-6) 0 var(--s-5); }
.reader__body h2 { font-size: var(--t-h3); font-weight: 600; margin: var(--s-7) 0 var(--s-3); }
.reader__body a { color: inherit; }
.reader__body p, .reader__body li { font-size: var(--t-body-lg); line-height: 28px; }
.reader__body ol { padding-left: 22px; margin: var(--s-2) 0 var(--s-5); }
.reader__body img { width: 100%; border-radius: var(--r-card); margin: var(--s-4) 0; }
.reader__body blockquote { margin: var(--s-6) 0; font-size: 18px; line-height: 28px; }
.reader__rule { border: 0; border-top: 1px solid var(--c-hairline); margin: var(--s-4) 0 0; }

.theme-dark { background: var(--c-dark-bg); color: var(--c-dark-fg); }
.theme-dark .reader { background: var(--c-dark-bg); }
.theme-dark .t-muted, .theme-dark .card__desc, .theme-dark .setting__desc { color: var(--c-dark-muted); }
.theme-dark .reader__rule { border-color: rgba(255,255,255,.14); }

/* anchors inside the device shell never take UA link styling */
.screen a { color: inherit; }

/* ---- Compact exit control (article/reader screens, frames 8-10) --------- */
.exit-pill {
  position: sticky; bottom: 12px; margin: 0 auto var(--s-2);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--c-surface); color: var(--c-ink);
  border: 0; border-radius: var(--r-pill); cursor: pointer;
  padding: var(--s-2) var(--s-4); font: inherit;
  font-size: var(--t-tab); line-height: var(--lh-tab);
  box-shadow: var(--shadow-nav);
}
.theme-dark .exit-pill { background: #2A2A2A; color: var(--c-dark-fg); }
