/* Italia in Primo Piano: Mini App styles */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/fraunces-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/fraunces-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('../fonts/inter-normal.woff2') format('woff2');
}

:root {
  --page-bg: #FAF8F3;
  --ink: #1D1B24;

  --fin-band: #0C5C66;
  --fin-accent: #F2D7A0;
  --eco-band: #C4552B;
  --eco-accent: #FFE9D6;
  --tec-band: #3E2A8C;
  --tec-accent: #D9CEFF;

  --topbar-h: 56px;
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

  --active-band: var(--fin-band);
  --active-accent: var(--fin-accent);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
}

body {
  padding-top: var(--topbar-h);
  transition: background-color var(--duration-normal) var(--ease-out-expo);
}

body.scroll-locked {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ---------- Top bar ---------- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--page-bg);
  border-bottom: 1px solid rgba(29, 27, 36, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.topbar__logo {
  height: 32px;
  width: auto;
  display: block;
}

.topbar__dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.topbar__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: transform var(--duration-normal) var(--ease-out-expo), opacity var(--duration-normal);
  opacity: 0.45;
}

.topbar__dot[data-section="finanza"] { background: var(--fin-band); }
.topbar__dot[data-section="economia"] { background: var(--eco-band); }
.topbar__dot[data-section="tecnologia"] { background: var(--tec-band); }

.topbar__dot.is-active {
  opacity: 1;
  transform: scale(1.5);
}

.topbar__progress {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--active-accent);
  z-index: 100;
  transition: width 80ms linear, background-color var(--duration-normal) var(--ease-out-expo);
}

/* ---------- Intro line ---------- */

.intro {
  padding: 22px 16px 6px;
  text-align: center;
}

.intro__text {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 15px;
  color: #7a7568;
}

/* ---------- Section band ---------- */

.band {
  padding: 36px 0 44px;
  transition: background-color var(--duration-normal) var(--ease-out-expo);
}

.band[data-section="finanza"] { background: var(--fin-band); }
.band[data-section="economia"] { background: var(--eco-band); }
.band[data-section="tecnologia"] { background: var(--tec-band); }

.band__header {
  padding: 0 16px 28px;
}

.band__eyebrow {
  display: block;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 6px;
}

.band[data-section="finanza"] .band__eyebrow { color: var(--fin-accent); }
.band[data-section="economia"] .band__eyebrow { color: var(--eco-accent); }
.band[data-section="tecnologia"] .band__eyebrow { color: var(--tec-accent); }

.band__title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: clamp(2.6rem, 14vw, 3.6rem);
  line-height: 0.98;
  margin: 0;
}

.band[data-section="finanza"] .band__title { color: var(--fin-accent); }
.band[data-section="economia"] .band__title { color: var(--eco-accent); }
.band[data-section="tecnologia"] .band__title { color: var(--tec-accent); }

.band__cards {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 0 16px;
}

/* ---------- Story card ---------- */

.card {
  background: #FFFDF8;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 10px 28px rgba(0,0,0,0.14);
  cursor: pointer;
  transform: translateY(0) scale(1);
  transition: transform var(--duration-fast) var(--ease-out-expo), box-shadow var(--duration-fast) var(--ease-out-expo);
  border: none;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  padding: 0;
  display: block;
}

.card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.12);
}

.card__media {
  position: relative;
  width: 100%;
  background: #e8e3d6;
  overflow: hidden;
}

[data-section="finanza"] .card__media { aspect-ratio: 4 / 5; }
[data-section="economia"] .card__media { aspect-ratio: 1 / 1; }
[data-section="tecnologia"] .card__media { aspect-ratio: 3 / 2; }

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  opacity: 0;
  transition: opacity 420ms var(--ease-out-expo);
}

.card__img.is-loaded { opacity: 1; }

.card__body {
  padding: 18px 18px 20px;
}

.card__chip {
  display: inline-block;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 13px;
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 10px;
  color: #FFFDF8;
}

.band[data-section="finanza"] .card__chip { background: var(--fin-band); }
.band[data-section="economia"] .card__chip { background: var(--eco-band); }
.band[data-section="tecnologia"] .card__chip { background: var(--tec-band); }

.card__headline {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 22px;
  line-height: 1.18;
  margin: 0 0 10px;
}

.card__preview {
  font-size: 15px;
  line-height: 1.55;
  color: #4a4740;
  margin: 0 0 12px;
}

.card__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 14px;
}

.band[data-section="finanza"] .card__link { color: var(--fin-band); }
.band[data-section="economia"] .card__link { color: var(--eco-band); }
.band[data-section="tecnologia"] .card__link { color: var(--tec-band); }

/* ---------- Footer ---------- */

.footer {
  padding: 44px 20px 40px;
  text-align: center;
  background: var(--page-bg);
}

.footer__logo {
  height: 26px;
  margin: 0 auto 14px;
}

.footer__tagline {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 16px;
  color: #4a4740;
  margin: 0 0 10px;
}

.footer__email {
  font-size: 13px;
  color: #8a8578;
}

/* ---------- Overlay ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: #FFFDF8;
  z-index: 200;
  transform: translateY(100%);
  transition: transform var(--duration-normal) var(--ease-out-expo);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.overlay.is-open {
  transform: translateY(0);
}

.overlay__close {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(29,27,36,0.55);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  z-index: 210;
  cursor: pointer;
}

.overlay__hero-wrap {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #e8e3d6;
  overflow: hidden;
}

.overlay__hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  opacity: 0;
  transition: opacity 420ms var(--ease-out-expo);
}

.overlay__hero.is-loaded { opacity: 1; }

.overlay__content {
  padding: 22px 20px 60px;
  max-width: 640px;
  margin: 0 auto;
}

.overlay__pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  color: #FFFDF8;
  margin-bottom: 16px;
}

.overlay__pill[data-section="finanza"] { background: var(--fin-band); }
.overlay__pill[data-section="economia"] { background: var(--eco-band); }
.overlay__pill[data-section="tecnologia"] { background: var(--tec-band); }

.overlay__headline {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 30px;
  line-height: 1.12;
  margin: 0 0 12px;
}

.overlay__meta {
  font-size: 13px;
  color: #8a8578;
  margin: 0 0 22px;
}

.overlay__body p {
  font-size: 16px;
  line-height: 1.68;
  color: #2a2820;
  margin: 0 0 18px;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Small screens safety ---------- */

@media (max-width: 360px) {
  .band__title { font-size: clamp(2.1rem, 15vw, 2.6rem); }
  .card__headline { font-size: 20px; }
}
