/* =========================================================
   GEENSANG — Gianmarco Palazzo
   ========================================================= */

@font-face {
  font-family: "Anton";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/anton-400.woff2") format("woff2");
}

@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/space-mono-400.woff2") format("woff2");
}

@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/space-mono-700.woff2") format("woff2");
}

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

:root {
  --bg: #0a0a0a;
  --fg: #ecebe6;
  --muted: #7d7c78;
  --line: rgba(236, 235, 230, .14);
  --red: #ff2a1f;
  --display: "Anton", "Impact", "Arial Narrow", sans-serif;
  --mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --ease: cubic-bezier(.76, 0, .24, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --gutter: clamp(16px, 2.6vw, 40px);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--red); color: #000; }

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
sup { font-size: .6em; vertical-align: super; line-height: 0; }

.mono-label {
  display: block;
  margin-bottom: .6rem;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Grana animata ---------- */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 90;
  pointer-events: none;
  opacity: .09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .6s steps(4) infinite;
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-3%, 2%); }
  50%  { transform: translate(2%, -4%); }
  75%  { transform: translate(-1%, 3%); }
  100% { transform: translate(3%, -1%); }
}

/* ---------- Testo che sale (split lines) ---------- */
.line {
  display: block;
  overflow: hidden;
  padding-bottom: .02em;
}

.split {
  display: inline-block;
  transform: translateY(105%);
  transition: transform 1.2s var(--ease-out);
}

.reveal-up {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
}

.split.in { transform: none; }
.reveal-up.in { opacity: 1; transform: none; }

/* ---------- Cursore ---------- */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--fg);
  mix-blend-mode: difference;
  pointer-events: none;
  display: grid;
  place-items: center;
  transition: width .35s var(--ease-out), height .35s var(--ease-out), margin .35s var(--ease-out), background .3s;
  opacity: 0;
}

.cursor.visible { opacity: 1; }

.cursor-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #000;
  opacity: 0;
  transition: opacity .2s;
}

.cursor.has-label {
  width: 78px;
  height: 78px;
  margin: -39px 0 0 -39px;
  mix-blend-mode: normal;
}

.cursor.has-label .cursor-label { opacity: 1; }

@media (hover: hover) and (pointer: fine) {
  .intro, .intro a, .intro button { cursor: none; }
}

@media not all and (hover: hover) and (pointer: fine) {
  .cursor { display: none; }
}

/* ---------- Shutter (transizione tra pagine) ---------- */
.shutter {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  pointer-events: none;
}

.shutter span {
  flex: 1;
  background: #000;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .7s var(--ease);
}

.shutter span:nth-child(2) { transition-delay: .05s; }
.shutter span:nth-child(3) { transition-delay: .1s; }
.shutter span:nth-child(4) { transition-delay: .15s; }
.shutter span:nth-child(5) { transition-delay: .2s; }

.shutter.is-closed span { transform: scaleY(1); }

.shutter.is-opening span {
  transform: scaleY(0);
  transform-origin: top;
}

/* =========================================================
   INTRO
   ========================================================= */
body.intro {
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

/* Sfondo */
.intro-bg {
  position: fixed;
  inset: -4%;
  background: #000 url("media/intro-poster.jpg") center / cover no-repeat;
  filter: contrast(1.15) saturate(1.2) brightness(.6);
  transform: translate3d(var(--px, 0), var(--py, 0), 0) scale(1.08);
  transition: transform .8s var(--ease-out);
}

.intro-bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

.scanlines::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 18vh;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, .05), transparent);
  animation: roll 7s linear infinite;
}

@keyframes roll {
  from { top: -20vh; }
  to   { top: 110vh; }
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, .85) 100%);
}

.rec-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* Contenuto intro */
.intro-content {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 var(--gutter);
}

.intro-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3.4rem, min(17vw, 26vh), 16rem);
  line-height: .86;
  letter-spacing: -.01em;
}

/* Glitch RGB sul titolo */
.glitch { position: relative; }

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: .8;
}

.glitch::before { color: #ff0040; animation: glitch-a 3.2s infinite steps(1); }
.glitch::after  { color: #00e5ff; animation: glitch-b 3.2s infinite steps(1); }

@keyframes glitch-a {
  0%, 86%, 100% { transform: none; clip-path: inset(0 0 100% 0); }
  87% { transform: translate(-6px, 2px); clip-path: inset(10% 0 55% 0); }
  89% { transform: translate(5px, -2px); clip-path: inset(60% 0 8% 0); }
  91% { transform: translate(-3px, 0); clip-path: inset(30% 0 40% 0); }
  93% { transform: none; clip-path: inset(0 0 100% 0); }
}

@keyframes glitch-b {
  0%, 86%, 100% { transform: none; clip-path: inset(0 0 100% 0); }
  87% { transform: translate(6px, -2px); clip-path: inset(50% 0 20% 0); }
  89% { transform: translate(-5px, 2px); clip-path: inset(5% 0 70% 0); }
  91% { transform: translate(4px, 1px); clip-path: inset(75% 0 2% 0); }
  93% { transform: none; clip-path: inset(0 0 100% 0); }
}

.intro-subtitle {
  margin-top: 1.6rem;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.intro-subtitle .sep { color: var(--red); margin: 0 .4em; }

/* Bottone ENTRA */
.btn-enter {
  position: relative;
  margin-top: 2.6rem;
  padding: 1.1rem 3.4rem;
  border: 1px solid var(--fg);
  border-radius: 999px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .3em;
  text-transform: uppercase;
  isolation: isolate;
  transition: color .5s var(--ease), border-color .5s, opacity 1s var(--ease-out);
}

.btn-enter::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--fg);
  border-radius: inherit;
  transform: translateY(101%);
  transition: transform .5s var(--ease);
}

.btn-enter-text {
  position: relative;
  display: inline-block;
  transition: transform .5s var(--ease);
}

.btn-enter-text::after {
  content: attr(data-hover);
  position: absolute;
  left: 50%;
  top: 180%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.btn-enter:hover,
.btn-enter:focus-visible { color: #000; outline: none; }
.btn-enter:hover::before,
.btn-enter:focus-visible::before { transform: none; }
.btn-enter:hover .btn-enter-text,
.btn-enter:focus-visible .btn-enter-text { transform: translateY(-180%); }

.link-u {
  position: relative;
  display: inline-block;
}

.link-u::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .5s var(--ease);
}

.link-u:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Firma */
.credit {
  position: fixed;
  left: 50%;
  bottom: calc(var(--gutter) + 8px);
  z-index: 12;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: .8;
  transition: opacity .2s;
}

.credit:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }

/* Uscita: glitch forte prima della tendina */
body.leaving .intro-bg { filter: contrast(2) saturate(2) hue-rotate(40deg) brightness(.8); transform: scale(1.2); transition: all .7s var(--ease); }
body.leaving .intro-content { animation: shake .3s steps(2) 2; }

@keyframes shake {
  0% { transform: translate(4px, -2px); }
  50% { transform: translate(-4px, 2px); }
  100% { transform: none; }
}

/* =========================================================
   HOME — archivio
   ========================================================= */
body.home {
  --paper: #0a0a0a;
  --ink: #ecebe6;
  --soft: #7a7873;
  --rule: rgba(236, 235, 230, .14);
  --strip-h: clamp(190px, 30vh, 320px);
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;
}

/* Arrivo dall'intro: il nero della tendina sfuma via */
body.home::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  pointer-events: none;
  animation: fade-out .7s .1s ease forwards;
}

@keyframes fade-out { to { opacity: 0; visibility: hidden; } }

body.home ::selection { background: var(--ink); color: var(--paper); }

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px var(--gutter);
  background: var(--paper);
}

.top-name { line-height: 1.3; font-weight: 700; }

.top-nav {
  display: flex;
  gap: 18px;
}

.top-nav button,
.top-nav a {
  color: var(--soft);
  transition: color .15s;
}

.top-nav button:hover,
.top-nav a:hover,
.top-nav .active { color: var(--ink); }

.top-nav .active {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Righe dei progetti */
.archive { padding: 0 var(--gutter); }

.row {
  display: grid;
  grid-template-columns: minmax(150px, 15%) 1fr;
  gap: 16px;
  padding: 14px 0 22px;
  border-top: 1px solid var(--rule);
}

.row[hidden] { display: none; }

.row-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.row-num { color: var(--soft); font-variant-numeric: tabular-nums; }
.row-title { font-size: 13px; font-weight: 700; }
.row-sub { color: var(--soft); }

.strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
  padding-bottom: 8px;
}

.strip::-webkit-scrollbar { height: 4px; }
.strip::-webkit-scrollbar-thumb { background: var(--rule); }

.shot {
  position: relative;
  display: block;
  aspect-ratio: var(--ar);
  background: #1a1a1a;
  cursor: zoom-in;
}

.strip .shot {
  flex: none;
  height: var(--strip-h);
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .4s;
}

.shot img.loaded { opacity: 1; }

.shot:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.shot-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .4s;
}

.shot-video.playing { opacity: 1; }

.shot-play {
  z-index: 1;
  position: absolute;
  left: 8px;
  bottom: 8px;
  color: #fff;
  font-size: 12px;
  text-shadow: 0 0 8px rgba(0, 0, 0, .6);
}

.row-title a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Testo solo per screen reader e motori di ricerca */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Intestazione dell'archivio */
.page-intro {
  display: grid;
  grid-template-columns: minmax(150px, 15%) 1fr;
  gap: 16px;
  padding: 24px var(--gutter) 40px;
}

.page-intro h1 {
  max-width: 38ch;
  font-size: clamp(20px, 2.4vw, 32px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -.01em;
}

/* Info */
.info {
  display: grid;
  grid-template-columns: minmax(150px, 15%) 1fr;
  gap: 28px 16px;
  margin: 60px var(--gutter) 0;
  padding: 14px 0 80px;
  border-top: 1px solid var(--ink);
}

.info-label {
  grid-column: 1;
  font-size: 13px;
  font-weight: 400;
  color: var(--soft);
}

.info-lead,
.info-services,
.faq,
.info-list { grid-column: 2; }

.info-lead {
  max-width: 34ch;
  font-size: clamp(20px, 2.4vw, 32px);
  line-height: 1.15;
  letter-spacing: -.01em;
}

.info-services { max-width: 70ch; }
.info-services li + li { margin-top: 6px; }
.info-services strong { font-weight: 500; }

.faq { max-width: 70ch; }
.faq-item + .faq-item { margin-top: 16px; }
.faq dt { font-weight: 500; }
.faq dd { color: var(--soft); margin-top: 2px; }

.info-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 40px;
}

.info-list dt { color: var(--soft); }
.info-list a:hover { text-decoration: underline; text-underline-offset: 3px; }

.bottom {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px var(--gutter);
  color: var(--soft);
}

.bottom a:hover { color: var(--ink); }
.bottom #backTop { justify-self: end; }
.credit-home { color: var(--ink); }
.credit-home:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Pagine progetto e pagine legali */
.page { padding: 24px var(--gutter) 60px; }

.crumbs { color: var(--soft); margin-bottom: 40px; }
.crumbs a:hover { color: var(--ink); }

.page-head { max-width: 60ch; margin-bottom: 40px; }

.page h1 {
  font-size: clamp(28px, 4vw, 56px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -.02em;
}

.page-meta { color: var(--soft); margin-top: 10px; }

.page-desc {
  margin-top: 18px;
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.4;
}

.gallery {
  columns: 2 320px;
  column-gap: 8px;
}

.gallery .shot,
.gallery .clip {
  width: 100%;
  margin-bottom: 8px;
  break-inside: avoid;
}

.gallery-video { columns: 1; max-width: 1200px; }

.clip video {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
}

.clip figcaption { color: var(--soft); padding: 6px 0 20px; }

.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  margin-top: 60px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.pager a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pager a[rel="next"] { text-align: right; }

.legal { max-width: 760px; }
.legal h1 { margin-bottom: 0; }
.legal h2 { font-size: 18px; font-weight: 500; margin: 40px 0 10px; }
.legal h3 { font-size: 14px; font-weight: 500; margin: 20px 0 6px; }
.legal p { font-size: 15px; line-height: 1.55; margin-top: 10px; }
.legal p a,
.page-desc a { text-decoration: underline; text-underline-offset: 3px; }

/* Visore */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #0c0c0c;
  color: #cfcdc8;
  display: flex;
  flex-direction: column;
}

.viewer[hidden] { display: none; }

.viewer-bar {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 16px;
  padding: 14px var(--gutter);
}

.viewer-count { color: #777; font-variant-numeric: tabular-nums; }
.viewer-close { margin-left: auto; color: inherit; }
.viewer-close:hover { color: #fff; }

.viewer-stage {
  flex: 1;
  min-height: 0;
  position: relative;
}

.viewer-stage img,
.viewer-stage video {
  position: absolute;
  top: 0;
  left: var(--gutter);
  width: calc(100% - 2 * var(--gutter));
  height: calc(100% - var(--gutter));
  object-fit: contain;
}

.viewer-stage video { position: relative; z-index: 2; }

.viewer-prev,
.viewer-next {
  position: absolute;
  top: 48px;
  bottom: 0;
  width: 50%;
  z-index: 1;
}

.viewer-prev { left: 0; cursor: w-resize; }
.viewer-next { right: 0; cursor: e-resize; }

body.viewer-open { overflow: hidden; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 760px) {

  body.home { --strip-h: 210px; }

  .row,
  .info,
  .page-intro { grid-template-columns: 1fr; gap: 10px; }

  .info-label { margin-top: 18px; }

  .bottom { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .bottom #backTop { justify-self: center; }

  .pager { grid-template-columns: 1fr 1fr; }
  .pager a[href$="home.html"] { display: none; }

  .row-meta { flex-direction: row; gap: 8px; flex-wrap: wrap; }

  .info-label,
  .info-lead,
  .info-services,
  .faq,
  .info-list { grid-column: 1; }

  .archive { padding-right: 0; }
  .strip { padding-right: var(--gutter); }

  /* su touch le frecce non servono: si scorre col dito */
  .viewer-prev, .viewer-next { cursor: default; }
}

@media (max-width: 520px) {
  .btn-enter { padding: 1rem 2.6rem; }
  @media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .split, .reveal-up { transform: none; opacity: 1; }
  body.home::before { display: none; }
}
