/* ==========================================================================
   KHair — Styles
   Production-ready CSS for one-page presentation site.
   Color Palette:
     --bg-primary:   #252122
     --bg-alt:       #2C2829
     --surface:      #4B4748
     --text:         #DCD6C4
     --accent:       #A39262
   ========================================================================== */

/* ---------- CSS Custom Properties (Dark — default) ---------- */
:root {
  --bg-primary: #252122;
  --bg-alt: #2C2829;
  --surface: #4B4748;
  --text: #DCD6C4;
  --text-muted: #b0aa9a;
  --accent: #A39262;
  --accent-hover: #b8a874;
  --white: #f5f2ec;
  --radius: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
  --max-width: 1200px;
  --header-h: 64px;
  --announce-h: 40px;
}

/* ---------- Light Mode Override ---------- */
@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #DCD6C4;
    --bg-alt: #cec8b6;
    --surface: #b8b2a0;
    --text: #252122;
    --text-muted: #4B4748;
    --white: #252122;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  }
}

/* ---------- Google Font (single, display=swap) ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--announce-h) + 16px);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover,
a:focus-visible {
  color: var(--accent-hover);
}

ul {
  list-style: none;
}

/* ---------- Focus States ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Skip Link ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 10000;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: 600;
  border-radius: var(--radius);
  transition: top var(--transition);
}

.skip-link:focus {
  top: 8px;
}

/* ---------- Container ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

.btn--primary {
  background: var(--accent);
  color: var(--bg-primary);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--accent-hover);
  color: var(--bg-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(163, 146, 98, 0.35);
}

.btn--accent {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn--accent:hover,
.btn--accent:focus-visible {
  background: var(--accent);
  color: var(--bg-primary);
}

.btn--large {
  padding: 1rem 2.5rem;
  font-size: 1.125rem;
}

.btn--small {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

/* ======================== ANNOUNCEMENT BAR ======================== */
.announcement-bar {
  background: var(--accent);
  color: var(--bg-primary);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  height: var(--announce-h);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1001;
}

.announcement-bar__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.announcement-bar__inner p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.announcement-bar__link {
  color: var(--bg-primary);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.announcement-bar__link:hover,
.announcement-bar__link:focus-visible {
  color: var(--white);
}

/* ======================== HEADER / NAVBAR ======================== */
.site-header {
  position: sticky;
  top: var(--announce-h);
  z-index: 1000;
  background: rgba(37, 33, 34, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(163, 146, 98, 0.12);
  transition: background var(--transition), box-shadow var(--transition);
}

@media (prefers-color-scheme: light) {
  .site-header {
    background: rgba(220, 214, 196, 0.95);
  }
}

.site-header.scrolled {
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.site-header__inner {
  display: flex;
  align-items: center;
  /* Keep space-between for basic layout, but we will center the nav via auto margins if needed or just use flex logic */
  justify-content: space-between;
  height: var(--header-h);
}

/* Logo */
.site-header__logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.logo-mark {
  /* Dimensions controlled by img attributes but safe fallback here */
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* Desktop Nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  /* Centering logic: In a flex container with "Logo - Nav - (Empty Right side logic? or just Nav)" */
  /* If we want strict centering relative to viewport, we need absolute positioning or grid. 
     For now, we will push it to the right or center. Space-between with only 2 items pushes Nav to right. 
     To center it, we can use margin-left: auto; margin-right: auto; but Logo is on left. 
     Reference structure usually has nav in middle. 
     Let's try flex-grow on nav or margin adjustments.
  */
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 900px) {
  .site-nav {
    display: none;
  }
}

.site-nav__list {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-nav__link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  padding: 0.25rem 0;
  transition: color var(--transition);
}

.site-nav__link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition);
}

.site-nav__link:hover,
.site-nav__link:focus-visible,
.site-nav__link.active {
  color: var(--accent);
}

.site-nav__link:hover::after,
.site-nav__link:focus-visible::after,
.site-nav__link.active::after {
  width: 100%;
}

/* Highlighted Nav Item (Portale Kosmail) */
.nav-item--highlight {
  border: 1px solid var(--accent);
  padding: 0.35rem 1rem;
  border-radius: var(--radius);
  color: var(--accent);
  font-weight: 600;
  transition: all var(--transition);
}

.nav-item--highlight::after {
  display: none;
  /* No underline for button-like item */
}

.nav-item--highlight:hover,
.nav-item--highlight:focus-visible {
  background: var(--accent);
  color: var(--bg-primary);
}


/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1010;
}

@media (max-width: 900px) {
  .hamburger {
    display: flex;
  }
}

.hamburger__line {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
  transform-origin: center;
}

.hamburger[aria-expanded="true"] .hamburger__line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger[aria-expanded="true"] .hamburger__line:nth-child(2) {
  opacity: 0;
}

.hamburger[aria-expanded="true"] .hamburger__line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  top: calc(var(--announce-h) + var(--header-h));
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.mobile-menu[hidden] {
  display: flex;
  /* override hidden so transitions work */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-menu__list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  margin-bottom: 2rem;
}

.mobile-menu__link {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  transition: color var(--transition);
}

.mobile-menu__link:hover,
.mobile-menu__link:focus-visible {
  color: var(--accent);
}

/* Make highlighted item prominent in mobile too */
.mobile-menu__link.nav-item--highlight {
  border: 1px solid var(--accent);
  padding: 0.5rem 1.5rem;
  border-radius: var(--radius);
}

.mobile-menu__cta {
  /* Removed dedicated CTA button from JS/HTML to deduplicate */
  display: none;
}

/* ======================== HERO ======================== */
#hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  /* Taller hero */
  text-align: center;
  padding: var(--spacing-xl) 0;
  /* Updated to use 'background.png' and enforce light text colors */
  background-color: #252122;
  /* Fallback for dark theme or if image fails */
  background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('assets/background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  /* Enforce light text explicitly to avoid variable inheritance issues in light mode */
  color: #f5f2ec;
}

.hero__inner {
  position: relative;
  z-index: 2;
  max-width: 800px;
}

.hero__title {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: #f5f2ec;
  /* Force light color */
  margin-bottom: 1rem;
}

.hero__tagline {
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  color: rgba(245, 242, 236, 0.9);
  /* Force light color */
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.hero__subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 600;
  color: var(--accent);
  /* Keep accent color */
  margin-bottom: 2rem;
  line-height: 1.5;
}

.hero__cta {
  margin-bottom: 1.5rem;
}

.hero__trust-line {
  font-size: 0.95rem;
  color: rgba(245, 242, 236, 0.7);
  /* Force light color */
  margin-bottom: 2.5rem;
}

/* Trust Chips */
.hero__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.trust-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(75, 71, 72, 0.35);
  border: 1px solid rgba(163, 146, 98, 0.2);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.trust-chip__icon {
  color: var(--accent);
  flex-shrink: 0;
}

/* Hero background decorative shape */
.hero__bg-shape {
  position: absolute;
  top: -20%;
  right: -15%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(163, 146, 98, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}

/* ======================== SECTIONS — GENERIC ======================== */
.section {
  padding: 5rem 0;
  background: var(--bg-primary);
}

.section--alt {
  background: var(--bg-alt);
}

.section__title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.section__title--center {
  text-align: center;
}

.section__subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 3rem;
}

/* Two-column layout */
.section__two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.section__text p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.section__text p:last-child {
  margin-bottom: 0;
}

.section__text strong {
  color: var(--text);
}

.section__visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.abstract-shape {
  width: 100%;
  max-width: 350px;
  height: auto;
}

/* ======================== VALORI — CARDS ======================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}

.card {
  background: rgba(75, 71, 72, 0.25);
  border: 1px solid rgba(163, 146, 98, 0.12);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(163, 146, 98, 0.3);
}

.card__icon {
  margin-bottom: 1.25rem;
}

.card__title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.card__text {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ======================== SERVIZI ======================== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}

.service-item {
  background: rgba(75, 71, 72, 0.2);
  border: 1px solid rgba(163, 146, 98, 0.1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* Ensure image stays within border radius */
  transition: border-color var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}

.service-item:hover {
  border-color: rgba(163, 146, 98, 0.3);
  transform: translateY(-4px);
}

.service-item__image-wrapper {
  position: relative;
  width: 100%;
  /* aspect-ratio removed to allow image to dictate height */
  overflow: hidden;
  background: var(--bg-primary);
}

.service-item__img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.service-item:hover .service-item__img {
  transform: scale(1.05);
  /* Subtle zoom on hover */
}

.service-item__content {
  padding: 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.service-item__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

.service-item__desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.service-item__list {
  padding-left: 1.25rem;
  list-style: disc;
  margin-top: auto;
  /* Push list to bottom if needed, or just keep flow */
}

.service-item__list li {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  line-height: 1.5;
}

.service-item__list li::marker {
  color: var(--accent);
}

/* ======================== PORTALE KOSMAIL ======================== */
.section--kosmail {
  background: var(--bg-primary);
}

.kosmail-block {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 3rem;
}

.kosmail-block__intro {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.7;
}

/* ======================== FAQ / ACCORDION ======================== */
.faq {
  max-width: 760px;
  margin: 0 auto;
}

.faq__heading {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--text);
}

.accordion__item {
  border-bottom: 1px solid rgba(163, 146, 98, 0.15);
}

.accordion__item:first-child {
  border-top: 1px solid rgba(163, 146, 98, 0.15);
}

.accordion__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1.25rem 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  gap: 1rem;
  transition: color var(--transition);
}

.accordion__trigger:hover,
.accordion__trigger:focus-visible {
  color: var(--accent);
}

.accordion__chevron {
  flex-shrink: 0;
  transition: transform var(--transition);
}

.accordion__trigger[aria-expanded="true"] .accordion__chevron {
  transform: rotate(180deg);
}

.accordion__panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.4s ease;
}

.accordion__panel[hidden] {
  display: block;
  max-height: 0;
  visibility: hidden;
}

.accordion__panel:not([hidden]) {
  max-height: 500px;
  visibility: visible;
}

.accordion__content {
  padding: 0 0 1.25rem;
}

.accordion__content p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.accordion__content p:last-child {
  margin-bottom: 0;
}

.accordion__content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ======================== CONTATTI ======================== */
.contact-grid {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
  text-align: center;
}

.contact-info__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.contact-info__icon {
  flex-shrink: 0;
  margin-bottom: 0.25rem;
  color: var(--accent);
  /* Ensure icon color is consistent if not set in inline style */
}

.contact-info__item a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.contact-info__item strong {
  color: var(--text);
}

.contact-info__item div {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.contact-info__note {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(163, 146, 98, 0.15);
}



/* ======================== FOOTER ======================== */
.site-footer {
  background: var(--bg-alt);
  padding: 3rem 0 1.5rem;
  border-top: 1px solid rgba(163, 146, 98, 0.1);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.site-footer__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.site-footer__brand .logo-text {
  font-size: 1.25rem;
}

.site-footer__note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.site-footer__nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-footer__nav a {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.site-footer__nav a:hover,
.site-footer__nav a:focus-visible {
  color: var(--accent);
}

.site-footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(163, 146, 98, 0.1);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-footer__legal {
  display: flex;
  gap: 1.25rem;
}

.site-footer__legal a {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-footer__legal a:hover {
  color: var(--accent);
}

/* ======================== REVEAL ON SCROLL ======================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ======================== RESPONSIVE ======================== */

/* Tablet & below */
@media (max-width: 992px) {

  .cards-grid,
  .services-grid {
    grid-template-columns: 1fr 1fr;
  }

  .section__two-col {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .section__visual {
    order: -1;
  }

  .abstract-shape {
    max-width: 250px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --header-h: 56px;
  }

  /* Nav */
  .site-nav {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  /* Hero */
  .hero {
    min-height: auto;
    padding: 5rem 1.5rem 3rem;
  }

  .hero__bg-shape {
    width: 350px;
    height: 350px;
  }

  /* Grids */
  .cards-grid,
  .services-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  /* Footer */
  .site-footer__top {
    flex-direction: column;
  }

  .site-footer__bottom {
    flex-direction: column;
    text-align: center;
  }

  /* Section spacing */
  .section {
    padding: 3.5rem 0;
  }
}

/* Small phones */
@media (max-width: 420px) {
  .hero__chips {
    flex-direction: column;
    align-items: center;
  }

  .btn--large {
    width: 100%;
  }
}

/* Legal Row */
.site-footer__legal-row {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.8;
  text-align: center;
}

.site-footer__legal-row p {
  line-height: 1.6;
}