/* 888 · Giovanni Pusterla — site styles
   Palette: gesso (wall), carbone (ink), grafite (secondary), oltremare (links/focus), velatura (rules) */
:root{
  --gesso:#e4e5e2;
  --gesso-2:#d9dad6;
  --carbone:#1d1c1a;
  --grafite:#5b5954;
  --oltremare:#2b3c9e;
  --velatura:#c4c5c0;
  --campo:#f1f1ef;      /* form fields */
  --avviso:#eef0f7;     /* notice boxes */
  --avviso-err:#f6ecec;
  --rosso:#9e2b2b;
  --carta:#fff;         /* behind press clippings */
  --display:"Big Shoulders Display", "Arial Narrow", sans-serif;
  --text:"Barlow", "Helvetica Neue", Arial, sans-serif;
  --measure:36rem;
  --gutter:clamp(1.25rem, 4vw, 3.5rem);
  color-scheme:light;
}
/* Dark theme: follows the device setting, unless the visitor picked a theme with the lamp
   (site.js sets data-theme on <html>). Same names, night values: the wall goes dark, the ink light. */
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --gesso:#191917; --gesso-2:#24231f; --carbone:#e9e7e2; --grafite:#a8a59e; --oltremare:#9fb0ff; --velatura:#3a3935;
    --campo:#222220; --avviso:#1e2236; --avviso-err:#2e1d1d; --rosso:#e07a7a; --carta:#2a2926;
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --gesso:#191917; --gesso-2:#24231f; --carbone:#e9e7e2; --grafite:#a8a59e; --oltremare:#9fb0ff; --velatura:#3a3935;
  --campo:#222220; --avviso:#1e2236; --avviso-err:#2e1d1d; --rosso:#e07a7a; --carta:#2a2926;
  color-scheme:dark;
}
/* Language switch (IT / EN) in the menu */
.nav a.lang-switch{display:inline-block;font-size:.78rem;font-weight:600;letter-spacing:.06em;line-height:1;padding:.32rem .45rem;border:1px solid var(--grafite);border-radius:3px;color:var(--carbone)}
.nav a.lang-switch:hover{border-color:var(--carbone);background:var(--gesso-2)}
@media (max-width:860px){.nav a.lang-switch{display:inline-block;margin-top:.9rem;padding:.4rem .6rem;font-size:.85rem;border:1px solid var(--grafite)}}
/* Lamp button at the end of the menu */
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;margin:-.35rem 0 -.35rem -.2rem;padding:0;background:none;border:0;border-radius:50%;color:var(--carbone);cursor:pointer;vertical-align:middle}
.theme-toggle:hover{background:var(--gesso-2)}
.theme-toggle svg{width:1.25rem;height:1.25rem}
.theme-toggle .glow{opacity:0;transition:opacity .3s ease}
:root[data-theme="dark"] .theme-toggle .glow{opacity:1}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .theme-toggle .glow{opacity:1}}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--gesso);color:var(--carbone);font-family:var(--text);font-weight:500;font-size:1.0625rem;line-height:1.65;font-optical-sizing:auto}
img{display:block;max-width:100%;height:auto}
a{color:var(--oltremare);text-decoration-thickness:1px;text-underline-offset:.18em}
a:hover{text-decoration-thickness:2px}
:focus-visible{outline:3px solid var(--oltremare);outline-offset:3px}
.skip{position:absolute;left:-999px;top:0;background:var(--carbone);color:var(--gesso);padding:.5rem 1rem;z-index:50}
.skip:focus{left:1rem;top:1rem}

/* Header */
.site-head{display:flex;align-items:baseline;justify-content:space-between;gap:1.5rem;padding:1.1rem var(--gutter);position:relative;z-index:5}
.brand{display:flex;align-items:baseline;gap:.7rem;color:var(--carbone);text-decoration:none}
.brand b{font-family:var(--display);font-weight:900;font-size:1.9rem;line-height:1;letter-spacing:-.01em}
.brand span{font-size:.95rem;color:var(--grafite)}
.nav ul{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:.35rem 1.4rem}
.nav a{color:var(--carbone);text-decoration:none;font-size:.95rem;padding:.2rem 0;border-bottom:1px solid transparent}
.nav a:hover{border-bottom-color:var(--carbone)}
.nav a[aria-current="page"]{border-bottom:2px solid var(--carbone)}
.nav-toggle{display:none;font:inherit;background:none;border:1px solid var(--carbone);color:var(--carbone);padding:.3rem .8rem;cursor:pointer}
/* Grouped menu: Eventi, About and Contatti open a small panel on hover, focus or click */
.nav > ul{align-items:center}
.has-sub{position:relative}
.sub-toggle{font:inherit;font-size:.95rem;background:none;border:0;border-bottom:1px solid transparent;padding:.2rem 0;color:var(--carbone);cursor:pointer;display:inline-flex;align-items:center;gap:.4rem}
.sub-toggle::after{content:"";width:.38em;height:.38em;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:translateY(-.2em) rotate(45deg);transition:transform .2s ease}
.has-sub.open > .sub-toggle::after{transform:translateY(.05em) rotate(-135deg)}
.sub-toggle:hover{border-bottom-color:var(--carbone)}
.has-sub.is-current > .sub-toggle{border-bottom:2px solid var(--carbone)}
.nav .sub{display:none;position:absolute;top:100%;left:-1rem;z-index:20;min-width:12.5rem;margin:0;padding:.4rem 0;flex-direction:column;gap:0;
  background:var(--gesso);border:1px solid var(--velatura);box-shadow:0 .7rem 1.6rem rgba(0,0,0,.14)}
.has-sub:hover > .sub,.has-sub:focus-within > .sub,.has-sub.open > .sub{display:flex}
.nav .sub a{display:block;padding:.5rem 1rem;border:0;white-space:nowrap}
.nav .sub a:hover{background:var(--gesso-2)}
.nav .sub a[aria-current="page"]{font-weight:700;border:0}
@media (max-width:860px){
  .nav-toggle{display:block}
  .site-head{flex-wrap:wrap;align-items:center}
  .nav{flex-basis:100%;display:none}
  .nav.open{display:block}
  .nav ul{flex-direction:column;align-items:stretch;gap:0;padding:.5rem 0 1rem}
  .nav a{display:block;padding:.6rem 0;font-size:1.15rem;border-bottom:1px solid var(--velatura)}
  .nav a[aria-current="page"]{border-bottom:1px solid var(--velatura);font-weight:600}
  /* On phones the groups are shown open, as a simple indented list */
  .sub-toggle{display:block;width:100%;text-align:left;padding:.9rem 0 .2rem;font-size:.85rem;letter-spacing:.06em;text-transform:uppercase;color:var(--grafite);border:0;cursor:default}
  .sub-toggle::after{display:none}
  .has-sub.is-current > .sub-toggle{border:0}
  .nav .sub{display:flex;position:static;min-width:0;padding:0;border:0;box-shadow:none;background:none}
  .nav .sub a{padding:.6rem 0 .6rem 1rem;border-bottom:1px solid var(--velatura);white-space:normal}
  .nav .sub a[aria-current="page"]{font-weight:600;border-bottom:1px solid var(--velatura)}
  .theme-toggle{margin:.8rem 0 0}
}

main{display:block}
.wrap{padding:0 var(--gutter)}

/* Home hero: paintings that cross-fade behind three connected 8s */
/* The band: a painting across the full width, seen only through three connected geometric 8s.
   It is fixed behind the page: the menu stays on top, and the rest of the homepage scrolls over
   it on a frosted sheet. Its height fills the screen below the menu (--head is the header height,
   set by site.js), leaving room for the painting's title, so the whole 888 shows on arrival. */
.home{--stage-h:min(max(calc(100svh - var(--head, 5rem) - 3.6rem), 18rem), 125vw)} /* 125vw keeps the 8s from getting too thin on phones */
.home .site-head{position:sticky;top:0;z-index:10;background:var(--gesso)}
.home .nav.open{max-height:calc(100svh - 4.5rem);overflow-y:auto}
.hero{height:var(--stage-h)} /* holds the place of the fixed band in the page flow */
.stage{
  position:fixed;z-index:0;left:0;right:0;top:var(--head, 5rem);
  height:var(--stage-h);overflow:hidden;background:var(--gesso-2);
}
/* Text over the 888: the content scrolls over the fixed band in the normal ink colours
   (position:relative keeps it above the band). */
.sheet,.home .site-foot{position:relative}
.sheet .hero-foot{padding-top:1rem;padding-bottom:1rem}
/* Once the text scrolls over the 888, the painting fades to a pale version of itself (site.js adds
   .dim) so the text stays readable. Raise or lower the .72 to taste. */
.stage::after{content:"";position:absolute;inset:0;background:var(--gesso);opacity:0;transition:opacity .9s ease;pointer-events:none}
.stage.dim::after{opacity:.72}
.home .site-foot{margin-top:0}
.stage .paint{
  position:absolute;inset:-2%;opacity:0;
  background-size:cover;background-position:50% 50%;
  transition:opacity 2.4s ease-in-out;
  animation:drift 38s ease-in-out infinite alternate;
}
.stage .paint.on{opacity:1}
.veil{position:absolute;inset:-1px;width:calc(100% + 2px);height:calc(100% + 2px);display:block;
  fill:var(--gesso)}
@keyframes drift{from{background-position:30% 40%}to{background-position:70% 60%}}
@media (prefers-reduced-motion:reduce){.stage .paint{animation:none;transition-duration:1.2s}}
.hero-foot{display:flex;justify-content:center;align-items:baseline;gap:.4rem 1.4rem;flex-wrap:wrap;text-align:center;min-height:2rem;padding:0 var(--gutter)}
.work-label{margin:0;font-size:1rem;transition:opacity .6s ease}
.work-label.fade{opacity:0}
.work-label i{font-size:1.2rem}
.work-label span{color:var(--grafite)}
.swap{font:inherit;font-size:.85rem;background:none;border:0;border-bottom:1px solid var(--grafite);padding:0 0 .1rem;color:var(--grafite);cursor:pointer}
.swap:hover{color:var(--carbone);border-bottom-color:var(--carbone)}

.intro{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr);gap:1.5rem var(--gutter);padding:4rem var(--gutter) 3rem;border-top:1px solid var(--velatura)}
.intro p{margin:0 0 1em;font-size:1.2rem;line-height:1.55}
.intro .prose p:last-child{margin-bottom:0}
.intro .who{font-family:var(--display);font-weight:800;font-size:2.4rem;line-height:1;margin:0}
@media (max-width:700px){.intro{grid-template-columns:1fr;padding-top:2.5rem}.intro p{font-size:1.1rem}}

/* Home: index of sections */
.index{padding:0 var(--gutter) 3rem}
.index ul{list-style:none;margin:0;padding:0;border-top:1px solid var(--velatura)}
.index li{border-bottom:1px solid var(--velatura)}
.index a{display:flex;align-items:baseline;justify-content:space-between;gap:.3rem 2rem;flex-wrap:wrap;padding:1rem 0;color:var(--carbone);text-decoration:none}
.index b{font-family:var(--display);font-weight:800;font-size:clamp(2rem,5vw,3.4rem);line-height:1;transition:transform .25s ease}
.index span{color:var(--grafite);font-size:1rem}
.index a:hover b{transform:translateX(.4rem);color:var(--oltremare)}
.index a:hover span{color:var(--carbone)}

/* Page titles */
.page-title{font-family:var(--display);font-weight:900;font-size:clamp(3.4rem, 11vw, 9rem);line-height:.86;letter-spacing:-.02em;margin:2rem 0 0;padding:0 var(--gutter)}
.page-lede{max-width:var(--measure);margin:1.2rem 0 0;padding:0 var(--gutter);color:var(--grafite);font-size:1.1rem}
.section-title{font-family:var(--display);font-weight:800;font-size:2.4rem;line-height:1;margin:0 0 1.2rem}

/* Gallery: works hung like a wall, label beneath each */
.wall{columns:3 18rem;column-gap:clamp(1.5rem,3.5vw,3rem);padding:3rem var(--gutter) 2rem}
.work{break-inside:avoid;margin:0 0 clamp(2rem,4vw,3.2rem)}
.work button{display:block;width:100%;padding:0;border:0;background:var(--wc,#ccc);cursor:zoom-in}
.work img{width:100%}
.work figcaption{margin-top:.6rem;font-size:.92rem;line-height:1.4}
.work figcaption i{font-size:1.08rem}
.work figcaption span{display:block;color:var(--grafite)}
.home-wall{padding-top:2rem}
.more{padding:0 var(--gutter) 3rem}
.more a{font-size:1.1rem}

/* Exhibitions timeline: the content is chronological, so the years lead */
.shows{padding:2.5rem var(--gutter) 3rem}
.show{display:grid;grid-template-columns:minmax(6rem,11rem) minmax(0,1fr);gap:0 var(--gutter);padding:2.2rem 0;border-top:1px solid var(--velatura)}
.show .year{font-family:var(--display);font-weight:900;font-size:clamp(3rem,7vw,5.5rem);line-height:.85;margin:0;position:sticky;top:1rem;align-self:start;color:var(--grafite)}
.show h2{font-family:var(--display);font-weight:800;font-size:clamp(2rem,4.5vw,3.2rem);line-height:.95;margin:0}
.show .when{margin:.5rem 0 0;color:var(--grafite)}
.show .note{margin:.8rem 0 0;max-width:var(--measure)}
.strip{display:flex;gap:.8rem;overflow-x:auto;margin-top:1.4rem;padding-bottom:.8rem;scroll-snap-type:x proximity;scrollbar-width:thin}
.strip button{flex:0 0 auto;padding:0;border:0;background:var(--wc,#ccc);cursor:zoom-in;scroll-snap-align:start}
.strip img{height:clamp(9rem,22vw,15rem);width:auto}
@media (max-width:700px){.show{grid-template-columns:1fr}.show .year{position:static;margin-bottom:.6rem;font-size:3rem}}

/* Press */
.press{display:grid;grid-template-columns:repeat(auto-fill,minmax(14rem,1fr));gap:clamp(1.5rem,3vw,2.5rem);padding:3rem var(--gutter);align-items:start}
.press button{display:block;width:100%;padding:0;border:0;background:var(--carta);cursor:zoom-in}
.press figcaption{margin-top:.5rem;font-size:.9rem;color:var(--grafite)}
.press figure{margin:0}

/* Text pages */
.prose{max-width:var(--measure)}
.prose p{margin:0 0 1.1em}
.prose strong{font-weight:700}
.split{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.4fr);gap:2.5rem var(--gutter);padding:3rem var(--gutter)}
.split aside{position:sticky;top:1.5rem;align-self:start}
.split aside figcaption{font-size:.9rem;color:var(--grafite);margin-top:.5rem}
.split aside figure{margin:0}
@media (max-width:820px){.split{grid-template-columns:1fr}.split aside{position:static;max-width:26rem}}
.voices{padding:1rem var(--gutter) 4rem}
.voices h2{font-family:var(--display);font-weight:800;font-size:clamp(2.4rem,6vw,4rem);line-height:.9;margin:3rem 0 1.5rem}
.quote{margin:0 0 2.5rem;max-width:44rem}
.quote p{margin:0;font-size:clamp(1.25rem,2.4vw,1.65rem);line-height:1.42}
.quote.big p{font-size:clamp(1.7rem,3.6vw,2.6rem);line-height:1.25;font-style:italic}
.quote footer{margin-top:.7rem;color:var(--grafite)}

/* Forms */
.form{display:grid;gap:1.1rem;max-width:32rem}
.form label{display:grid;gap:.3rem;font-size:.95rem}
.form input,.form textarea{font:inherit;padding:.65rem .75rem;border:1px solid var(--grafite);background:var(--campo);color:var(--carbone);border-radius:0}
.form textarea{min-height:9rem;resize:vertical}
.form .hp{position:absolute;left:-5000px}
.btn{justify-self:start;font:inherit;font-weight:600;padding:.7rem 1.5rem;background:var(--carbone);color:var(--gesso);border:0;cursor:pointer}
.btn:hover{background:var(--oltremare)}
.notice{padding:.8rem 1rem;border-left:4px solid var(--oltremare);background:var(--avviso);max-width:32rem}
.notice.err{border-left-color:var(--rosso);background:var(--avviso-err)}

/* Footer */
.site-foot{margin-top:2rem;padding:2rem var(--gutter) 2.5rem;border-top:1px solid var(--velatura);display:flex;flex-wrap:wrap;gap:1rem 3rem;justify-content:space-between;font-size:.92rem;color:var(--grafite)}
.site-foot p{margin:0}
.site-foot a{color:var(--grafite)}

/* Lightbox */
.lb{position:fixed;inset:0;background:rgba(20,20,19,.96);display:none;z-index:100;color:#e8e8e4}
.lb.open{display:grid;grid-template-rows:1fr auto}
.lb figure{margin:0;display:grid;place-items:center;padding:3.5rem 4.5rem 0;min-height:0}
.lb img{max-height:calc(100vh - 8rem);max-width:100%;width:auto;object-fit:contain}
.lb .cap{padding:1rem 4.5rem 1.4rem;text-align:center;font-size:.95rem}
.lb .cap i{font-size:1.15rem}
.lb button{position:absolute;background:none;border:0;color:#e8e8e4;font:inherit;font-size:2rem;cursor:pointer;padding:.6rem 1rem;line-height:1}
.lb .x{top:.5rem;right:.6rem}
.lb .prev{left:.4rem;top:50%;transform:translateY(-50%)}
.lb .next{right:.4rem;top:50%;transform:translateY(-50%)}
.lb .count{position:absolute;top:1.1rem;left:1.4rem;font-size:.9rem;color:#a9a9a3}
@media (max-width:600px){.lb figure{padding:3.5rem .5rem 0}.lb .cap{padding:1rem 1rem 1.2rem}.lb .prev,.lb .next{top:auto;bottom:.4rem;transform:none}}
.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
