/* Hallmark · macrostructure: n/a (design-system) · tone: luxury-formal (feminine, consulting) · anchor hue: rose 12°
 * theme: custom "Sakura Ledger" · paper #FBF7F4 · strong-accent plum #6C2440 · soft-accent sakura #F5CAD6
 * fonts: Fraunces (display serif) + Hanken Grotesk (data sans)
 * pre-emit critique: P5 H5 E5 S4 R5 V4
 * ---------------------------------------------------------------------------
 * SAKURA LEDGER — design system for an MBA business-plan financial dashboard.
 * Register: investment-committee / management-consulting. Formal first, feminine
 * through restraint (soft rose motifs, warm cream, high-contrast serif display),
 * never decorative-for-its-own-sake. One deep accent (plum), one soft accent
 * (sakura), warm rose-tinted neutrals, refined sage/rose semantics.
 * ------------------------------------------------------------------------- */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,340..640;1,9..144,340..560&family=Hanken+Grotesk:wght@400;500;600;700&display=swap");

:root {
  /* — Type families —————————————————————————————————————————— */
  --font-display: "Fraunces", "Hoefler Text", Georgia, serif;      /* headings, hero, KPI figures */
  --font-body:    "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif; /* prose, UI, table data */

  /* — Palette · surfaces ————————————————————————————————————— */
  --cream:        #FDFBFA;   /* page ground — casi blanco, apenas cálido (mejor contraste) */
  --paper:        #FFFDFC;   /* raised surface: cards, panels */
  --paper-sunk:   #F6EEEA;   /* inset wells, zebra stripes */
  --rule:         #EBDDDE;   /* hairline dividers */
  --border:       #DCC7CD;   /* firmer component borders */

  /* — Palette · sakura (soft accent) ————————————————————————— */
  --sakura-soft:  #F5CAD6;   /* petal fill, decorative tints */
  --sakura:       #EBA9BC;   /* chip-active fill, soft emphasis */
  --rose:         #C15A78;   /* mid accent: links, underlines, active marks */

  /* — Palette · plum (strong accent / brand) ————————————————— */
  --plum:         #6C2440;   /* primary accent, primary button, focus */
  --plum-deep:    #4C182F;   /* darkest brand, display headings */

  /* — Palette · ink & neutrals (warm, AA) ———————————————————— */
  --ink:          #2B2026;   /* body text — ~15:1 on cream */
  --muted:        #6E5860;   /* secondary text — ~6:1 on cream */
  --faint:        #7A636D;   /* labels, captions — ~5.3:1 on cream */

  /* — Palette · finance semantics ———————————————————————————— */
  --pos:          #3F7A5B;   /* positive — muted sage-forest */
  --pos-bg:       #E3EFE6;
  --neg:          #B23A4E;   /* negative — refined rose-red (on-theme) */
  --neg-bg:       #F7E2E5;
  --neu:          #6E5860;   /* neutral — reuses muted */
  --neu-bg:       #F1E9EC;   /* soft mauve wash */
  --gold:         #C9A24B;   /* antique-gold hairline highlight, used sparingly */

  --focus:        #6C2440;   /* focus ring — plum, ~10:1 on cream */

  /* — Spacing · 4pt scale ———————————————————————————————————— */
  --space-2xs: 0.25rem;  /*  4 */
  --space-xs:  0.5rem;   /*  8 */
  --space-sm:  0.75rem;  /* 12 */
  --space-md:  1rem;     /* 16 */
  --space-lg:  1.5rem;   /* 24 */
  --space-xl:  2.5rem;   /* 40 */
  --space-2xl: 4rem;     /* 64 */
  --space-3xl: 6rem;     /* 96 */

  /* — Radii ——————————————————————————————————————————————————— */
  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-pill: 999px;

  /* — Type scale · major third (1.25) from 16px ——————————————— */
  --text-xs:   0.8rem;    /* 12.8 */
  --text-sm:   0.9rem;    /* 14.4 */
  --text-base: 1rem;      /* 16   */
  --text-md:   1.25rem;   /* 20   */
  --text-lg:   1.5625rem; /* 25   */
  --text-xl:   1.9531rem; /* 31.25 */
  --text-2xl:  2.4414rem; /* 39   */
  --text-3xl:  3.0518rem; /* 48.8 */
  --text-display: clamp(2.5rem, 4vw + 1rem, 4.25rem);

  /* — Soft, rose-tinted shadows —————————————————————————————— */
  --shadow-sm: 0 1px 2px rgba(76, 24, 47, 0.05);
  --shadow-md: 0 4px 16px -6px rgba(76, 24, 47, 0.10);
  --shadow-lg: 0 18px 48px -22px rgba(76, 24, 47, 0.20);

  /* — Motion ————————————————————————————————————————————————— */
  --dur-short: 120ms;
  --dur-med:   220ms;
  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:   cubic-bezier(0.55, 0, 1, 0.45);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* — Petal motif (inline SVG data-URIs) ————————————————————— */
  --motif-blossom: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='80'%20height='80'%20viewBox='0%200%2080%2080'%3E%3Cg%20fill='%23F5CAD6'%3E%3Cpath%20d='M40%2040%20C30%2030%2031%2016%2040%208%20C49%2016%2050%2030%2040%2040Z'/%3E%3Cpath%20d='M40%2040%20C30%2030%2031%2016%2040%208%20C49%2016%2050%2030%2040%2040Z'%20transform='rotate(72%2040%2040)'/%3E%3Cpath%20d='M40%2040%20C30%2030%2031%2016%2040%208%20C49%2016%2050%2030%2040%2040Z'%20transform='rotate(144%2040%2040)'/%3E%3Cpath%20d='M40%2040%20C30%2030%2031%2016%2040%208%20C49%2016%2050%2030%2040%2040Z'%20transform='rotate(216%2040%2040)'/%3E%3Cpath%20d='M40%2040%20C30%2030%2031%2016%2040%208%20C49%2016%2050%2030%2040%2040Z'%20transform='rotate(288%2040%2040)'/%3E%3C/g%3E%3Ccircle%20cx='40'%20cy='40'%20r='4'%20fill='%23C9A24B'/%3E%3C/svg%3E");
  --motif-petal: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='34'%20viewBox='0%200%2032%2034'%3E%3Cpath%20d='M16%2031%20C5%2025%205%2012%2013%204%20C14.5%202.5%2015.2%205%2016%206%20C16.8%205%2017.5%202.5%2019%204%20C27%2012%2027%2025%2016%2031Z'%20fill='%23F5CAD6'/%3E%3C/svg%3E");
}

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

html, body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-style: normal;
  color: var(--plum-deep);
  line-height: 1.12;
  letter-spacing: -0.015em;
  font-weight: 560;
  margin: 0 0 var(--space-sm);
}

a { color: var(--rose); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--plum); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

.num, .tabular { font-variant-numeric: tabular-nums; }

/* — Section ————————————————————————————————————————————————————— */
.section {
  padding-block: var(--space-2xl);
  padding-inline: clamp(1.25rem, 5vw, var(--space-3xl));
  max-width: 76rem;
  margin-inline: auto;
}
.section + .section { padding-top: var(--space-xl); }

.section__kicker {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rose);
  margin: 0 0 var(--space-2xs);
}
.section__title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-lg);
}
.section__title::after {
  /* discreet gold hairline anchor under section titles */
  content: "";
  display: block;
  width: 2.5rem;
  height: 2px;
  margin-top: var(--space-sm);
  background: var(--gold);
  border-radius: var(--radius-pill);
}

/* — Hero ———————————————————————————————————————————————————————— */
.hero {
  position: relative;
  overflow: visible;                 /* la rama NO se corta: fluye hasta el borde de la ventana */
  background: linear-gradient(180deg, var(--paper) 0%, var(--cream) 100%);
  border-bottom: 1px solid var(--rule);
  padding: clamp(var(--space-xl), 6vw, var(--space-3xl)) 0;  /* lateral lo da el .wrap interno */
}
.hero::before {
  /* rama como en la 1ª versión (32.png, esquina superior derecha en diagonal) pero traslúcida */
  content: "";
  position: absolute;
  top: -10px; right: 0;
  width: clamp(360px, 44vw, 660px);
  aspect-ratio: 536 / 350;
  background: url("assets/sakura/32.png") right top / contain no-repeat;
  opacity: 0.5;
  pointer-events: none;
}
.hero::after {
  /* rama secundaria, esquina inferior izquierda, muy sutil */
  content: "";
  position: absolute;
  left: -60px; bottom: -46px;
  width: min(22%, 230px);
  aspect-ratio: 1 / 1;
  background: url("assets/sakura/30.png") left bottom / contain no-repeat;
  opacity: 0.30;
  pointer-events: none;
}

/* ---- Más ramas: pie de página (arriba Y abajo, distribuidas) ---- */
.foot { position: relative; overflow: clip; }
.foot::before {
  content:""; position:absolute; left:-46px; bottom:-30px;
  width:min(30%,320px); aspect-ratio:360/360;
  background:url("assets/sakura/31.png") left bottom / contain no-repeat;
  opacity:.34; pointer-events:none;
}
.foot::after {
  content:""; position:absolute; right:-30px; top:-40px;
  width:min(34%,360px); aspect-ratio:536/350;
  background:url("assets/sakura/32.png") right top / contain no-repeat;
  opacity:.4; pointer-events:none;
}

/* ---- Pétalos cayendo — vida natural y sutil (lo que quita el efecto "PNG pegado") ---- */
.petals { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 6; }
.petal {
  position: absolute; top: -6vh; width: 15px; height: 16px; opacity: 0;
  background: var(--motif-petal) center / contain no-repeat;
  will-change: transform, opacity;
  animation: petal-fall linear infinite;
}
@keyframes petal-fall {
  0%   { transform: translate(0, -6vh) rotate(0deg);   opacity: 0; }
  8%   { opacity: .6; }
  92%  { opacity: .45; }
  100% { transform: translate(var(--drift, 40px), 108vh) rotate(340deg); opacity: 0; }
}
.page { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .petal { display: none; } }
.hero > * { position: relative; z-index: 1; }
.hero__eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rose);
  margin-bottom: var(--space-sm);
}
.hero__title {
  font-size: var(--text-display);
  color: var(--plum-deep);
  max-width: 18ch;
  margin-bottom: var(--space-md);
  overflow-wrap: anywhere;
}
.hero__lede {
  font-size: var(--text-md);
  line-height: 1.55;
  color: var(--muted);
  max-width: 58ch;
  margin: 0;
}

/* — KPI card ———————————————————————————————————————————————————— */
.kpi {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-med) var(--ease-out),
              transform var(--dur-med) var(--ease-out),
              border-color var(--dur-med) var(--ease-out);
}
.kpi:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border);
}
.kpi__label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 var(--space-xs);
}
.kpi__value {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: var(--text-2xl);
  line-height: 1.05;
  color: var(--plum-deep);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.kpi__unit { font-size: 0.5em; color: var(--muted); margin-left: 0.15em; }
.kpi__delta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  margin-top: var(--space-xs);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.kpi__delta--up   { color: var(--pos); }
.kpi__delta--down { color: var(--neg); }
.kpi__delta--up::before   { content: "▲"; font-size: 0.7em; }
.kpi__delta--down::before { content: "▼"; font-size: 0.7em; }
.kpi__delta--flat { color: var(--muted); }
.kpi__delta--flat::before { content: "—"; }

/* — Button —————————————————————————————————————————————————————— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.6rem 1.15rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--plum);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur-short) var(--ease-out),
              border-color var(--dur-short) var(--ease-out),
              color var(--dur-short) var(--ease-out),
              transform var(--dur-short) var(--ease-out);
}
.btn:hover { border-color: var(--rose); background: var(--paper-sunk); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn--primary {
  color: var(--cream);
  background: var(--plum);
  border-color: var(--plum);
}
.btn--primary:hover { background: var(--plum-deep); border-color: var(--plum-deep); }

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--rose);
}
.btn--ghost:hover { background: var(--neu-bg); color: var(--plum); }

/* — Chip (filter toggle) ———————————————————————————————————————— */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 0.3rem 0.8rem;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--dur-short) var(--ease-out),
              border-color var(--dur-short) var(--ease-out),
              color var(--dur-short) var(--ease-out);
}
.chip:hover { border-color: var(--rose); color: var(--plum); }
.chip[aria-pressed="true"], .chip.is-active {
  background: var(--sakura-soft);
  border-color: var(--rose);
  color: var(--plum-deep);
  font-weight: 600;
}

/* — Sentiment badges ———————————————————————————————————————————— */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 0.15rem 0.6rem;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  border-radius: var(--radius-pill);
  color: var(--neu);
  background: var(--neu-bg);
}
.badge--positive { color: var(--pos); background: var(--pos-bg); }
.badge--negative { color: var(--neg); background: var(--neg-bg); }
.badge--neutral  { color: var(--neu); background: var(--neu-bg); }

/* — Data table —————————————————————————————————————————————————— */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.tbl thead th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
.tbl tbody td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
}
.tbl tbody tr { transition: background var(--dur-short) var(--ease-out); }
.tbl tbody tr:hover { background: var(--paper-sunk); }
.tbl .num, .tbl td.num, .tbl th.num { text-align: right; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl caption {
  caption-side: top;
  text-align: left;
  font-family: var(--font-display);
  font-size: var(--text-md);
  color: var(--plum-deep);
  padding-bottom: var(--space-sm);
}

/* — Admin FAB (discreet, bottom-right) ——————————————————————————— */
.admin-fab {
  position: fixed;
  right: var(--space-lg);
  bottom: var(--space-lg);
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--faint);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  opacity: 0.72;
  transition: opacity var(--dur-short) var(--ease-out),
              box-shadow var(--dur-med) var(--ease-out),
              color var(--dur-short) var(--ease-out),
              transform var(--dur-med) var(--ease-out);
}
.admin-fab:hover {
  opacity: 1;
  color: var(--plum);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.admin-fab svg, .admin-fab img { width: 18px; height: 18px; }

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

/* — Responsive ————————————————————————————————————————————————— */
@media (max-width: 40rem) {
  .section { padding-block: var(--space-xl); }
  .hero::before { background-size: 132px, 24px, 18px; opacity: 0.42; }
  .kpi__value { font-size: var(--text-xl); }
  .admin-fab { right: var(--space-md); bottom: var(--space-md); }
}
