/* The Analog Studio — shared styles for the project pages.
   Header = same as the home page (sticky navy bar, language switch, accent #69BCDC on hover).
   Below 900px the pages stop being scaled from 1440px and switch to the mobile layout at the bottom. */
:root { --ink: #121528; --paper: #f5f5f5; --accent: #69bcdc; --muted: #a4a8c4; --gutter: clamp(16px, 5vw, 72px); color-scheme: dark; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; background: var(--ink); }
body { overflow-x: clip !important; -webkit-font-smoothing: antialiased; font-family: "Hanken Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif; }
::selection { background: var(--accent); color: var(--ink); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
section, footer { scroll-margin-top: 3.5rem; }

/* Header */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: 0.35rem 1.25rem; background: var(--ink); color: var(--paper);
  padding-block: clamp(0.9rem, 2.6vw, 2rem);
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  font-size: clamp(1rem, 0.9rem + 0.45vw, 1.3rem); font-weight: 500; letter-spacing: -0.01em; line-height: 1.4;
}
.top a { color: inherit; text-decoration: none; }
.top .side { display: flex; align-items: baseline; gap: 0.5rem 1.5rem; flex-wrap: wrap; }
.top .side { align-items: center; }
.top .brand { display: block; line-height: 0; }
.top .brand svg { display: block; height: clamp(2.1rem, 4.6vw, 2.9rem); width: auto; }
.top nav { display: flex; flex-wrap: wrap; gap: 0.25rem clamp(1rem, 3.2vw, 3.5rem); }
.top nav a { padding: 0.55rem 0.2rem; margin: -0.55rem -0.2rem; }
.top nav a:hover, .top .brand:hover { color: var(--accent); }
.top nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 0.09em; text-underline-offset: 0.3em; }
.lang { display: flex; align-items: baseline; gap: 0.35rem; color: var(--muted); }
.lang button { font: inherit; letter-spacing: inherit; color: var(--muted); background: none; border: 0; padding: 0.55rem 0.3rem; margin: -0.55rem -0.3rem; cursor: pointer; }
.lang button:hover { color: var(--accent); }
.lang button[aria-pressed="true"] { color: var(--paper); text-decoration: underline; text-underline-offset: 0.25em; }

/* hero titles: keep descenders (g, j, p) visible inside the reveal mask */
.mask { font-size: 210px; padding-bottom: 0.26em !important; margin-bottom: -0.26em; }

/* Footer + dark-section links pick up the accent */
#contatti a:hover, #root a.ul:hover { color: var(--accent); }
#contatti .ul { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 0.07em; text-underline-offset: 0.12em; background: none; }
#contatti .ul:hover { color: var(--accent); }

/* ------------------------------------------------------------------ mobile */
@media (max-width: 899px) {
  #root { zoom: 1 !important; width: 100% !important; max-width: 100% !important; overflow-x: clip; }
  #root * { min-width: 0; }
  .mask { font-size: 17.5vw; }
  #root img { max-width: 100%; }

  /* stack every grid; keep small label/value grids */
  #root [style*="grid-template-columns"]:not([style*="auto 1fr"]) { grid-template-columns: minmax(0, 1fr) !important; }
  #root [style][style*="repeat(5,"], #root [style][style*="repeat(4,"], #root [style][style*="repeat(6,"]  { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #root [style][style*="repeat(12,"] { grid-template-columns: minmax(0, 1fr) !important; }
  #root [style*="grid-column"], #root [style*="grid-row"] { grid-column: auto !important; grid-row: auto !important; }
  #root [style*="gap: 88px"], #root [style*="gap: 80px"], #root [style*="gap: 72px"], #root [style*="gap: 64px"] { gap: 40px !important; }

  /* sections: comfortable gutters instead of 48px / 128px */
  #root section > div[style*="padding"], #root footer > div[style*="padding"] { padding-left: 20px !important; padding-right: 20px !important; padding-top: clamp(56px, 14vw, 88px) !important; padding-bottom: clamp(48px, 12vw, 72px) !important; }
  #root section[id="top"][style*="height"] { height: auto !important; min-height: 0 !important; padding: 0 20px 32px !important; gap: 40px; }
  #root section[id="top"][style*="height"] > div:first-child { min-height: 30vh; padding-top: 16px; }
  #root .hero-left { padding: 28px 20px 36px !important; gap: 36px !important; }
  #root [style*="min-height"] { min-height: 0 !important; }
  #root section#top[style*="grid-template-columns"] > div:last-child { min-height: min(118vw, 560px) !important; }
  #root [style*="max-width: 420px"], #root [style*="max-width: 460px"], #root [style*="max-width: 520px"], #root [style*="max-width: 640px"], #root [style*="max-width: 440px"], #root [style*="max-width: 1100px"] { max-width: 100% !important; }

  /* big type scales with the viewport (design sizes 1440px) */
  #root [style*="font-size: 210px"] { font-size: 17.5vw !important; }
  #root [style*="font-size: 190px"] { font-size: 16vw !important; }
  #root [style*="font-size: 124px"] { font-size: 15vw !important; }
  #root [style*="font-size: 118px"] { font-size: 17vw !important; }
  #root [style*="font-size: 72px"]  { font-size: 9.5vw !important; }
  #root [style*="font-size: 110px"] { font-size: 13.5vw !important; }
  #root [style*="font-size: 108px"] { font-size: 13vw !important; }
  #root [style*="font-size: 92px"]  { font-size: 11.5vw !important; }
  #root [style*="font-size: 86px"]  { font-size: 11vw !important; }
  #root [style*="font-size: 78px"]  { font-size: 10vw !important; }
  #root [style*="font-size: 64px"]  { font-size: 9vw !important; }
  #root [style*="font-size: 63px"]  { font-size: 8.4vw !important; }
  #root [style*="font-size: 60px"]  { font-size: 8.4vw !important; }
  #root [style*="font-size: 54px"]  { font-size: 8vw !important; }
  #root [style*="font-size: 44px"]  { font-size: 7.4vw !important; }
  #root [style*="font-size: 40px"]  { font-size: 7vw !important; }
  #root [style*="font-size: 36px"]  { font-size: 6.6vw !important; }
  #root [style*="font-size: 26px"]  { font-size: 5.6vw !important; }
  #root footer a.ul[style*="font-size"] { font-size: clamp(1.15rem, 6.2vw, 2rem) !important; }
  #root p[style*="font-size: 22px"], #root p[style*="font-size: 20px"], #root p[style*="font-size: 19px"], #root p[style*="font-size: 18px"] { font-size: 17px !important; }

  #root div[style*="min-height"]:has(> img[style*="position: absolute"]) { min-height: min(110vw, 560px) !important; }
  #root div[style*="padding: 86px"] { padding: 48px 20px !important; }
  #root [style][style][style*="gap: 72px 28px"] { grid-template-columns: minmax(0, 1fr) !important; gap: 48px !important; }
  /* collages with fixed sizes */
  #root figure[style*="width: 230px"] { width: 40vw !important; }
  #root div[style*="height: 420px"] { height: 340px !important; }
  #root figure.rv-tilt, #root figure.lift { margin: 0 !important; }
  #root [style*="margin: 0 0 0 30%"] { margin-left: 12% !important; }

  /* galleries, strips and the flipbook */
  #root .gal > * { flex: 0 0 78vw !important; }
  #root .gal { padding-left: 20px !important; scroll-padding-left: 20px !important; }
  #root .navbtn { width: 44px !important; height: 44px !important; }
  #root [style*="width: 340px"][style*="height: 472px"] { width: 62vw !important; height: calc(62vw * 1.388) !important; }

  #root .book { width: 100% !important; height: auto !important; aspect-ratio: 1100 / 763; }
  #root .book-wrap { margin-inline: -8px; width: calc(100% + 16px) !important; }
  #root #sfoglia nav { justify-content: flex-start !important; max-width: 100% !important; }
  #root #sfoglia [style*="width: 56px"] { width: 44px !important; height: 44px !important; }
  #root a.next > div { padding: 40px 20px !important; }
  #root a.next span[style*="align-items: flex-end"] { align-items: flex-start !important; text-align: left !important; }

  /* anything laid out in a row of big blocks may wrap */
  #root [style*="justify-content: space-between"][style*="align-items: flex-end"],
  #root [style*="justify-content: space-between"][style*="align-items: baseline"] { flex-wrap: wrap; gap: 16px !important; }
  #root footer [style*="repeat(4,"] { font-size: 15px !important; }
}
