/* ---------------------------------------------------------------
   Akira Zakamoto — minimal gallery (stile johnbrendanguinan.com)
   Sfondo bianco, tipografia essenziale, masonry, molto respiro.
---------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #111;
  background: #fff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(150%) blur(6px);
  border-bottom: 1px solid #eee;
}
.site-header .bar,
.site-footer .bar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1500px; margin: 0 auto;
  padding: 16px 28px;
}
.wordmark {
  font-weight: 600;
  letter-spacing: .14em;
  font-size: 11px;
  text-transform: uppercase;
}
/* ---------- Header right: menu inline / toggle / burger ---------- */
.header-right { display: flex; align-items: center; gap: 20px; }
.wordmark-star { display: inline-flex; align-items: center; }
.wordmark-star svg { fill: #4B0082; display: block; }
html.dark .wordmark-star svg { fill: #7986CB; }

.site-nav-inline { display: none; gap: 22px; }
.site-nav-inline a {
  text-transform: uppercase; letter-spacing: .12em; font-size: 11px; color: #555;
  transition: color .15s ease; white-space: nowrap;
}
.site-nav-inline a:hover, .site-nav-inline a.is-active { color: #000; }
.theme-toggle {
  background: none; border: 0; cursor: pointer; color: #111; font-size: 15px; line-height: 1; padding: 0;
}
/* Se c'è spazio in orizzontale -> menu su una riga, niente burger */
@media (min-width: 1000px) {
  .site-nav-inline { display: flex; }
  .nav-toggle { display: none; }
}

/* ---------- Burger ---------- */
.nav-toggle {
  width: 15px; height: 11px; position: relative;
  background: none; border: 0; cursor: pointer; padding: 0;
}
.nav-toggle span {
  position: absolute; left: 0; width: 100%; height: 1.5px; background: #111;
  transition: transform .3s ease, opacity .2s ease;
}
.nav-toggle span:nth-child(1) { top: 0; }
.nav-toggle span:nth-child(2) { top: 5px; }
.nav-toggle span:nth-child(3) { top: 10px; }
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* ---------- Overlay menu ---------- */
.nav-overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(255,255,255,.98);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease;
}
body.nav-open .nav-overlay { opacity: 1; visibility: visible; }
.nav-overlay {
  gap: 11px;
}
.nav-overlay a {
  text-transform: uppercase; letter-spacing: .14em; font-size: 11px; color: #444;
  transition: color .15s ease;
}
.nav-overlay a:hover, .nav-overlay a.is-active { color: #000; }

/* ---------- Galleria masonry (colonne flex, ordine preservato) ---------- */
.gallery-wrap { max-width: 1500px; margin: 0 auto; padding: 40px 28px 40px; }
.masonry { display: flex; gap: 34px; align-items: flex-start; }
.mcol { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 38px; }
@media (max-width: 1100px) { .masonry { gap: 26px; } .mcol { gap: 26px; } }

/* Layout a righe: ordine rigoroso (più recenti in alto, scroll = più vecchi) */
.masonry-rows { flex-wrap: wrap; align-items: flex-start; }
.masonry-rows .tile { width: calc((100% - 68px) / 3); }
@media (max-width: 1100px) { .masonry-rows .tile { width: calc((100% - 26px) / 2); } }
@media (max-width: 640px)  { .masonry-rows .tile { width: 100%; } }

.tile { margin: 0; }
.loader { text-align: center; color: #aaa; font-size: 12px; padding: 24px 0 70px; }
#sentinel { height: 1px; }
.tile-link { display: block; background: #f4f4f4; overflow: hidden; }
.tile img {
  width: 100%; height: auto;
  transition: opacity .25s ease, transform .4s ease;
}
.tile-link:hover img { opacity: .82; }
.tile figcaption {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.tile .t { font-weight: 500; font-style: italic; }
.tile .m { color: #888; font-size: 12px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(255,255,255,.97);
  display: none; padding: 40px;
}
.lightbox.open { display: grid; place-items: center; }
/* Variante scrollabile (galleries): contenuto più alto del viewport scrollabile */
.lightbox-scroll.open { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.lightbox-scroll figure {
  min-height: calc(100vh - 80px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 16px 40px;
}
.lightbox figure {
  margin: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  max-height: 100%; max-width: 100%;
}
.lightbox img {
  max-width: 90vw; max-height: 80vh; width: auto; height: auto;
  object-fit: contain; margin: 0 auto;
  transition: opacity .35s ease;   /* dissolvenza bianca */
}
.lightbox img.is-fading { opacity: 0; }
.lightbox figcaption {
  margin-top: 16px; font-size: 13px; color: #333; text-align: center;
  transition: opacity .35s ease;
}
.lightbox figcaption.is-fading { opacity: 0; }
.lightbox figcaption #lb-title { font-style: italic; }
.lightbox figcaption #lb-meta { font-style: normal; color: #999; margin-left: 8px; }
.lightbox .lb-link, .lightbox figcaption a { color: #3a9bdc; }
.lightbox .lb-link:hover { color: #5bb4ee; }
.lb-owner { margin-top: 8px; text-align: center; }
.lb-owner-line { font-size: 13px; color: #333; }
.lb-owner-priv { font-size: 11px; color: #999; margin-top: 3px; font-style: italic; }
.lb-auth-wrap { margin-top: 8px; }
.lb-auth { display: inline-block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid #999; border-radius: 3px; padding: 6px 14px; color: #333; }
.lb-auth:hover { border-color: #111; color: #000; }
html.dark .lb-auth { color: #ccc; border-color: #555; }
html.dark .lb-auth:hover { color: #fff; border-color: #fff; }
html.dark .lb-owner-line { color: #ccc; }
html.dark .lb-owner-priv { color: #888; }

/* Social sharing nel lightbox — accanto alla X di chiusura */
.lb-share-wrap { position: fixed; top: 20px; right: 76px; z-index: 112; }
.lb-share {
  background: none; border: 1px solid #ccc; border-radius: 2px; cursor: pointer;
  font-family: inherit; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: #111; padding: 7px 12px; transition: border-color .15s ease;
}
.lb-share:hover { border-color: #111; }
.lb-share-menu {
  position: absolute; top: 42px; right: 0; min-width: 150px;
  background: #fff; border: 1px solid #ddd; border-radius: 2px;
  display: flex; flex-direction: column; box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
.lb-share-menu[hidden] { display: none; }
.lb-share-menu a, .lb-share-menu button {
  text-align: left; background: none; border: 0; cursor: pointer;
  font-family: inherit; font-size: 12px; color: #222; padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
}
.lb-share-menu a:last-child, .lb-share-menu button:last-child { border-bottom: 0; }
.lb-share-menu a:hover, .lb-share-menu button:hover { background: #f6f6f6; }
html.dark .lb-share { color: #eee; border-color: #555; }
html.dark .lb-share:hover { border-color: #fff; }
html.dark .lb-share-menu { background: #1c1c1c; border-color: #333; }
html.dark .lb-share-menu a, html.dark .lb-share-menu button { color: #ddd; border-bottom-color: #2a2a2a; }
html.dark .lb-share-menu a:hover, html.dark .lb-share-menu button:hover { background: #262626; }

/* Frecce navigazione */
.lb-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 50px; height: 50px; padding: 0; border: 0; cursor: pointer;
  font-size: 30px; line-height: 1; color: #111; opacity: .9;
  background: rgba(255,255,255,.7); border-radius: 50%;
  transition: opacity .15s ease, background .15s ease; z-index: 115;
  -webkit-user-select: none; user-select: none;
}
.lb-nav:hover { opacity: 1; background: rgba(255,255,255,.9); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
html.dark .lb-nav { background: rgba(0,0,0,.5); color: #fff; }
html.dark .lb-nav:hover { background: rgba(0,0,0,.7); }
@media (max-width: 640px) {
  .lb-nav { width: 42px; height: 42px; font-size: 26px; }
  .lb-prev { left: 10px; } .lb-next { right: 10px; }
  .lightbox { padding: 0; }
  .lightbox img { max-width: 100vw; max-height: 82vh; }
}
.lb-close {
  position: fixed; top: 22px; right: 30px;
  background: none; border: 0; font-size: 34px; font-weight: 300; line-height: 1; cursor: pointer; color: #111;
}

/* ---------- Pagina dettaglio ---------- */
.detail {
  max-width: 1300px; margin: 0 auto; padding: 50px 28px 90px;
  display: grid; grid-template-columns: 1.6fr 1fr; gap: 56px; align-items: start;
}
.detail-img img { width: 100%; height: auto; background: #f4f4f4; }
.detail-meta h1 { font-size: 22px; font-style: italic; font-weight: 500; margin: 0 0 14px; }
.detail-meta p { margin: 2px 0; color: #555; }
.detail-meta .dm-info { margin-top: 18px; color: #333; }
.detail-meta .dm-back { margin-top: 30px; }
.detail-meta .dm-back a { color: #000; border-bottom: 1px solid #000; padding-bottom: 2px; }
@media (max-width: 800px) { .detail { grid-template-columns: 1fr; gap: 28px; } }

/* ---------- Pagine semplici ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 70px 28px 100px; }
.page h1 { font-size: 24px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.page .soon { color: #999; }

/* ---------- About ---------- */
.about { max-width: 720px; text-align: center; }
.bio-block p {
  font-size: 16px; line-height: 1.9; color: #111; font-style: italic;
  margin: 0 auto 10px;
}
.bio-block a { color: inherit; border-bottom: 1px solid currentColor; }
html.dark .bio-block a { color: inherit; }
#poem { font-size: 16px; line-height: 1.9; color: #111; font-style: italic; }
html.dark #poem { color: #eee; }
.poem-flags { margin-top: 16px; text-align: center; display: flex; justify-content: center; gap: 9px; }
.poem-flag {
  background: none; border: 0; padding: 0; cursor: pointer; line-height: 0;
  opacity: .45; transition: opacity .15s ease; filter: grayscale(35%);
}
.poem-flag:hover { opacity: .8; }
.poem-flag.active { opacity: 1; filter: none; }
.poem-flag svg { width: 13px; height: 9px; border: 1px solid rgba(0,0,0,.15); border-radius: 2px; display: block; }
html.dark .poem-flag svg { border-color: rgba(255,255,255,.2); }

/* Contact intro */
.contact-intro { color: #555; max-width: 520px; margin: 6px auto 0; }
html.dark .contact-intro { color: #aaa; }
.cv-section { margin-top: 64px; text-align: left; }
.cv-section h2 {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .18em;
  color: #111; margin: 0 0 18px; padding-bottom: 10px; border-bottom: 1px solid #eee;
}
.cv-list { display: flex; flex-direction: column; }
.cv-group { margin-bottom: 28px; }
.cv-group:last-child { margin-bottom: 0; }
.cv-year {
  font-weight: 600; color: #111; font-variant-numeric: tabular-nums;
  font-size: 13px; margin-bottom: 6px;
}
.cv-items { display: flex; flex-direction: column; gap: 4px; }
.cv-item { color: #333; font-size: 13.5px; line-height: 1.5; }
.cv-star { color: #000; font-size: 9px; margin-right: 7px; vertical-align: middle; }

/* ---------- Files (testi critici) ---------- */
.files-page { max-width: 1100px; }
.file-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 28px 18px;
  margin-top: 36px;
}
.file-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  color: #111; transition: transform .2s ease;
}
button.file-card { background: none; border: 0; font: inherit; cursor: pointer; }
.file-card:hover { transform: translateY(-3px); }
.file-card:hover .file-ico svg path[fill="#fff"] { fill: #f5f5f5; }
.file-ico { display: block; }
.file-title {
  margin-top: 10px; font-size: 11.5px; line-height: 1.35; font-weight: 500;
}
.file-author { margin-top: 3px; font-size: 10.5px; color: #999; }
@media (max-width: 900px)  { .file-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 600px)  { .file-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 380px)  { .file-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Pagina testo critico ---------- */
.text-page { max-width: 720px; text-align: left; }
.text-page .tp-back { margin-bottom: 22px; }
.text-page .tp-back a { color: #000; border-bottom: 1px solid #000; padding-bottom: 2px; }
.text-page .tp-title { font-size: 22px; font-weight: 600; text-transform: none; letter-spacing: 0; margin: 0 0 6px; }
.text-page .tp-author { color: #888; font-size: 13px; margin: 0 0 18px; }
.text-page .tp-author a { color: #3a9bdc; }
.text-page .tp-author a:hover { color: #5bb4ee; }
.tp-flags { justify-content: flex-start; margin: 0 0 22px; }
.text-page .tp-author a { color: #111; }
.text-page .tp-author a:hover { color: #000; }
.text-page .tp-linkico { font-size: 11px; color: #888; }
.text-page .tp-body { font-size: 15px; line-height: 1.75; color: #222; }
.text-page .tp-link { margin-top: 26px; }
.text-page .tp-sep { border: 0; border-top: 1px solid #e2e2e2; margin: 34px 0; }
.text-page .tp-body-en { color: #555; }
html.dark .text-page .tp-sep { border-top-color: #2a2a2a; }
html.dark .text-page .tp-body-en { color: #aaa; }

/* ---------- Contact ---------- */
.contact-page { max-width: 560px; }
.contact-form { display: flex; flex-direction: column; gap: 22px; margin-top: 30px; text-align: left; }
.contact-form label {
  display: flex; flex-direction: column; gap: 8px;
  text-transform: uppercase; letter-spacing: .12em; font-size: 11px; color: #555;
}
.contact-form label span { color: #c00; }
.contact-form input,
.contact-form textarea {
  font-family: inherit; font-size: 14px; color: #111;
  border: 1px solid #ccc; border-radius: 0; padding: 11px 12px; background: #fff;
  width: 100%; transition: border-color .15s ease;
}
.contact-form input:focus,
.contact-form textarea:focus { outline: none; border-color: #111; }
.contact-form textarea { resize: vertical; }
.contact-form button {
  align-self: flex-start;
  font-family: inherit; text-transform: uppercase; letter-spacing: .14em; font-size: 12px;
  color: #fff; background: #111; border: 0; padding: 13px 34px; cursor: pointer;
  transition: background .15s ease;
}
.contact-form button:hover { background: #444; }
.form-ok  { margin-top: 30px; color: #157a3f; }
.form-err { margin-top: 20px; color: #c00; }

/* ---------- Barra area riservata gallerie ---------- */
.gate-bar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1500px; margin: 0 auto; padding: 12px 28px;
  font-size: 12px; color: #888; border-bottom: 1px solid #eee;
}
.gate-bar a { color: #000; border-bottom: 1px solid #000; padding-bottom: 1px; }
html.dark .gate-bar { color: #999; border-bottom-color: #262626; }
html.dark .gate-bar a { color: #fff; border-bottom-color: #fff; }

/* ---------- Home hero ---------- */
.hero {
  position: relative; display: flex; align-items: flex-end; justify-content: center;
  height: calc(100vh - 56px); min-height: 420px; overflow: hidden; text-decoration: none;
}
.hero-bg { position: absolute; inset: 0; }
.hero-slide {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.6s ease; transform: scale(1.02);
}
.hero-slide.active { opacity: 1; }
.hero-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.28); }
.hero-title {
  position: absolute; left: 0; right: 0; bottom: 2.5vh;
  width: 100%; height: auto; display: block; z-index: 2;
  filter: drop-shadow(0 1px 12px rgba(0,0,0,.45));
}
html.dark .hero-overlay { background: rgba(0,0,0,.4); }

/* ---------- Gate Galleries & Collectors ---------- */
.gate-page { max-width: 460px; }
.gate-intro { color: #555; margin-top: 8px; }
.gate-form { margin-top: 26px; }
.gate-logout { margin-top: 26px; font-size: 12px; }
.gate-logout a { color: #000; border-bottom: 1px solid #000; padding-bottom: 2px; }
html.dark .gate-intro { color: #aaa; }
html.dark .gate-logout a { color: #fff; border-bottom-color: #fff; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid #eee; margin-top: 40px; }
.site-footer .bar { font-size: 12px; color: #888; }
.foot-contacts a { margin-left: 18px; }
.foot-contacts a:hover { color: #000; }

/* ===============================================================
   TEMA SCURO (variante selezionabile: html.dark)
   =============================================================== */
html.dark body { background: #0e0e0e; color: #e8e8e8; }

html.dark .site-header { background: rgba(14,14,14,.92); border-bottom-color: #262626; }
html.dark .wordmark { color: #fff; }
html.dark .site-nav-inline a { color: #999; }
html.dark .site-nav-inline a:hover, html.dark .site-nav-inline a.is-active { color: #fff; }
html.dark .theme-toggle { color: #eee; }
html.dark .nav-toggle span { background: #eee; }

html.dark .nav-overlay { background: rgba(14,14,14,.98); }
html.dark .nav-overlay a { color: #999; }
html.dark .nav-overlay a:hover, html.dark .nav-overlay a.is-active { color: #fff; }

/* Galleria */
html.dark .tile-link { background: #1b1b1b; }
html.dark .tile .t { color: #eee; }
html.dark .tile .m { color: #888; }
html.dark .loader { color: #666; }

/* Lightbox */
html.dark .lightbox { background: rgba(0,0,0,.95); }
html.dark .lb-close, html.dark .lb-nav { color: #eee; }
html.dark .lightbox figcaption { color: #ccc; }
html.dark .lightbox figcaption #lb-meta { color: #888; }

/* Pagine semplici / About */
html.dark .page h1 { color: #fff; }
html.dark .bio-block p { color: #eee; }
html.dark .cv-section h2 { color: #fff; border-bottom-color: #262626; }
html.dark .cv-year { color: #fff; }
html.dark .cv-item { color: #cfcfcf; }
html.dark .cv-star { color: #e8e8e8; }
html.dark .page .soon { color: #777; }

/* Files */
html.dark .file-card { color: #eee; }
html.dark .file-author { color: #999; }
html.dark .file-ico svg path, html.dark .file-ico svg line,
html.dark .file-ico svg rect, html.dark .file-ico svg circle { stroke: #cfcfcf; }
html.dark .file-ico svg [fill="#fff"] { fill: #1b1b1b; }
html.dark .file-card:hover .file-ico svg [fill="#fff"] { fill: #262626; }

/* Pagina testo */
html.dark .text-page .tp-title { color: #fff; }
html.dark .text-page .tp-body { color: #d8d8d8; }
html.dark .text-page .tp-author { color: #999; }
html.dark .text-page .tp-author a { color: #fff; }
html.dark .text-page .tp-back a { color: #fff; border-bottom-color: #fff; }

/* Contact */
html.dark .contact-form input,
html.dark .contact-form textarea { background: #1a1a1a; border-color: #444; color: #eee; }
html.dark .contact-form input:focus,
html.dark .contact-form textarea:focus { border-color: #fff; }
html.dark .contact-form button { background: #eee; color: #111; }
html.dark .contact-form button:hover { background: #fff; }

/* Footer */
html.dark .site-footer { border-top-color: #262626; }
html.dark .site-footer .bar { color: #888; }
html.dark .foot-contacts a:hover { color: #fff; }
