/* =====================================================
   base.css — Regole condivise da tutte le pagine
   jabbah project — palette "Blu / Ardesia"
   ===================================================== */

/* =====================================================
   1. TOKEN / CUSTOM PROPERTIES
   ===================================================== */
:root {
  /* ---- scala fredda (blu / ardesia) ---- */
  --c-porcelain: #f4f6f8;
  --c-cloud:     #e8edf3;
  --c-mist:      #d8e0ea;
  --c-powder:    #c2cedd;
  --c-haze:      #a7b6cb;
  --c-stone:     #8595b0;
  --c-slate:     #5d6b80;
  --c-harbor:    #45577a;
  --c-indigo:    #2c4a7c;
  --c-deep:      #243c63;
  --c-ink:       #1e2533;
  --c-ink2:      #141922;

  /* ---- accenti caldi (terracotta / ambra) ---- */
  --w-cream:     #fefaf0;
  --w-sand:      #fbedcf;
  --w-wheat:     #f6d79a;
  --w-honey:     #eeb84e;
  --w-amber:     #d4860a;
  --w-rust:      #c8631b;
  --w-terra:     #c23b2a;
  --w-brick:     #9f2c20;
  --w-oxblood:   #6e2017;

  /* ---- ruoli semantici ---- */
  --bg:          var(--c-porcelain);
  --paper-warm:  var(--w-cream);
  --paper-cool:  var(--c-cloud);
  --surface:     #ffffff;

  --ink:         var(--c-ink);
  --ink-deep:    var(--c-ink2);

  --text:        var(--c-ink);
  --text-soft:   var(--c-harbor);
  --text-mute:   var(--c-slate);
  --text-faint:  var(--c-stone);

  --rule:        var(--c-mist);
  --rule-soft:   #e4eaf1;
  --rule-warm:   #ece3cf;
  --rule-ink:    rgba(197, 210, 228, 0.18);

  --link:        var(--w-terra);
  --link-hover:  var(--w-brick);
  --accent:      var(--w-terra);
  --accent-amber:var(--w-amber);
  --indigo:      var(--c-indigo);

  /* ---- compat con vecchie pagine (haumea.html) ---- */
  --white:        #ffffff;
  --bg-light:     var(--c-porcelain);
  --box-theory:   var(--w-cream);
  --box-practice: #f4f6f8;
  --box-quote:    var(--w-cream);
  --box-editorial:#f8f5ee;
  --accent-red:   var(--w-terra);
  --accent-yellow:var(--w-amber);
  --accent-blue:  var(--c-indigo);
  --blue-grey:    var(--c-slate);
  --text-dark:    var(--c-ink);
  --text-medium:  var(--c-harbor);
  --footer-bg:    var(--c-ink2);
  --footer-text:  #c8cdd8;
  --border-thin:  var(--c-mist);

  /* ---- misure ---- */
  --shell: 1240px;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
}

/* =====================================================
   2. RESET & BASE
   ===================================================== */
*,*::before,*::after { box-sizing: border-box; }

html {
  font-size: 17px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans', system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.no-scroll { overflow: hidden; }

img, svg { display: block; max-width: 100%; height: auto; }

::selection { background: var(--w-terra); color: var(--w-cream); }

/* link di default: rosso terracotta, senza sottolineatura */
a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.18s ease;
}
a:hover { color: var(--link-hover); }
a:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 3px;
  border-radius: 2px;
}

/* =====================================================
   3. ELEMENTI TIPOGRAFICI CONDIVISI
   ===================================================== */
.serif { font-family: 'Newsreader', Georgia, serif; }
.sans  { font-family: 'Noto Sans', system-ui, sans-serif; }

/* occhiello / eyebrow */
.eyebrow {
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
}
.eyebrow--accent { color: var(--w-terra); }
.eyebrow__num {
  font-variant-numeric: tabular-nums;
  color: var(--w-amber);
  font-weight: 700;
}

/* riga sottile decorativa */
.rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 0;
}

/* =====================================================
   4. TOP BAR (sticky) + HAMBURGER
   ===================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background-color: var(--c-haze);
}

.top-bar {
  background: rgba(244, 246, 248, 0.86);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}

.top-bar__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand__mark { height: 30px; width: auto; }
.brand__word {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.18rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
}
.brand__word em {
  font-style: italic;
  color: var(--text-mute);
  font-weight: 400;
}

.top-bar__right {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

/* CTA discreta nella barra */
.bar-cta {
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
.bar-cta::after {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--w-terra);
}
.bar-cta:hover { color: var(--w-terra); }

/* hamburger */
.menu-toggle {
  appearance: none;
  border: none;
  background: none;
  cursor: pointer;
  width: 30px; height: 30px;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.menu-toggle span {
  display: block;
  height: 1.5px;
  width: 26px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.28s ease, opacity 0.2s ease;
}
body.menu-open .menu-toggle span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
body.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
body.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* =====================================================
   5. OVERLAY MENU
   ===================================================== */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--c-ink);
  color: var(--c-powder);
  display: grid;
  grid-template-rows: 64px 1fr auto;
  opacity: 0;
  visibility: hidden;
  overflow-y: auto;
  transition: opacity 0.32s ease, visibility 0.32s;
}
body.menu-open .nav-overlay { opacity: 1; visibility: visible; }

.nav-overlay__bg {
  position: absolute;
  right: -6%;
  top: 50%;
  transform: translateY(-50%);
  width: min(58vh, 560px);
  opacity: 0.16;
  pointer-events: none;
}
.nav-overlay__inner {
  max-width: var(--shell);
  width: 100%;
  margin: 0 auto;
  padding: 2rem var(--gutter);
  align-self: center;
  position: relative;
  z-index: 1;
}

/* ---- prima parte: le 4 voci principali + rimando alla homepage ---- */
.nav-primary {
  display: flex;
  align-items: flex-end;
  gap: 2rem;
}
.nav-menu {
  list-style: none;
  margin: 0; padding: 0;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  border-right: 1px solid var(--rule-ink);
}
.nav-menu li {
  border-bottom: 1px solid var(--rule-ink);
}
.nav-menu a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.65rem 0;
  font-family: 'Newsreader', Georgia, serif;
  font-size: clamp(1.15rem, 2.8vw, 1.7rem);
  font-weight: 400;
  color: var(--c-cloud);
  line-height: 1.1;
}
.nav-menu a:hover { color: var(--w-cream); }
.nav-menu a:hover .nav-menu__num { color: var(--w-honey); }
.nav-menu__num {
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--c-slate);
  transform: translateY(-0.3em);
  font-variant-numeric: tabular-nums;
}
/* rimando alla homepage: allineato in basso, in corrispondenza dell'ultima voce */
.nav-primary__home {
  flex: 0 0 auto;
  padding-bottom: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-haze);
  white-space: nowrap;
}
.nav-primary__home:hover { color: var(--w-honey); }
.nav-primary__home .arr { transition: transform 0.2s ease; }
.nav-primary__home:hover .arr { transform: translateX(4px); }

/* ---- seconda parte: link diretti alle pagine interne ---- */
.nav-pages {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 1.3rem 0 0;
  border-top: 1px solid var(--rule-ink);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.8rem;
}
.nav-pages a {
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
  color: var(--c-cloud);
}
.nav-pages a:hover { color: var(--w-honey); }
.nav-overlay__foot {
  max-width: var(--shell);
  width: 100%;
  margin: 0 auto;
  padding: 1.4rem var(--gutter) 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.6rem;
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.8rem;
  color: var(--c-slate);
  position: relative;
  z-index: 1;
}
.nav-overlay__foot a { color: var(--c-haze); }
.nav-overlay__foot a:hover { color: var(--w-honey); }

/* =====================================================
   6. FOOTER
   ===================================================== */
.site-footer {
  background: var(--c-ink2);
  color: var(--footer-text);
  position: relative;
  overflow: hidden;
}
.site-footer__bg {
  position: absolute;
  right: -8%;
  bottom: -30%;
  width: min(60vw, 540px);
  opacity: 0.1;
  pointer-events: none;
}
.footer__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5rem) var(--gutter) 2.5rem;
  position: relative;
  z-index: 1;
}
.footer__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule-ink);
}
.footer__brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.footer__brand img { height: 34px; filter: brightness(0) invert(1); }
.footer__brand .brand__word { color: var(--c-cloud); }
.footer__tag {
  font-family: 'Newsreader', Georgia, serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--c-haze);
  max-width: 30ch;
  margin: 0;
}
.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.8rem;
  list-style: none;
  margin: 2rem 0;
  padding: 0;
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.85rem;
}
.footer__links a { color: var(--footer-text); }
.footer__links a:hover { color: var(--w-honey); }
.footer__copyright {
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.8rem;
  color: rgba(200, 205, 216, 0.5);
  margin: 0;
}

/* =====================================================
   7. ANIMAZIONI (solo entrata, una tantum)
   ===================================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* =====================================================
   8. RESPONSIVE comune
   ===================================================== */
@media (max-width: 720px) {
  .top-bar__inner { height: 58px; }
  .bar-cta { display: none; }
  .brand__mark { height: 26px; }
  .brand__word { font-size: 1.05rem; }
}
