/* ============================================================
   Atomic Imagery — MOBILE (<=760px)
   Additive and page-scoped (.pg-atomic). Nothing here affects
   the other pages. Load AFTER css/style.css, e.g.

     <link rel="stylesheet" href="css/style.css" />
     <link rel="stylesheet" href="css/atomic-mobile.css" />

   (or paste the whole block at the end of css/style.css —
   it is a strict superset, nothing is removed.)

   `!important` appears only where the desktop page carries an
   INLINE style on the same property. If you strip those inline
   styles from atomic-imagery.html, drop the !important too.
   ============================================================ */

@media (max-width: 760px) {

  /* ---------- nav ---------- */
  .pg-atomic .nav { height: 54px; padding: 0 var(--gutter); }
  .pg-atomic .nav.solid { padding-block: 0; }
  .pg-atomic .nav__brand { font-size: 15px; }
  .pg-atomic .nav__links { gap: 4px; font-size: 14px; }
  .pg-atomic .nav__links a { padding: 16px 8px; }
  .pg-atomic .nav__links a:last-child { padding-right: 0; }
  /* the progress hairline is always on, on mobile */
  .pg-atomic .nav .nav__progress { opacity: .9; }
  /* il DC tiene la nav sempre su fondo carta: sotto i 760px la cover
     parte a 22px e passerebbe sotto una nav trasparente */
  .pg-atomic .nav {
    background: var(--paper-85);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }

  /* ---------- cover: 4/3 crop, no side bands, thin paper margin ---------- */
  /* l'About chiudeva il blocco senza margine: la striscia di immagini
     dentro la stessa sezione partiva attaccata all'ultima riga di testo */
  .pg-atomic .intro-2 .fbs { margin-top: 26px; }
  .pg-atomic .cover { padding-top: 22px; }
  .pg-atomic .cover__frame { margin-inline: 3.33%; }
  .pg-atomic .caster { aspect-ratio: 4 / 3; }
  .pg-atomic .cover__band { display: none; }
  .pg-atomic .caster__name {
    left: 6% !important; right: auto !important; top: 13% !important;
    font-size: 12px;
  }

  /* ---------- title + meta ---------- */
  .pg-atomic .case-head--after { padding-top: 34px; }
  .pg-atomic .case-head { padding-bottom: 0; }
  .pg-atomic .case-head__title { font-size: 38px; letter-spacing: -0.028em; }
  .pg-atomic .case-meta {
    grid-template-columns: 1fr 1fr; gap: 20px;
    padding-top: 22px; margin-top: 30px;
  }
  .pg-atomic .case-meta__desc { grid-column: 1 / -1; }
  .pg-atomic .case-meta dd { font-size: 16px; }
  .pg-atomic .case-meta__desc dd { margin-top: 0; }

  /* ---------- rhythm + type ---------- */
  .pg-atomic .section { padding-block: 64px 0; }
  .pg-atomic .split { gap: 18px; }
  .pg-atomic .h2 { font-size: 26px; line-height: 1.06; margin-bottom: 18px; }
  .pg-atomic .prose { font-size: 16px !important; line-height: 1.55; max-width: none; }
  .pg-atomic .section-label { font-size: 11px; }

  /* ---------- full-bleed slideshow: 1/1 crop, thin paper margin ----------
     The container is slightly shorter than it is wide so the inset slide
     stays exactly square: the tag percentages below are unchanged.
     Tags were RE-EYEBALLED on the square crop, not converted
     arithmetically: each one sits on a flat area of the right
     value, outside the subject. Do not "restore" the desktop
     percentages here. */
  .pg-atomic .fbs { aspect-ratio: 100 / 93.34; }
  .pg-atomic .fbs__tag { font-size: 13px; }

  .pg-atomic .fbs__slide:nth-child(1) img { object-position: 42% center; }
  .pg-atomic .fbs__slide:nth-child(2) img { object-position: 68% center; }
  .pg-atomic .fbs__slide:nth-child(3) img { object-position: center; }

  /* slide 1 — shaving */
  .pg-atomic .fbs__slide:nth-child(1) .fbs__tag:nth-of-type(1) { left: 70% !important; top: 11% !important; }  /* <liam>     white tile, right of the face */
  .pg-atomic .fbs__slide:nth-child(1) .fbs__tag:nth-of-type(2) { left: 11% !important; top: 60% !important; color: #111; } /* <razor>  light panel, left of the razor */
  .pg-atomic .fbs__slide:nth-child(1) .fbs__tag:nth-of-type(3) { left: 78% !important; top: 70% !important; }  /* <bathroom> white tile, bottom right */

  /* slide 2 — laundromat */
  .pg-atomic .fbs__slide:nth-child(2) .fbs__tag:nth-of-type(1) { left: 88% !important; top: 10% !important; }  /* <noah>     white wall */
  .pg-atomic .fbs__slide:nth-child(2) .fbs__tag:nth-of-type(2) { left: 12% !important; top: 88% !important; }  /* <laundry>  on the pile (already --light) */

  /* slide 3 — e-bike */
  .pg-atomic .fbs__slide:nth-child(3) .fbs__tag:nth-of-type(1) { left: 44% !important; top: 29% !important; }  /* <giorgio>  studio background */
  .pg-atomic .fbs__slide:nth-child(3) .fbs__tag:nth-of-type(2) { left: 60% !important; top: 85.5% !important; color: #fff; } /* <ebike> on the black frame */

  /* ---------- diagrams: swap desktop SVG for the mobile one ---------- */
  .pg-atomic .is-desktop { display: none !important; }
  .pg-atomic .is-mobile { display: block; }

  .pg-atomic .forge { max-width: none !important; margin: 40px 0 0 !important; }
  .pg-atomic .forge svg { width: 100% !important; height: auto !important; margin-inline: 0 !important; }

  /* forge mobile (#atomForgeM): stesso wireframe del desktop, misure sue.
     Il vecchio recombiner (sec-recomb) e' stato rimosso dal markup il 31/08. */
  .pg-atomic #atomForgeM .fg-t { font-size: 13px; }
  .pg-atomic #atomForgeM .fg-idx { font-size: 9.5px; }
  .pg-atomic #atomForgeM .fg-tile--hatch { fill: url(#fgHatchM); }
  .pg-atomic #atomForgeM .fg-link { stroke-dasharray: 1.2 7; }

  /* ---------- animated prompt: reflowed rows ---------- */
  .pg-atomic .pf { margin-top: 30px; }
  .pg-atomic .pf__bar { padding: 10px 14px; gap: 6px; }
  .pg-atomic .pf__dot { width: 8px; height: 8px; }
  .pg-atomic .pf__name { font-size: 10px; margin-left: 6px; }
  .pg-atomic .pf__variant { font-size: 9px; letter-spacing: 0.16em; }

  /* ---------- style gallery: swipe, arrows below, no counter ---------- */
  .pg-atomic .sg,
  .pg-atomic .styles .sg { max-width: none; display: flex; flex-direction: column; }
  /* the frame takes the whole band, edge to edge */
  .pg-atomic .styles .sg__stage { width: 100vw; margin-left: calc(50% - 50vw); }
  .pg-atomic .sg__stage { order: 1; border: 0; touch-action: pan-y; }
  .pg-atomic .sg__bar { order: 2; margin: 16px 0 0; align-items: flex-start; gap: 16px; }
  .pg-atomic .sg__dots { display: none; }          /* counter a trattini: via */
  .pg-atomic .sg__count { display: none; }
  .pg-atomic .sg__tag { flex: 1; font-size: 12px; }
  .pg-atomic .sg__tag em { margin-top: 5px; font-size: 14px; line-height: 1.35; }
  .pg-atomic .sg__nav { gap: 2px; margin-top: -10px; }
  .pg-atomic .sg__btn { border: 0; background: transparent; }   /* niente quadrato */
  .pg-atomic .sg__btn:hover { background: transparent; border: 0; color: var(--ink); }
  .pg-atomic .sg__btn svg { width: 17px; height: 17px; stroke-width: 1.4; }

  /* ---------- closing blocks ---------- */
  .pg-atomic .mantra { margin-top: 64px; padding-block: 56px; }
  .pg-atomic .mantra p { font-size: 29px; line-height: 1.2; }
  .pg-atomic .next { padding-block: 52px; }
  .pg-atomic .next a { justify-content: space-between; gap: 16px; }
  .pg-atomic .next__title { font-size: 34px; }
  .pg-atomic .next__arrow { font-size: 30px; }
  .pg-atomic .footer { padding-block: 34px 40px; }
}

/* ============================================================
   Mobile-only modules — visible only under 760px.
   Kept outside the media query so the rules are readable;
   the elements themselves are display:none above 760px.
   ============================================================ */

@media (min-width: 761px) { .pg-atomic .is-mobile { display: none !important; } }

/* ---- mobile diagram primitives (m-*) ----
   Same drawing rules as desktop: hairline --line outlines, --bg-2 fills,
   45deg hatch on empty slots, hollow --muted ports, mono type muted with
   --ink reserved for the result. */
.pg-atomic .m-flow  { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 1.5 9; stroke-linecap: round; animation: m-flow 1.05s linear infinite; }
.pg-atomic .m-tile  { fill: var(--bg-2); stroke: var(--line); stroke-width: 1; }
.pg-atomic .m-hatch { fill: url(#mHatch); }
.pg-atomic .m-out   { stroke: var(--line); stroke-width: 1; }
.pg-atomic .m-port  { fill: var(--bg); stroke: var(--muted); stroke-width: 1; }
.pg-atomic .m-ico   { fill: none; stroke: var(--muted); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.pg-atomic .m-t     { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 15px; fill: var(--muted); }
.pg-atomic .m-t--out{ fill: var(--ink); }
.pg-atomic .m-ts    { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 11px; fill: var(--muted); }
.pg-atomic .m-idx   { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 10px; letter-spacing: 0.12em; fill: var(--muted); }
.pg-atomic .m-layer { transition: opacity .32s var(--ease); }
@keyframes m-flow { to { stroke-dashoffset: -21; } }
@media (prefers-reduced-motion: reduce) {
  .pg-atomic .m-flow { animation: none; }
  .pg-atomic .m-layer { transition: none; }
}

/* ---- mobile prompt rows ---- */
.pg-atomic .pf__rows {
  padding: 16px 14px 18px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11.5px; line-height: 1.65; color: var(--muted);
}
.pg-atomic .pf__row { display: flex; gap: 6px; padding-left: 8px; }
.pg-atomic .pf__row--in { padding-left: 18px; }
.pg-atomic .pf__k { flex: 0 0 58px; }
.pg-atomic .pf__row--in .pf__k { flex: 0 0 48px; }
.pg-atomic .pf__rows .pf__v { flex: 1; min-height: 1.65em; color: var(--ink); }

/* ---- governance carousel (three main features) ---- */
.pg-atomic .pillcar { margin-top: 54px; }
.pg-atomic .pillcar__track {
  display: flex; overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.pg-atomic .pillcar__track::-webkit-scrollbar { display: none; }
.pg-atomic .pillcar__card {
  flex: 0 0 100%; scroll-snap-align: center; margin: 0;
  padding: 0 var(--gutter); min-height: 330px;
  border-top: 1px solid var(--line);
}
.pg-atomic .pillcar__n {
  display: block; padding-top: 14px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11px; letter-spacing: 0.16em; color: var(--muted);
}
.pg-atomic .pillcar__ico {
  display: block; width: 64px; height: 64px; margin: 38px 0 34px;
  fill: none; stroke: var(--muted); stroke-width: 1;
  stroke-linecap: round; stroke-linejoin: round;
}
.pg-atomic .pillcar__card dt {
  font-size: 30px; font-weight: 400; letter-spacing: -0.024em;
  line-height: 1.05; margin-bottom: 14px;
}
.pg-atomic .pillcar__card dd {
  margin: 0; font-size: 16px; line-height: 1.55;
  color: var(--ink-soft); max-width: 30ch;
}
/* il numero in cima alla card resta come spaziatore ma non si legge */
.pg-atomic .pillcar__n { visibility: hidden; }
.pg-atomic .pillcar__nav {
  display: flex; justify-content: center; gap: 10px; margin: 26px 0 0;
}
.pg-atomic .pillcar__nav button {
  width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%;
  background: var(--line); font-size: 0; color: transparent;
  cursor: pointer; transition: background .35s var(--ease);
}
.pg-atomic .pillcar__nav button.is-on { background: var(--ink); }
/* staged entrance: JS adds .is-on to the active card */
.pg-atomic .pillcar [data-pa] {
  opacity: 0; transform: translateY(14px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.pg-atomic .pillcar__card.is-on [data-pa] { opacity: 1; transform: none; }
.pg-atomic .pillcar__card.is-on [data-pa="1"] { transition-delay: 0s; }
.pg-atomic .pillcar__card.is-on [data-pa="2"] { transition-delay: .1s; }
.pg-atomic .pillcar__card.is-on [data-pa="3"] { transition-delay: .2s; }
@media (prefers-reduced-motion: reduce) {
  .pg-atomic .pillcar [data-pa] { opacity: 1; transform: none; transition: none; }
}
