/* =======================================================
   MORPH — NŌMEN SERIES
   STYLESHEET - ENHANCED VERSION (FIXED)
======================================================= */

/* === FONTS === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

@font-face {
  font-family: "Atone";
  src: url("fonts/Atone.woff2") format("woff2");
  font-display: swap;
  font-weight: 100 900;
  font-style: normal;
}

@font-face {
  font-family: "NeueHaas";
  src: url("fonts/NeueHaasDisplay-Black.woff2") format("woff2");
  font-display: swap;
  font-weight: 100 900;
  font-style: normal;
}

/* === VARIABILI === */
:root {
  --bg: #0a0a0a;
  --fg: #eaeaea;
  --muted: #9a9a9a;
  --card: #111111;
  --line: #242424;
  --accent: #ffffff;
  --font-brand: "Atone", sans-serif;
  --font-body: "NeueHaas", -apple-system, BlinkMacSystemFont, sans-serif;
}

/* === RESET & BASE === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--fg);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  cursor: default;
}

h1, h2, h3, .logo, .mask-name, .chip, .tag-cat, .btn-copy {
  font-family: var(--font-brand);
  letter-spacing: .05em;
}

p, .desc, .mask-modal-lore {
  font-family: var(--font-body);
  line-height: 1.6;
}

.container {
  width: min(1100px, 92vw);
  margin-inline: auto;
}

/* === GRAIN TEXTURE OVERLAY === */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
}

/* === LOADING SCREEN === */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-logo {
  width: 200px;
  opacity: 0;
  animation: logoFadeIn 1.5s ease forwards;
}

/* Animazione più semplice per il logo loading */
@keyframes logoFadeIn {
  0% { 
    opacity: 0; 
  }
  100% { 
    opacity: 1; 
  }
}

/* === CUSTOM CURSOR === */
.cursor {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transition: transform 0.15s ease, border-color 0.3s ease;
  mix-blend-mode: difference;
}

.cursor-follower {
  width: 8px;
  height: 8px;
  background: rgba(255,255,255,0.8);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  transition: transform 0.2s ease;
  mix-blend-mode: difference;
}

.cursor.hover {
  transform: scale(1.5);
  border-color: rgba(255,255,255,0.9);
}

/* === SCROLL PROGRESS BAR === */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 3px;
  height: 0%;
  background: linear-gradient(to bottom, transparent, var(--accent), transparent);
  z-index: 9999;
  transition: height 0.1s ease;
}

/* === NAVBAR === */
.nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px min(4vw, 24px);
  background: linear-gradient(to bottom, rgba(10,10,10,.95), rgba(10,10,10,.7), transparent);
  backdrop-filter: saturate(120%) blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.05);
  transition: transform 0.3s ease;
}

.nav.hidden {
  transform: translateY(-100%);
}

.nav .brand {
  font-family: var(--font-brand);
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--fg);
  text-decoration: none;
  font-size: 2.4rem;
  transition: color 0.3s ease;
}

.nav .brand:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 18px;
  font-weight: 500;
  transition: color .25s ease;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.nav-links a:hover {
  color: var(--fg);
}

.nav-links a:hover::after {
  width: 100%;
}

/* === HERO === */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 100vh;
  padding: 0;
  overflow: hidden;
}

/* Gradient animato dietro logo */
.hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,0.03), transparent 70%);
  animation: pulse 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% { 
    transform: translate(-50%, -50%) scale(1); 
    opacity: 0.3; 
  }
  50% { 
    transform: translate(-50%, -50%) scale(1.2); 
    opacity: 0.5; 
  }
}

.hero .container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.logo-img {
  width: clamp(240px, 40vw, 520px);
  height: auto;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 0 20px rgba(255,255,255,0.2));
  transition: transform 0.1s ease;
}

.logo-img:hover {
  transform: scale(1.02);
}

.series {
  font-family: var(--font-body);
  letter-spacing: .18em;
  margin-top: 20px;
  font-size: 2rem;
  opacity: 0;
  animation: fadeInUp 1s ease 0.3s forwards;
}

.tag {
  font-size: 1.5rem;
  margin-top: .4rem;
  opacity: 0;
  animation: fadeInUp 1s ease 0.5s forwards;
}

.subtag {
  color: var(--muted);
  margin-top: .2rem;
  font-size: 1.2rem;
  opacity: 0;
  animation: fadeInUp 1s ease 0.7s forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 0.9;
    transform: translateY(0);
  }
}

/* === SECTIONS === */
.section {
  position: relative;
  padding: 80px 0;
}

.section.fullscreen {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 8vw;
}

.section.fullscreen .container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.h2 {
  font-family: var(--font-brand);
  letter-spacing: .12em;
  font-size: 4rem;
  margin-bottom: 2rem;
  text-align: left;
  background: linear-gradient(to right, var(--fg), var(--muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}

.lead {
  color: #cfcfcf;
  font-weight: 400;
  line-height: 1.7;
  max-width: 80ch;
  margin: 0 auto 1.2rem;
  font-size: 1.25rem;
  text-align: center;
}

blockquote {
  opacity: 0.8;
  font-style: italic;
  margin-top: 16px;
  text-align: center;
  font-size: 1.2rem;
}

/* === LORE SECTION (Stats rimossi) === */
.lore.fullscreen .lead,
.about.fullscreen .lead {
  margin-top: 2rem;
}

.lore.fullscreen blockquote {
  margin-top: 2rem;
}

/* Nascondi le statistiche */
.stats {
  display: none;
}

/* === MASKS SECTION === */
.masks.fullscreen {
  padding-top: 140px;
  padding-bottom: 60px;
  justify-content: flex-start;
  align-items: center;
  overflow-y: auto;
  min-height: auto;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 20px;
  padding-top: 20px;
}

.section-head .h2 {
  margin: 0;
}

.filters-dropdown {
  display: none;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  font: 600 15px/1 var(--font-body);
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0f0f0f;
  color: var(--fg);
  cursor: pointer;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

.chip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.chip:hover::before {
  transform: translateX(100%);
}

.chip.is-active,
.chip:hover {
  border-color: var(--accent);
  background: #161616;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* === GRID === */
.cards-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  justify-content: center;
}

/* === MASK CARD === */
.mask-card {
  display: flex;
  flex-direction: column;
  height: 480px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 18px;
  overflow: hidden;
  transition: all .4s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  position: relative;
  transform-style: preserve-3d;
}

.mask-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255,255,255,0.05), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mask-card:hover::before {
  opacity: 1;
}

.mask-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(255,255,255,.35);
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

/* === IMG AREA === */
.img-wrap {
  position: relative;
  height: 260px;
  background: radial-gradient(120px circle at 50% 40%, #1b1b1b, #0e0e0e);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}

.mask-img {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.4));
  opacity: 0;
  transform: translateY(20px) scale(0.9);
  transition: all .6s cubic-bezier(0.4, 0, 0.2, 1);
}

.mask-card.is-in .mask-img {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.mask-card:hover .mask-img {
  transform: scale(1.05);
  filter: drop-shadow(0 15px 30px rgba(255,255,255,.15)) brightness(1.1);
}

/* === LOGO NEL RIQUADRO === */
.mask-logo {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 58px;
  opacity: 0.25;
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(0,0,0,.6));
  mix-blend-mode: lighten;
  transition: all .3s ease;
}

.mask-card:hover .mask-logo {
  opacity: 0.5;
  transform: scale(1.1) rotate(5deg);
}

/* === TESTO DELLA CARD === */
.mask-card .txt {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mask-name {
  font: 700 1.4rem/1.2 var(--font-body);
  margin: 0;
  letter-spacing: .02em;
}

.kanji {
  color: #bfbfbf;
  font-size: 1.2rem;
  margin: 0;
}

.meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}

.tag-cat {
  font: 700 .72rem/1 var(--font-body);
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #d7d7d7;
}

/* === BUTTON (effetti rimossi) === */
.btn-copy {
  border: 1px solid var(--line);
  background: #151515;
  color: #eaeaea;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font: 600 .8rem var(--font-body);
  transition: all .3s ease;
  position: relative;
}

.btn-copy:hover {
  border-color: var(--accent);
  background: #1f1f1f;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* === ANIMAZIONI REVEAL === */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all .8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* === POPUP MASCHERA === */
.mask-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mask-modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.mask-modal-content {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 40px;
  max-width: 640px;
  width: 100%;
  color: var(--fg);
  position: relative;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mask-modal:not(.hidden) .mask-modal-content {
  transform: scale(1) translateY(0);
}

.mask-modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  color: var(--fg);
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.mask-modal-close:hover {
  background: rgba(255,255,255,0.1);
  transform: rotate(90deg);
}

.mask-modal-img {
  width: 160px;
  display: block;
  margin: 0 auto 20px;
  filter: drop-shadow(0 10px 30px rgba(0,0,0,0.5));
}

.mask-modal-title {
  text-align: center;
  font-family: var(--font-body);
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
}

.mask-modal-kanji {
  text-align: center;
  font-family: var(--font-brand);
  color: #bfbfbf;
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.mask-modal-lore {
  text-align: center;
  line-height: 1.7;
  color: #d0d0d0;
  font-size: 1rem;
}

/* === FOOTER === */
footer {
  padding: 40px 8vw;
  border-top: 1px solid var(--line);
}

.credits {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #bdbdbd;
  font-size: .9rem;
  flex-wrap: wrap;
  gap: 20px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  body {
    cursor: auto;
  }

  .cursor,
  .cursor-follower {
    display: none;
  }

  .scroll-progress {
    width: 2px;
  }

  .nav .brand {
    font-size: 1.8rem;
  }

  .nav-links a {
    margin-left: 12px;
    font-size: 0.9rem;
  }

  .hero {
    padding: 10vh 0 8vh;
  }

  .logo-img {
    width: clamp(200px, 60vw, 400px);
  }

  .series {
    font-size: 1.3rem;
    letter-spacing: 0.15em;
  }

  .tag {
    font-size: 1rem;
  }

  .subtag {
    font-size: 0.9rem;
  }

  .h2 {
    font-size: 2.6rem;
    text-align: center;
  }

  .lead {
    font-size: 1rem;
    max-width: 90%;
  }

  .filters {
    display: none;
  }

  .filters-dropdown {
    display: block;
    width: 100%;
    background: #0e0e0e;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--fg);
    font-family: var(--font-body);
    font-size: 0.95rem;
    cursor: pointer;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #fff 50%),
                      linear-gradient(135deg, #fff 50%, transparent 50%);
    background-position: calc(100% - 20px) calc(1.2em), calc(100% - 15px) calc(1.2em);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
  }

  .filters-dropdown:focus {
    outline: none;
    border-color: var(--accent);
    background-color: #161616;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .masks.fullscreen {
    padding-top: 100px;
  }

  .mask-card {
    height: auto;
  }

  .mask-modal-content {
    padding: 30px 20px;
  }

  .mask-modal-img {
    width: 120px;
  }

  .mask-modal-title {
    font-size: 1.3rem;
  }

  .credits {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}