/* Public site (decision 96): «Cielo calmo» + calendar grid. One sheet, two themes. */
@font-face { font-family: Figtree; src: url(fonts/Figtree-Regular.ttf) format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Figtree; src: url(fonts/Figtree-Medium.ttf) format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: Figtree; src: url(fonts/Figtree-SemiBold.ttf) format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: Figtree; src: url(fonts/Figtree-Bold.ttf) format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --sky: #7ec4e8; --blue: #3e93c8; --deep: #1f7aa3;
  --bg: #f7fbff; --surface: #ffffff; --ink: #12344d; --ink-2: #46677f; --ink-3: #52718a;
  --line: rgba(31, 122, 163, 0.08); --border: #d6e8f5;
  --glass: rgba(255, 255, 255, 0.72); --card: rgba(255, 255, 255, 0.82);
  --cell-sky: rgba(126, 196, 232, 0.28); --cell-today: rgba(255, 206, 133, 0.34);
  --glow-a: rgba(159, 214, 242, 0.9); --glow-b: rgba(201, 232, 248, 0.9);
  --btn: var(--deep); --btn-ink: #fff; --btn-shadow: 0 8px 24px rgba(31, 122, 163, 0.32);
  --accent: var(--deep); --error: #ba1a1a; --error-soft: #ffdad6;
  --cell: 56px; --radius: 22px; --max: 1160px;
  --font: Figtree, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --phone-border: transparent; --phone-glow: rgba(126, 196, 232, 0.55);
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #08141d; --surface: #0d1c27; --ink: #e6f3fb; --ink-2: #9dbccf; --ink-3: #7b98ab;
  --line: rgba(126, 196, 232, 0.08); --border: rgba(126, 196, 232, 0.2);
  --glass: rgba(8, 20, 29, 0.7); --card: rgba(13, 28, 39, 0.82);
  --cell-sky: rgba(126, 196, 232, 0.16); --cell-today: rgba(255, 206, 133, 0.18);
  --glow-a: rgba(126, 196, 232, 0.45); --glow-b: rgba(62, 147, 200, 0.4);
  --btn: var(--sky); --btn-ink: #06202f; --btn-shadow: 0 0 28px rgba(126, 196, 232, 0.4);
  --accent: var(--sky); --error: #ffb4ab; --error-soft: #93000a;
  --phone-border: var(--border); --phone-glow: transparent;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 0.5em; font-weight: 700; }
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: 1.35rem; letter-spacing: -0.02em; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font: 600 0.78rem/1 var(--mono); letter-spacing: 0.08em; color: var(--accent); }
.eyebrow, .chip { font: 600 0.95rem/1.2 var(--font); color: var(--accent); }
.lead { font-size: 1.2rem; color: var(--ink-2); max-width: 34rem; }
.muted { color: var(--ink-3); font-size: 0.95rem; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 8px; }

/* calendar grid: every section with .cal-host carries a .cal-bg layer */
.cal-host { position: relative; isolation: isolate; overflow: clip; }
.cal-bg {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
}
.cell { position: absolute; width: calc(var(--cell) - 1px); height: calc(var(--cell) - 1px); margin: 1px 0 0 1px; border-radius: 4px; background: var(--cell-sky); opacity: 0; animation: cell 12s ease-in-out infinite; }
.cell.today { background: var(--cell-today); }
.cell.due::after { content: ''; position: absolute; right: 8px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
@keyframes cell { 0%, 100% { opacity: 0; } 20%, 60% { opacity: 1; } }
.glow::before {
  content: ''; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background: radial-gradient(circle at 95% 0%, var(--glow-a), transparent 42%), radial-gradient(circle at 0% 100%, var(--glow-b), transparent 38%);
}

/* header */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.site-nav { display: flex; gap: 20px; margin-right: auto; }
.site-nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; }
.site-nav a:hover { color: var(--ink); }
.lang { font: 600 0.9rem var(--font); color: var(--ink-3); }
.lang a { color: var(--ink-3); text-decoration: none; } .lang strong { color: var(--ink); }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--ink); cursor: pointer; font-size: 1.1rem; }
.icon-btn .sun, [data-theme='dark'] .icon-btn .moon { display: none; } [data-theme='dark'] .icon-btn .sun { display: inline; }
.menu-btn, .nav-lang { display: none; }

/* buttons */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 18px; }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 26px; border-radius: 999px; font: 700 1rem var(--font); cursor: pointer; text-decoration: none; border: 1px solid transparent; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--btn); color: var(--btn-ink); box-shadow: var(--btn-shadow); }
.btn.ghost { background: var(--card); color: var(--accent); border-color: var(--border); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 0.92rem; }

/* hero */
.hero { padding: 88px 0 72px; }
.hero .wrap { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 48px; align-items: center; }
.chip { display: inline-block; padding: 7px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--border); }
.hero-note { color: var(--ink-3); font-size: 0.95rem; }

/* phone frame (CSS, so it follows the theme) */
.phone { position: relative; width: min(100%, 320px); margin: 0 auto; padding: 12px; border-radius: 44px; background: var(--card); border: 1px solid var(--phone-border); box-shadow: 0 0 0 3px var(--phone-glow), 0 30px 60px -20px rgba(31, 122, 163, 0.35); }
.phone img { width: 100%; height: auto; aspect-ratio: 390 / 844; object-fit: cover; border-radius: 32px; background: var(--surface); }

/* beta dialog */
dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--ink); width: min(92vw, 420px); box-shadow: 0 30px 80px rgba(8, 20, 29, 0.35); }
dialog::backdrop { background: rgba(8, 20, 29, 0.45); backdrop-filter: blur(4px); }
dialog > form, dialog > article { position: relative; padding: 28px; }
dialog input[type='password'] { width: 100%; min-height: 50px; margin: 14px 0; padding: 0 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--ink); font: 500 1rem var(--font); text-align: center; }
dialog .btn { width: 100%; justify-content: center; }
.link-btn { display: block; margin: 12px auto 0; background: none; border: 0; color: var(--accent); font: 600 0.95rem var(--font); cursor: pointer; text-decoration: underline; }
.close { position: absolute; top: 12px; right: 12px; }
.notice { padding: 10px 14px; border-radius: 12px; font-size: 0.93rem; background: var(--card); border: 1px solid var(--border); }
.notice.error { background: var(--error-soft); color: var(--error); border-color: transparent; }

/* «Scrivici» contact form */
.contact form { margin-top: 28px; padding: 28px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.contact fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.contact legend { font-weight: 600; margin: 0 0 4px; padding: 0; }
.contact fieldset label { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); font-size: 0.95rem; cursor: pointer; }
.contact fieldset label:has(:checked) { background: var(--cell-sky); border-color: var(--accent); }
.contact fieldset input[type='radio'] { accent-color: var(--accent); }
.contact label:not(fieldset label) { font-weight: 600; }
.contact textarea, .contact input[type='email'] { width: 100%; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--ink); font: 500 1rem var(--font); }
.contact textarea { resize: vertical; }
.contact .btn { align-self: flex-start; }
.contact input[type='email'] + .muted { margin: -6px 0 0; font-size: 0.88rem; } /* the hint belongs to the field above */

/* closing + footer */
.closing { padding: 96px 0; text-align: center; }
.closing .cal-bg { -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 60%, transparent); mask-image: linear-gradient(transparent, #000 30%, #000 60%, transparent); }
.closing .actions { justify-content: center; }
.site-footer { border-top: 1px solid var(--border); padding: 28px 0 40px; color: var(--ink-3); font-size: 0.92rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.site-footer a { color: var(--ink-3); }

@media (max-width: 959px) {
  .hero { padding: 56px 0 48px; }
  .hero .wrap { grid-template-columns: 1fr; }
}
@media (max-width: 719px) {
  .site-header .wrap { gap: 12px; } .brand { margin-right: auto; }
  .lang { display: none; } .menu-btn { display: inline-block; }
  .site-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0; padding: 4px 24px 12px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: 0 18px 30px -24px rgba(8, 20, 29, 0.4); }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px 0; font-size: 1.05rem; } .site-nav .nav-lang { display: block; border-top: 1px solid var(--border); margin-top: 4px; }
  body { font-size: 16px; }
}
@media (max-width: 599px) {
  .actions .btn { flex: 1 1 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cell { animation: none; opacity: 0.7; }
  *, *::before, *::after { transition: none !important; }
}

/* Part 1 — story with a sticky phone */
.story { padding: 96px 0; }
.story-grid { display: grid; grid-template-columns: 1fr 360px; gap: 64px; margin-top: 40px; }
.chapters { list-style: none; margin: 0; padding: 0 0 0 28px; border-left: 2px solid var(--border); }
.chapter { position: relative; min-height: 60vh; padding: 12px 0 48px; transition: opacity 0.3s ease; }
/* dimming is opt-in: only story-live (IntersectionObserver ran) tells inactive
   chapters apart from the active one; without JS every chapter stays visible */
.story-live .chapter { opacity: 0.45; }
.story-live .chapter.active { opacity: 1; }
.chapter::before { content: ''; position: absolute; left: -35px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--border); }
.chapter.active::before { background: var(--blue); box-shadow: 0 0 0 6px var(--cell-sky); }
.chapter p { color: var(--ink-2); max-width: 32rem; }
.art { margin: 20px 0 0; max-width: 360px; padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--border); }
.art svg { width: 100%; height: auto; font-family: var(--font); }
.flow { animation: flow 3s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -26; } }
.m-shot { display: none; }
.stage { position: sticky; top: 96px; align-self: start; }
.stage img { transition: opacity 0.25s ease; }
@media (max-width: 959px) {
  .story-grid { grid-template-columns: 1fr; }
  .stage { display: none; }
  /* the phone sits beside the text at a third of the width; where a drawing already tells the story, it stays out */
  .chapter { min-height: 0; display: grid; grid-template-columns: 1fr minmax(120px, 34%); column-gap: 16px; }
  .chapter > :not(.m-shot) { grid-column: 1; }
  .story-live .chapter { opacity: 1; }
  .m-shot { display: block; grid-column: 2; grid-row: 1 / span 3; align-self: start; width: 100%; margin: 6px 0 0; padding: 6px; border-radius: 22px; }
  .m-shot img { border-radius: 16px; }
  .chapter:has(.art) .m-shot { display: none; }
}
@media (prefers-reduced-motion: reduce) { .flow { animation: none; } .story-live .chapter { opacity: 1; } }

/* Part 2 — bento */
.more { padding: 96px 0; }
.bento { list-style: none; margin: 40px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 200px; grid-auto-flow: dense; gap: 16px; }
.tile.w2 { grid-column: span 2; } .tile.h2 { grid-row: span 2; } .tile.w4 { grid-column: span 4; }
.tile button { position: relative; width: 100%; height: 100%; padding: 22px; text-align: left; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.tile button:hover { transform: translateY(-3px); box-shadow: 0 20px 40px -24px rgba(31, 122, 163, 0.5); }
.tile-title { display: block; margin: 0 0 4px; font-weight: 700; font-size: 1.35rem; line-height: 1.08; letter-spacing: -0.02em; }
.tile-sub { display: block; margin: 0; color: var(--ink-2); font-size: 0.95rem; }
.tile-anim { position: absolute; top: 20px; right: 20px; display: flex; gap: 6px; }
.tile-title, .tile-sub { position: relative; }
.tile-shot { position: absolute; top: 24px; right: 28px; width: min(200px, 38%); height: auto; border-radius: 20px 20px 0 0; border: 1px solid var(--border); border-bottom: 0; box-shadow: 0 18px 40px -24px rgba(31, 122, 163, 0.5); transition: transform 0.3s ease; }
.tile button:hover .tile-shot { transform: translateY(-6px); }
/* the text stops 16px before the shot (right 28px, min(200px, 38%) of the button) */
.tile:has(.tile-shot) .tile-title, .tile:has(.tile-shot) .tile-sub { max-width: max(calc(100% - 222px), calc(62% - 39px)); }
/* tall tiles: the shot on top, faded out before the title */
.tile.h2 .tile-shot { right: auto; left: 50%; translate: -50% 0; width: min(200px, 80%); -webkit-mask-image: linear-gradient(#000 40%, transparent 62%); mask-image: linear-gradient(#000 40%, transparent 62%); }
.tile.h2 .tile-title, .tile.h2 .tile-sub { max-width: none; }
/* the full-width tile: a landscape browser shot on the right, clipped by the tile */
.tile-shot.wide { width: min(560px, 52%); border-radius: 14px 14px 0 0; }
.tile.w4 .tile-title, .tile.w4 .tile-sub { max-width: 44%; }
.tile-art { position: absolute; top: 14px; right: 14px; width: 150px; height: auto; }
.tile-anim i { display: block; }
.a-garanzie i, .a-costi i { width: 48px; height: 56px; border-radius: 14px 14px 24px 24px; background: linear-gradient(115deg, var(--sky) 40%, #fff 50%, var(--sky) 60%); background-size: 300% 100%; animation: shine 3.5s linear infinite; }
.a-costi i { border-radius: 50%; width: 44px; height: 44px; }
.a-garanzie i, .a-costi i { display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 1.35rem; color: #fff; }
.a-trasferimento { width: 90px; height: 4px; background: var(--border); border-radius: 2px; } .a-trasferimento i { width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: var(--blue); animation: travel 2.2s ease-in-out infinite; }
@keyframes scan { from { transform: translateY(0); } to { transform: translateY(45px); } }
@keyframes shine { to { background-position: -300% 0; } }
@keyframes travel { from { transform: translateX(0); } to { transform: translateX(78px); } }
.scan { animation: scan 2.4s ease-in-out infinite alternate; }
#panel { width: min(94vw, 760px); }
/* title on top across both columns, then the image with its text beside it */
.panel-body { display: grid; grid-template-columns: 260px 1fr; gap: 20px 28px; align-items: center; }
.panel-body h3 { order: -1; grid-column: 1 / -1; margin: 0; padding-right: 44px; }
.panel-body .phone { width: 100%; } .panel-body .art { margin: 0; }
.panel-body:has(.wide) { grid-template-columns: 1fr; } .panel-body .wide { margin: 0; } .panel-body .wide img { width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--border); }
dialog:has(.wide) { width: min(92vw, 760px); }
.panel-body p { margin: 0; color: var(--ink-2); }

/* privacy band + FAQ */
.privacy { padding: 72px 0; background: var(--surface); border-block: 1px solid var(--border); }
.promises { list-style: none; margin: 24px 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.promises span { font-size: 1.8rem; } .promises h3 { margin: 10px 0 6px; font-size: 1.1rem; } .promises p { margin: 0; color: var(--ink-2); font-size: 0.95rem; }
/* FAQ and «Scrivici» side by side: both are where a doubt goes */
.help { padding: 96px 0 24px; } .help .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start; }
.faq details { border: 1px solid var(--border); border-radius: 16px; background: var(--card); margin: 0 0 12px; padding: 0 20px; }
.faq summary { cursor: pointer; padding: 18px 0; font-weight: 600; font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; flex: none; font-size: 1.5rem; line-height: 1; color: var(--accent); transition: transform 0.2s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 18px; color: var(--ink-2); }

@media (max-width: 959px) {
  .help .wrap { grid-template-columns: 1fr; gap: 72px; }
  .bento { grid-template-columns: repeat(2, 1fr); } .tile.w4 { grid-column: span 2; }
  .promises { grid-template-columns: repeat(2, 1fr); }
  .panel-body { grid-template-columns: minmax(110px, 32%) 1fr; gap: 14px 16px; align-items: start; } .panel-body p { font-size: 0.95rem; }
}
@media (max-width: 599px) {
  .bento { grid-template-columns: 1fr; grid-auto-rows: 170px; }
  .tile.w2, .tile.h2, .tile.w4 { grid-column: auto; grid-row: auto; }
  .tile .tile-shot, .tile.h2 .tile-shot { left: auto; right: 18px; top: 20px; translate: none; width: 110px; -webkit-mask-image: none; mask-image: none; }
  .tile:has(.tile-shot) .tile-title, .tile:has(.tile-shot) .tile-sub, .tile.h2 .tile-title, .tile.h2 .tile-sub { max-width: calc(100% - 124px); }
  .tile.w4 .tile-shot { width: 46%; } .tile.w4 .tile-title, .tile.w4 .tile-sub { max-width: calc(54% - 16px); }
  .tile-art { width: 120px; }
  .promises { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .tile-anim i, .scan { animation: none !important; } }
