/* nihon.it, bozza v1: il provino a contatto, con il sigillo rosso sulla foto scelta */
:root {
  /* colori presi dal soggetto: sumi (inchiostro), carta, vermiglio dei sigilli e dei torii */
  --bg: #0f0e0d;
  --surface: #1c1a18;
  --ink: #ffffff;
  --muted: #aaa49d;
  --accent: #bc002d;
  --accent-ink: #ffffff;
  --paper: #f4f3f0;
  --paper-2: #e8e6e1;
  --paper-ink: #141210;
  --paper-muted: #5d5853;

  --step-small: 1rem;
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
  --step-display: clamp(2.35rem, 7.2vw, 7.5rem);

  --m: clamp(14px, 1.4vw, 20px);
  --gap: 14px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --sans: "General Sans", ui-sans-serif, system-ui, sans-serif;
  --jp: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: var(--step-body); line-height: 1.45; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.soft { color: var(--muted); }
.light .soft { color: var(--paper-muted); }

.dark { background: var(--bg); color: var(--ink); }
.light { background: var(--paper); color: var(--paper-ink); }

/* link: niente sottolineatura fissa, riga che cresce al passaggio */
.band a, .foot a, .more, .ab-list a, .credits a, .run-title {
  text-decoration: underline 1.5px transparent; text-underline-offset: 4px;
  transition: text-decoration-color .25s var(--ease), color .2s;
}
.band a:hover, .foot a:hover, .more:hover, .ab-list a:hover, .credits a:hover, .run-title:hover { text-decoration-color: currentColor; }

.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink); padding: 12px 20px; border-radius: 0;
  font-weight: 500; font-size: var(--step-small); border: 0; cursor: pointer; font-family: inherit;
  transition: transform .2s var(--ease), background-color .2s;
}
.btn:hover { background-color: #96001f; }
.btn:active { transform: scale(.96); }

/* ---------- fascia in alto ---------- */
.band {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--gap);
  padding: 20px var(--m) 0; font-size: var(--step-small); line-height: 1.5;
}
.b-name { display: flex; gap: 12px; align-items: baseline; }
.wordmark { font-weight: 700; font-size: var(--step-body); }
.kanji { font-family: var(--jp); font-size: var(--step-body); color: var(--muted); }
.b-what { grid-column: 2 / span 2; max-width: 30ch; color: var(--muted); }
.b-list { grid-column: span 1; }
.b-label { color: var(--muted); margin-bottom: 4px; }
.b-places { grid-column: 5 / span 1; }
.b-end { grid-column: 6 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; text-align: right; }
.clock { color: var(--muted); max-width: 26ch; }
.clock strong { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }

.display {
  font-size: var(--step-display); font-weight: 700; letter-spacing: -0.03em; line-height: .92;
  margin: clamp(96px, 12vh, 150px) 0 0; padding: 0 var(--m) clamp(28px, 4vh, 48px);
}
.display span { display: block; }

/* ---------- il provino ---------- */
.sheet { position: relative; padding: 24px var(--m) 96px; display: grid; grid-template-columns: repeat(12, 1fr); gap: 0 var(--gap); align-items: start; }
.runs { grid-column: 1 / 9; grid-row: 1; padding-top: 22px; min-width: 0; }
.now { grid-column: 9 / 13; grid-row: 1; position: sticky; top: 20px; display: flex; flex-direction: column; gap: 10px; }
.now .pic { width: 100%; aspect-ratio: 4 / 5; overflow: hidden; }
.now img { width: 100%; height: 100%; object-fit: cover; animation: drift 24s ease-in-out infinite alternate; }
.now figcaption { font-size: var(--step-small); color: var(--muted); }
@keyframes drift { from { transform: scale(1); } to { transform: scale(1.07) translateX(-1.5%); } }

.runs { display: flex; flex-wrap: wrap; gap: 28px 8px; }
.run { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; max-width: 100%; transition: opacity .24s; }
.frame { position: relative; display: flex; flex-direction: column; }
.frame .pic { position: relative; height: clamp(84px, 7.6vw, 112px); aspect-ratio: var(--r); overflow: hidden; }
.frame img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.frame:hover img { transform: scale(1.06); }
.run-title { position: absolute; bottom: 100%; left: 0; margin-bottom: 6px; font-size: var(--step-small); white-space: nowrap; color: var(--ink); }
.runs.hovering .run { opacity: .28; }
.runs.hovering .run.active { opacity: 1; }
.run-desc {
  position: fixed; left: var(--m); bottom: var(--m); z-index: 5; max-width: 40ch;
  background: var(--bg); color: var(--ink); padding: 10px 14px; font-size: var(--step-small);
  opacity: 0; transform: translateY(8px); transition: opacity .24s, transform .24s var(--ease); pointer-events: none;
}
.run-desc.on { opacity: 1; transform: none; }

/* il sigillo: la foto scelta di ogni argomento */
.hanko {
  position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-family: var(--jp); font-size: 15px; line-height: 1;
  border-radius: 3px; transform: rotate(-6deg); animation: stamp .5s .9s var(--ease) both;
}
.lifted .hanko, .tframe .hanko { width: 40px; height: 40px; font-size: 23px; right: 10px; top: 10px; }
@keyframes stamp { from { transform: rotate(-6deg) scale(1.8); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }

/* ---------- intro: tessere ---------- */
.intro { padding: 8px; }
.board { display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: 38svh 38svh; gap: 8px; }
.tile { overflow: hidden; display: flex; align-items: flex-end; }
.tile-a { grid-column: 1 / 9; grid-row: 1 / 3; background: var(--bg); color: var(--ink); padding: 20px; }
.tile-a h2 { font-size: clamp(3.5rem, 9vw, 8.25rem); font-weight: 700; letter-spacing: -0.03em; line-height: .88; max-width: 7em; }
.tile-b { grid-column: 9 / 13; grid-row: 1; background: var(--paper-2); padding: 20px; }
.tile-b p { font-family: var(--jp); font-size: clamp(3.5rem, 9vw, 8.25rem); line-height: .9; color: var(--accent); }
.tile-c { grid-column: 9 / 13; grid-row: 2; }
.tile-c img { width: 100%; height: 100%; object-fit: cover; }
.intro-text { display: grid; grid-template-columns: repeat(12, 1fr); padding: 56px 0 0; }
.intro-text p { grid-column: 7 / 13; padding: 0 40px; font-size: var(--step-lead); line-height: 1.35; }

/* ---------- indice degli argomenti ---------- */
.index { position: relative; display: grid; grid-template-columns: 22% 520px 1fr; padding: clamp(120px, 14vw, 200px) var(--m); align-items: start; }
.index-col { grid-column: 2; }
.index h2 { font-size: var(--step-lead); font-weight: 500; margin-bottom: 32px; }
.rows .row a { display: flex; align-items: center; gap: 8px; min-height: 38px; font-size: var(--step-body); }
.dot { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; flex: none; }
.row-name { flex: 1; }
.row-val { font-size: var(--step-small); color: var(--paper-muted); font-variant-numeric: tabular-nums; }
.rows.hovering .row { opacity: .35; }
.rows .row { transition: opacity .24s; }
.rows.hovering .row.active { opacity: 1; }
.row-inline { display: none; }
.preview { grid-column: 3; position: sticky; top: 12vh; padding-left: 48px; }
.preview img { width: 100%; max-height: 70vh; object-fit: cover; aspect-ratio: 4 / 5; transition: opacity .24s; }
.preview img.swap { opacity: 0; }

/* ---------- vetrina: Templi ---------- */
.showcase { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gap); padding: 0 var(--m) clamp(120px, 14vw, 200px); }
.sc-side { grid-column: 1 / 4; display: flex; flex-direction: column; gap: 14px; }
.sc-side h2 { font-size: var(--step-lead); font-weight: 500; }
.more { align-self: flex-start; font-size: var(--step-body); color: var(--accent); font-weight: 500; }
.sc-note { margin-top: auto; font-size: var(--step-small); max-width: 28ch; color: var(--paper-muted); }
.sc-run { grid-column: 4 / 13; display: flex; flex-wrap: wrap; gap: 16px 6px; align-items: flex-end; }
.sframe { flex: none; display: flex; flex-direction: column; gap: 8px; }
.sframe .pic { position: relative; height: clamp(140px, 17vh, 180px); aspect-ratio: var(--r); overflow: hidden; }
.sframe.lifted .pic { height: clamp(330px, 42vh, 440px); }
.sframe img, .sframe video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s var(--ease); }
.sframe:hover img { transform: scale(1.05); }
.sframe figcaption { display: flex; justify-content: space-between; gap: 12px; font-size: var(--step-small); }

/* ---------- galleria fitta ---------- */
.gallery { padding: 0 12px clamp(120px, 14vw, 200px); }
.gal-top { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; margin-bottom: 14px; }
.gal-statement { grid-column: 8 / 13; max-width: 30ch; font-size: var(--step-lead); line-height: 1.3; padding-bottom: 28px; }
.feature { grid-column: 1 / 5; }
.feature img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.masonry { columns: 6; column-gap: 4px; }
.tile-m { break-inside: avoid; margin-bottom: 14px; }
.tile-m img, .feature img { transition: transform .4s var(--ease); }
.tile-m:hover img { transform: scale(1.03); }
.tile-m figcaption, .feature figcaption { font-size: var(--step-small); margin-top: 6px; }

/* ---------- chi ---------- */
.dark-end { padding-top: clamp(120px, 14vw, 200px); }
.about { padding: 0 var(--m); }
.ab-row { display: grid; grid-template-columns: 34% 1fr; align-items: start; }
.facts { display: flex; flex-direction: column; gap: 20px; font-size: var(--step-small); width: 180px; }
.facts dt { color: var(--muted); }
.ab-para { font-size: clamp(1.25rem, 1.7vw, 1.625rem); line-height: 1.35; max-width: 56vw; }
.ab-row2 { margin-top: 120px; grid-template-columns: 34% 420px 260px; column-gap: 0; }
.ab-word { font-size: var(--step-small); color: var(--muted); }
.ab-list { font-size: var(--step-small); display: flex; flex-direction: column; gap: 10px; margin-right: 64px; }
.ab-list li { display: flex; justify-content: space-between; gap: 12px; }

/* ---------- crediti e piede ---------- */
.credits { margin: 120px var(--m) 0; font-size: var(--step-small); color: var(--muted); max-width: 980px; }
.credits summary { cursor: pointer; color: var(--ink); }
.credits p { margin: 14px 0; }
.credits ul { columns: 2; column-gap: 32px; }
.credits li { break-inside: avoid; margin-bottom: 6px; }
.foot {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 24px;
  padding: 30svh var(--m) 30px; font-size: var(--step-small);
}
.foot nav { display: flex; gap: 24px; }
.f-end { text-align: right; }

/* ---------- pagina argomento ---------- */
.t-lead { padding: 0 var(--m); max-width: 46ch; font-size: var(--step-lead); line-height: 1.35; color: var(--muted); }
.tsheet { display: flex; flex-wrap: wrap; gap: 28px 10px; padding: 64px var(--m) 140px; }
.tframe { display: flex; flex-direction: column; gap: 8px; }
.open { all: unset; cursor: zoom-in; display: block; }
.open:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.tframe .pic { position: relative; display: block; height: clamp(160px, 22vw, 300px); aspect-ratio: var(--r); overflow: hidden; }
.tframe img, .tframe video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s var(--ease); }
.tframe:hover img { transform: scale(1.04); }
.tframe figcaption { display: flex; justify-content: space-between; gap: 12px; font-size: var(--step-small); }
.viewer { border: 0; padding: 0; background: var(--bg); color: var(--ink); max-width: 92vw; max-height: 92vh; }
.viewer::backdrop { background: rgba(10, 9, 8, .92); }
.viewer img { max-width: 92vw; max-height: 78vh; object-fit: contain; }
.viewer p { padding: 14px 16px 0; font-size: var(--step-small); }
.viewer form { padding: 12px 16px 16px; }

/* ---------- entrate ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: var(--d, 0ms); }
.js [data-reveal].in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .clip video { animation: none; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .now img, .hanko { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- tablet ---------- */
@media (max-width: 1024px) {
  .band { grid-template-columns: repeat(4, 1fr); row-gap: 20px; }
  .b-what { grid-column: 2 / span 3; }
  .b-list { grid-column: 1 / span 2; }
  .b-places { grid-column: 3 / span 1; }
  .b-end { grid-column: 4; }
  .index { grid-template-columns: 1fr 1fr; }
  .index-col { grid-column: 1; }
  .preview { grid-column: 2; }
  .masonry { columns: 4; }
  .feature { grid-column: 1 / 7; }
  .gal-statement { grid-column: 7 / 13; padding-left: 16px; }
  .runs { grid-column: 1 / 13; }
  .now { grid-column: 1 / 7; grid-row: 2; position: static; margin-top: 40px; }
  .ab-row2 { grid-template-columns: 34% 1fr 1fr; }
}

/* ---------- telefono ---------- */
@media (max-width: 640px) {
  .band { grid-template-columns: 1fr 1fr; gap: 12px; }
  .b-name, .b-what { grid-column: 1 / -1; max-width: none; }
  .b-list { grid-column: 1; }
  .b-places { grid-column: 2; }
  .b-end { grid-column: 1 / -1; align-items: flex-start; text-align: left; }
  .display { margin-top: 80px; }
  .now { grid-column: 1 / -1; }
  .runs { gap: 30px 6px; }
  .frame .pic { height: 72px; }
  .run-desc { display: none; }
  .board { grid-template-columns: 1fr 1fr; grid-template-rows: 46svh auto; gap: 6px; }
  .tile-a { grid-column: 1 / -1; grid-row: 1; }
  .tile-a h2 { font-size: 13vw; }
  .tile-b, .tile-c { grid-column: auto; grid-row: 2; aspect-ratio: 1; }
  .tile-b p { font-size: 13vw; }
  .intro-text { display: block; padding-top: 32px; }
  .intro-text p { padding: 0 20px; }
  .index { display: block; padding: 120px 20px; }
  .rows .row a { min-height: 44px; }
  .preview { display: none; }
  .row-inline { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; margin: 4px 0 18px; }
  .showcase { display: block; padding-bottom: 120px; }
  .sc-side { margin-bottom: 24px; }
  .sc-note { margin-top: 8px; }
  .sc-run { gap: 16px 6px; }
  .sframe { width: calc(50% - 3px); }
  .sframe .pic { height: auto; width: 100%; aspect-ratio: 4 / 3; }
  .sframe.lifted { order: -1; width: 100%; }
  .sframe.lifted .pic { height: auto; aspect-ratio: 4 / 5; }
  .gallery { padding: 0 10px 120px; }
  .gal-top { display: block; }
  .gal-statement { padding: 0 0 24px; }
  .masonry { columns: 3; }
  .ab-row, .ab-row2 { display: block; }
  .ab-para { max-width: none; font-size: var(--step-lead); margin-bottom: 32px; }
  .facts { display: grid; grid-template-columns: 1fr 1fr; width: auto; }
  .ab-row2 { margin-top: 64px; }
  .ab-word { color: var(--ink); margin-bottom: 12px; }
  .ab-list { margin: 0 0 40px; }
  .credits ul { columns: 1; }
  .foot { display: flex; flex-direction: column; gap: 8px; padding-top: 20svh; padding-bottom: 24px; }
  .f-end { text-align: left; }
  .tframe .pic { height: auto; width: calc(100vw - 2 * var(--m)); }
}
