/* =====================================================================
   Matteo Menardi Ménego — Official Website v2.1.1
   Design system: Ladin palette · glassmorphism · wallpaper · theme pill
   ===================================================================== */

:root {
  --ladin-blue:  #87CEEB;
  --ladin-white: #FFFFFF;
  --ladin-green: #006A4E;
  --platinum:    #E5E4E2;
  --ease-out: cubic-bezier(.4, 0, .2, 1);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  background-color: #F4F6F7;
  color-scheme: light;
}
html.dark {
  background-color: #05080b;
  color-scheme: dark;
}

.font-sentient,
body {
  font-family: 'Sentient', ui-serif, Georgia, 'Times New Roman', serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  background-color: transparent !important;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Wallpaper — real <img>, every page; content glides on top */
.site-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #c9d6e2;
}
html.dark .site-bg { background: #0a1622; }
.site-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: opacity .45s ease;
}
.site-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0.08) 0%,
    rgba(255,255,255,0.05) 40%,
    rgba(255,255,255,0.14) 100%
  );
  transition: background .35s ease;
}
html.dark .site-bg::after {
  background: linear-gradient(180deg, rgba(4,7,11,.42) 0%, rgba(4,7,11,.34) 55%, rgba(4,7,11,.50) 100%);
}

body > nav,
body > main,
body > footer,
body > header {
  position: relative;
  z-index: 1;
}
body > nav { z-index: 50; }

/* Glassmorphism — iOS-inspired, deeper frost */
.glass {
  background: rgba(255, 255, 255, 0.42);
  -webkit-backdrop-filter: saturate(190%) blur(32px);
  backdrop-filter: saturate(190%) blur(32px);
  border: 1px solid rgba(0, 106, 78, 0.08);
  box-shadow:
    0 10px 30px -10px rgba(0, 0, 0, 0.12),
    0 4px 6px -4px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255,255,255,.45);
  transition: background .25s ease, border-color .25s ease, box-shadow .25s ease;
}
html.dark .glass {
  background: rgba(10, 14, 20, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow:
    0 10px 30px -10px rgba(0, 0, 0, 0.48),
    0 4px 6px -4px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255,255,255,.06);
}
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass { background: rgba(255,255,255,0.94); }
  html.dark .glass { background: rgba(12,18,24,0.96); }
}

.apple-rounded { border-radius: 1.75rem; }
.minimal-shadow {
  box-shadow: 0 10px 30px -12px rgba(0,0,0,.18), 0 4px 10px -6px rgba(0,0,0,.12);
}
html.dark .minimal-shadow {
  box-shadow: 0 16px 40px -14px rgba(0,0,0,.55), 0 6px 14px -8px rgba(0,0,0,.45);
}

.section-card,
.social-card {
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out);
}
.section-card:hover,
.social-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 48px -16px rgba(0,0,0,.26), 0 10px 18px -10px rgba(0,0,0,.18);
}
html.dark .section-card:hover,
html.dark .social-card:hover {
  box-shadow: 0 30px 60px -18px rgba(0,0,0,.65), 0 12px 22px -12px rgba(0,0,0,.5);
}

.content-justified {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Ménego italic — blue accent in dark mode only */
.monego-italic {
  font-style: italic;
  font-family: 'Sentient', ui-serif, Georgia, serif;
}
html.dark .monego-italic { color: var(--ladin-blue); }

/* Platinum quote */
.platinum-quote,
.quote-platinum {
  font-style: italic;
  color: #E5E4E2;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
html.dark .platinum-quote,
html.dark .quote-platinum {
  color: #f1f0eb;
  text-shadow: 0 1px 5px rgba(0,0,0,.65);
}
/* Light mode: platinum still readable on glass */
html:not(.dark) .quote-platinum {
  color: #8a8a88;
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
}

/* Platinum ring — profile + Lookup */
.platinum-ring {
  box-shadow:
    0 0 0 3px var(--platinum),
    0 0 0 6px rgba(229,228,226,.35),
    0 14px 26px -10px rgba(0,0,0,.35);
  transition: box-shadow .35s ease;
}
.platinum-ring:hover {
  box-shadow:
    0 0 0 3px #f1f0ee,
    0 0 0 7px rgba(229,228,226,.5),
    0 20px 32px -10px rgba(0,0,0,.4);
}

/* Nav */
.nav-link { position: relative; transition: color .2s ease; }
.nav-link:hover { color: var(--ladin-blue); }
html.dark .nav-link.active { color: var(--ladin-blue); }
html:not(.dark) .nav-link.active { color: var(--ladin-green); font-weight: 500; }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--ladin-blue), var(--ladin-green));
}

.nav-logo {
  display: block;
  height: 40px;
  width: auto;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 1px 5px rgba(0,0,0,.22);
  border: 1px solid rgba(0,0,0,.10);
  transition: transform .25s ease, box-shadow .25s ease, background .3s ease;
}
html.dark .nav-logo {
  background: #000000;
  border-color: rgba(255,255,255,.16);
}
a:hover > .nav-logo {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
}
@media (max-width: 380px) { .nav-logo { height: 34px; } }

/* Nav avatar — full body centred */
.nav-avatar {
  object-fit: cover;
  object-position: center center;
}

/* Hero profile — full body, centred, original resolution served */
.hero-profile,
.profile-hero {
  aspect-ratio: 3 / 4;
  width: 15rem;
  object-fit: cover;
  object-position: center center;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.4);
  transition: transform .4s var(--ease-out);
}
@media (min-width: 768px) {
  .hero-profile,
  .profile-hero { width: 17.5rem; }
}
.hero-profile:hover,
.profile-hero:hover { transform: scale(1.018); }

/* macOS-style theme pill: Sun left / Moon right; knob slides */
.theme-pill {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 0;
  display: inline-flex;
  align-items: center;
}
.pill-track {
  position: relative;
  display: inline-block;
  width: 64px;
  height: 32px;
  border-radius: 9999px;
  background: #dfe3e1;
  border: 1px solid rgba(0,106,78,.18);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.18);
  transition: background .3s ease, border-color .3s ease;
}
html.dark .pill-track {
  background: #2e3a44;
  border-color: rgba(255,255,255,.12);
}
.pill-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  background: #ffffff;
  z-index: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,.32), 0 1px 2px rgba(0,0,0,.2);
  transition: transform .32s var(--ease-out), background .3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
html.dark .pill-knob {
  transform: translateX(32px);
  background: #f6f7f9;
}
.pill-ic {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  pointer-events: none;
  transition: opacity .25s ease;
}
.pill-sun { opacity: 1; }
.pill-moon { opacity: 0; }
html.dark .pill-sun { opacity: 0; }
html.dark .pill-moon { opacity: 1; }

/* Ladin flag — horizontal tricolor 3:2 (wide like 🇦🇹 / 🇭🇺) */
.ladin-flag {
  width: 54px;
  height: 36px;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,.35);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease, box-shadow .25s ease;
}
.ladin-flag:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
}
html.dark .ladin-flag { border-color: rgba(255,255,255,.18); }
.ladin-flag > div { flex: 1; min-height: 0; }

.footer-logo {
  display: block;
  height: 56px;
  width: auto;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,.26);
  border: 1px solid rgba(0,0,0,.10);
  transition: transform .25s ease, box-shadow .25s ease, background .3s ease;
}
html.dark .footer-logo {
  background: #000000;
  border-color: rgba(255,255,255,.16);
}
a:hover > .footer-logo {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0,0,0,.32);
}

.footer-link {
  transition: color .2s ease, transform .2s ease;
  display: inline-flex;
  align-items: center;
}
.footer-link:hover {
  transform: translateY(-1px);
  color: var(--ladin-blue) !important;
}

/* Tables */
.elegant-table,
.milestone-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}
.elegant-table th,
.elegant-table td,
.milestone-table th,
.milestone-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid rgba(0,106,78,.14);
}
html.dark .elegant-table th,
html.dark .elegant-table td,
html.dark .milestone-table th,
html.dark .milestone-table td {
  border-bottom-color: rgba(255,255,255,.08);
}
.elegant-table tr:last-child td,
.milestone-table tr:last-child td { border-bottom: none; }
.elegant-table tbody tr:hover,
.milestone-table tbody tr:hover { background: rgba(0,106,78,.05); }
html.dark .elegant-table tbody tr:hover,
html.dark .milestone-table tbody tr:hover { background: rgba(255,255,255,.05); }
.milestone-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #006A4E;
}
html.dark .milestone-table th { color: #87CEEB; }

.story-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  transition: transform .3s ease, box-shadow .3s ease;
}
.story-image:hover {
  transform: scale(1.01);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.15);
}

.image-grid { display: grid; gap: 1rem; }
@media (min-width: 640px) {
  .image-grid-2 { grid-template-columns: repeat(2, 1fr); }
}

/* Magazine lead image between title and body */
.story-lead {
  width: 100%;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  border-radius: 1.25rem;
  box-shadow: 0 16px 40px -16px rgba(0,0,0,.35);
}

/* Squircle preview (Substack / external essay) */
.squircle-preview {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 22%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 6px 16px -6px rgba(0,0,0,.35);
  border: 1px solid rgba(229,228,226,.55);
}

.cv-list li { margin-bottom: 0.65rem; }
.cv-list li:last-child { margin-bottom: 0; }

.readable-on-wp {
  text-shadow: 0 1px 3px rgba(255,255,255,.85), 0 2px 8px rgba(255,255,255,.6), 0 4px 18px rgba(255,255,255,.35);
}
html.dark .readable-on-wp {
  text-shadow: 0 1px 2px rgba(0,0,0,.75), 0 3px 12px rgba(0,0,0,.65), 0 6px 24px rgba(0,0,0,.45);
}

/* Sloterdijk blockquote */
.essay-quote {
  border-left: 3px solid var(--ladin-blue);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  font-style: italic;
  opacity: 0.95;
}

#mobile-nav a { transition: background-color .15s ease; }

:focus-visible {
  outline: 2px solid var(--ladin-blue);
  outline-offset: 3px;
  border-radius: 6px;
}
.theme-pill:focus-visible .pill-track {
  outline: 2px solid var(--ladin-blue);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

@supports (padding: max(0px)) {
  nav > div {
    padding-left: max(1.5rem, env(safe-area-inset-left)) !important;
    padding-right: max(1.5rem, env(safe-area-inset-right)) !important;
  }
  footer {
    padding-bottom: max(2rem, env(safe-area-inset-bottom)) !important;
  }
}

@media print {
  .site-bg, nav, footer, .theme-pill, #mobile-menu-btn { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  .glass {
    background: #fff !important;
    border: 1px solid #ddd !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
  }
  a { color: #000 !important; text-decoration: underline; }
  .quote-platinum { color: #333 !important; text-shadow: none !important; }
}


/* Accessibility: skip link / screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.sr-only:focus,
.focus\:not-sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}
