/*
 * CONCEPT SECTION STYLES
 * Gestione layout sezione, manifesto, griglia e stile delle carte
 */

/* =========================================
   1. LAYOUT GENERALE & SFONDO
   ========================================= */

.concept-section {
  position: relative;
  width: 100%;
  padding: 8rem 1.5rem;
  background-color: var(--color-bg-beige);
  z-index: 10;
  overflow: hidden; /* Maschera decorazioni fuori bordo */
}

@media (min-width: 768px) {
  .concept-section {
    padding: 4rem 3rem 12rem 3rem;
  }
}

/* Container centrale contenuto */
.concept-content.container {
  max-width: 80rem;
  margin: 0 auto;
  position: relative;
  z-index: 10;
}

/* --- Background Layers & Nebbia (Mist) --- */
.concept-bg-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  max-height: 100rem;
}

@media (min-width: 768px) {
  .concept-bg-layer {
    max-height: 100%;
  }
}

.bg-path-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.2;
}

/* Transizione Sfumata Inferiore */
.mist-transition {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 16rem;
  z-index: 20;
  pointer-events: none;
}

@media (min-width: 768px) {
  .mist-transition {
    height: 24rem;
  }
}

.mist-gradient {
  width: 100%;
  height: 100%;
  /* Sfumatura: Beige solido (basso) -> Trasparente (alto) */
  background: linear-gradient(to top, var(--color-bg-beige) 10%, rgba(230, 222, 209, 0.9) 50%, transparent 100%);
}

.mist-texture {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 50%;
  background-image: url("../img/wood-pattern.png");
  opacity: 0.2;
  mix-blend-mode: multiply;
}

/* Decorazione fondo (Vines) */
.bottom-vines-container {
  position: absolute;
  bottom: -100px;
  left: 0;
  width: 100%;
  height: 16rem;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
  overflow: hidden;
}

/* =========================================
   2. MANIFESTO (Testi Introduttivi)
   ========================================= */

.manifesto-wrapper {
  position: relative;
  margin-bottom: 6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 64rem;
  margin-left: auto;
  margin-right: auto;
}

/* Tag: "Il Tema 2026" */
.manifesto-tag {
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.manifesto-tag .line {
  height: 1px;
  width: 3rem;
  background-color: var(--color-brand-green);
  opacity: 0.4;
}

.manifesto-tag .tag-text {
  color: var(--color-brand-green);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: bold;
}

/* Titoli */
.manifesto-title {
  font-family: var(--font-primary);
  color: var(--color-brand-brown);
  font-size: 2.7rem;
  line-height: 2;
  margin-bottom: 0.9rem;
  letter-spacing: -0.2em;
  font-weight: 600;
}

.manifesto-subtitle {
  font-family: var(--font-secondary);
  font-style: italic;
  font-size: 1.875rem;
  color: var(--color-brand-green);
  margin-bottom: 4rem;
  display: inline-block;
  transform: rotate(-2deg);
  opacity: 0.9;
}
@media (min-width: 375px) {
  .manifesto-title {
    font-size: 3rem;
  }
}
@media (min-width: 425px) {
  .manifesto-title {
    font-size: 3.5rem;
  }
}
@media (min-width: 768px) {
  .manifesto-title {
    font-size: 5rem;
  }
  .manifesto-subtitle {
    font-size: 3rem;
  }
}

/* Testo Editoriale */
.manifesto-text {
  font-family: var(--font-secondary);
  font-size: 1.25rem;
  color: rgba(62, 52, 43, 0.8);
  line-height: 1.6;
  max-width: 48rem;
  margin-bottom: 4rem;
}

.manifesto-text .highlight-brown {
  color: var(--color-brand-brown);
  font-weight: bold;
}

/* Quote Box */
.quote-box {
  position: relative;
  padding: 1rem 1.5rem;
  margin: 2.5rem 0;
}

.quote {
  font-family: serif;
  font-style: italic;
  font-size: 1.875rem;
  color: #4a3b32;
  line-height: 1.2;
}

@media (min-width: 768px) {
  .quote {
    font-size: 3rem;
  }
}

/* Date Stamp */
.manifesto-date {
  margin-top: 2rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(62, 52, 43, 0.4);
}

/* CTA Button */
.btn-concept {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background-color: var(--color-brand-brown);
  color: var(--color-bg-beige);
  padding: 0.75rem 2.5rem;
  border-radius: 9999px;
  font-family: var(--font-primary);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: -0.15em;
  text-decoration: none;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
  line-height: 1;
}
@media (min-width: 375px) {
  .btn-concept {
    font-size: 1rem;
  }
}

.btn-concept svg {
  width: 1.5rem;
  height: 1.5rem;
  transition: transform 0.3s ease;
}

.btn-concept:hover {
  background-color: var(--color-brand-green);
  transform: scale(1.05);
}

.btn-concept:active {
  transform: scale(0.95);
}

.btn-concept:hover svg {
  transform: translateX(4px);
}

/* Connettore Verticale (SVG tra sezioni) */
.vertical-connector {
  position: relative;
  height: 8rem;
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: -2.5rem;
  margin-bottom: 2.5rem;
  pointer-events: none;
  z-index: 0;
}

.connector-svg {
  height: 100%;
  width: 6rem;
  overflow: visible;
}

/* =========================================
   3. GRIGLIA CARTELLI (Cards)
   ========================================= */

.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6rem;
  width: 100%;
  padding-bottom: 8rem;
  align-items: start;
  margin: 5rem auto 0 auto;
}

/* Wrapper Base Card */
.card-wrapper {
  position: relative;
  width: 100%;
  max-width: 380px;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;

  /* Stato iniziale animazione */
  opacity: 0;
  transform: translateY(50px);
  transition:
    opacity 0.8s ease-out,
    transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-wrapper.visible {
  opacity: 1;
  transform: translateY(0) rotateX(0);
}

/* Configurazione Grid Responsiva */
@media (min-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  /* L'ultima card su 2 colonne occupa tutta la riga (centrata) */
  .cards-grid > div:last-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1440px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  /* Offset centrale */
  .cards-grid > div:nth-child(2) {
    margin-top: 8rem;
  }
  /* Reset ultima card */
  .cards-grid > div:last-child {
    grid-column: auto;
  }
}

/* =========================================
   4. STILE CARD (Temi e Struttura)
   ========================================= */

/* Variabili Tematiche (Mapping) */
.theme-boldness {
  --card-bg: var(--card-1-bg);
  --card-text: var(--card-1-text);
  --card-accent: var(--card-1-accent);
  --wood-tone: brightness(0.8);
}

.theme-identity {
  --card-bg: var(--card-2-bg);
  --card-text: var(--card-2-text);
  --card-accent: var(--card-2-accent);
  --wood-tone: sepia(0.5) hue-rotate(60deg);
}

.theme-pathfinding {
  --card-bg: var(--card-3-bg);
  --card-text: var(--card-3-text);
  --card-accent: var(--card-3-accent);
  --wood-tone: brightness(1.1);
}

/* Il Palo (The Post) */
.card-post {
  position: absolute;
  top: -3rem;
  bottom: -95rem; /* Mobile: molto lungo */
  width: 4rem;
  background-color: #362b24;
  z-index: -1;
  border-radius: 4px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

@media (min-width: 1024px) {
  .card-post {
    bottom: -13rem; /* Desktop: lunghezza standard */
  }
}

/* Texture legno del palo */
.wood-texture {
  position: absolute;
  inset: 0;
  background-image: url("../img/wood-pattern.png");
  opacity: 1;
  mix-blend-mode: multiply;
}

/* Dettagli luce/ombra palo */
.card-post .highlight-left {
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: rgba(255, 255, 255, 0.05);
}

.card-post .shadow-right {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  background-color: rgba(0, 0, 0, 0.2);
}

/* Il Cartello (The Sign) */
.card-sign {
  position: relative;
  width: 100%;
  min-height: 500px;
  background-color: var(--card-bg);
  color: var(--card-text);
  border-radius: 0.5rem;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3);
  padding: 2.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1;
}

/* Hover Effects */
.card-wrapper:hover .card-sign {
  transform: scale(1.02) rotateZ(2deg);
}
.card-wrapper.offset-down:hover .card-sign {
  transform: scale(1.02) rotateZ(-2deg);
}

/* Texture Overlay */
.concept-wood-texture-overlay {
  position: absolute;
  inset: 0;
  background-image: url("../img/wood-pattern.png");
  opacity: 0.2;
  mix-blend-mode: overlay;
  border-radius: 0.5rem;
  pointer-events: none;
}

/* Bordi 3D */
.border-outer {
  position: absolute;
  inset: 0;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  pointer-events: none;
}

.border-inner {
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  pointer-events: none;
}

/* Bulloni (Bolts) */
.concept-bolt {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background-color: #1a1512;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.5);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

.concept-bolt.concept-top-bolt {
  top: 1.5rem;
}
.concept-bolt.concept-bottom-bolt {
  bottom: 1.5rem;
}

.concept-bolt-slot {
  width: 0.5rem;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.2);
  transform: rotate(45deg);
}

/* Decorazioni Viti (SVG) */
.vine-deco {
  position: absolute;
  width: 8rem;
  height: 8rem;
  pointer-events: none;
  z-index: 20;
  color: var(--card-accent);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.vine-deco.top-left {
  top: -1.5rem;
  left: -1.5rem;
}
.vine-deco.top-right {
  top: -2rem;
  right: -1.5rem;
}
.vine-deco.bottom-right {
  bottom: -1.5rem;
  right: -1.5rem;
}
.vine-deco.middle-right {
  top: 50%;
  right: -2rem;
}

/* =========================================
   5. CONTENUTO INTERNO CARD
   ========================================= */

.card-content {
  position: relative;
  z-index: 10;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.concept-card-header {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.card-icon-box {
  width: 4rem;
  height: 4rem;
  color: var(--card-accent);
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.card-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.concept-card-subtitle {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  opacity: 0.6;
  text-transform: uppercase;
  border-bottom: 1px solid currentColor;
  padding-bottom: 0.25rem;
}

.card-number-title {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
}

.card-num {
  font-family: var(--font-primary);
  font-size: 3.5rem;
  letter-spacing: -0.15em;
  line-height: 1;
  opacity: 0.3;
  mix-blend-mode: overlay;
}

.concept-card-title {
  font-family: var(--font-primary);
  font-size: 2rem;
  letter-spacing: -0.15em;
  line-height: 2;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card-divider {
  width: 3rem;
  height: 4px;
  background-color: currentColor;
  opacity: 0.3;
  border-radius: 9999px;
  margin-bottom: 1.5rem;
}

.card-label {
  font-family: var(--font-primary);
  font-size: 1.5rem;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: -0.15em;
  opacity: 0.9;
  margin-bottom: 1rem;
}

.concept-card-desc {
  font-family: var(--font-secondary);
  font-size: 1.125rem;
  line-height: 1.4;
  opacity: 0.9;
  font-weight: 300;
  margin-top: auto;
}

/* =========================================
   6. ANIMAZIONI
   ========================================= */

/* Foglie Cadenti */
@keyframes falling-leaf-anim {
  0% {
    transform: translateY(-10vh) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  25% {
    transform: translateY(25vh) translateX(40px) rotate(90deg);
  }
  50% {
    transform: translateY(50vh) translateX(-40px) rotate(180deg);
    opacity: 1;
  }
  75% {
    transform: translateY(75vh) translateX(20px) rotate(270deg);
  }
  100% {
    transform: translateY(120vh) translateX(0) rotate(360deg);
    opacity: 0;
  }
}

.falling-leaf {
  position: absolute;
  top: -50px;
  pointer-events: none;
  z-index: 1;
}

/* Linea Tratteggiata Sfondo */
.bg-path-line path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 30s linear;
}

.bg-path-line.animate path {
  stroke-dashoffset: 0;
}
