/* ------------------------------ 03: the dream -----------------------------
   A small form under the 03 copy: name, e-mail, a box to draw or write in,
   the GDPR tick and Send. The box is driven by dream-box.js. Measures are
   the 390px mockups' (Sezione 3: 1.pdf at rest, 2.pdf drawing, 3.pdf
   writing), 1px a unit.

   While the box is in use 03 (and the fog into the reel) is #333, with the
   pinned 01 and 02 bars; touching outside brings it all back to white.
   Everything that changes is a token on .dream-scope, so the switch is one
   class on <html>. */

/* The ground fades both ways in 0.4s. */
html {
  --dream-fade: 0.4s;
}

/* 01's white sheet comes up over the showreel with rounded corners. */
.home-main {
  border-radius: 8px 8px 0 0;
}

.dream-scope {
  --dream-rule: rgba(51, 51, 51, 0.45);
  --dream-line: #333333;
  --dream-sheet: rgba(51, 51, 51, 0.135);   /* #D9D9D9 on the page */
  --dream-chip: rgba(51, 51, 51, 0.115);    /* #C6C6C6 on the sheet */
  --dream-hint: #333333;
  --dream-ruled: rgba(51, 51, 51, 0.5);
  --dream-placeholder: rgba(51, 51, 51, 0.65);
  --dream-edge: rgba(51, 51, 51, 0);
  --dream-alert: #8F12FE;
  transition: background-color var(--dream-fade) var(--ease);
}

/* 2026-11-16, lui, guardando il desktop: "nella box interagibile della
   sezione 03, nel desktop, quella linea di testo è troppo scura, deve essere
   in trasparenza come l'altra linea di testo che esce precedentemente".
   L'altra linea è il placeholder della modalità scrittura, che sta al 65%:
   qui l'invito prende la stessa trasparenza. Solo da 900 in su, perché sul
   telefono non l'ha chiesto e lì il foglio è più piccolo. Sul fondo scuro
   erano già uguali. */
@media (min-width: 900px) {
  .dream-scope { --dream-hint: rgba(51, 51, 51, 0.65); }
}

html.dream-dark .dream-scope {
  --bg: #333333;
  --ink: #f3f3f3;
  --ink-soft: #f3f3f3;
  --dream-rule: rgba(243, 243, 243, 0.45);
  --dream-line: #f3f3f3;
  --dream-sheet: #222222;
  --dream-chip: #333333;
  --dream-hint: rgba(243, 243, 243, 0.65);
  --dream-ruled: rgba(243, 243, 243, 0.5);
  --dream-placeholder: rgba(243, 243, 243, 0.65);
  --dream-edge: rgba(243, 243, 243, 0.3);
  --dream-alert: #90FE11;
  background-color: var(--bg);
}

/* The 40px above the 03 numeral is its bar's margin, which collapses out
   of the chapter and so would stay white over the dark ground. Held as
   padding instead it is inside 03 and goes dark with it; the layout does
   not move. */
.chapter.dream-scope {
  padding-top: 40px;
}

.chapter.dream-scope > .chapter-bar {
  margin-top: 0;
}

/* The bars and the copy pick the new tokens up on their own; these only
   make the change a fade instead of a cut. */
.dream-scope .chapter-bar,
.dream-scope .section-title,
.dream-scope .hs-copy,
.dream-scope isola-morph-num {
  transition: background-color var(--dream-fade) var(--ease), color var(--dream-fade) var(--ease);
}

.dream-scope .chapter-rule {
  border-top-color: var(--dream-rule);
  transition: margin 0.45s var(--ease-enter), border-color var(--dream-fade) var(--ease);
}

/* The 01 and 02 numerals stacked at the top go dark with 03: only their
   pinned bars and rules, never the chapters themselves. The dark state
   only holds while 02 has gone up under the stack, so these are always
   the pinned ones when it applies. */
.chapter[style*="--ch:0"] > .chapter-bar,
.chapter[style*="--ch:1"] > .chapter-bar,
.chapter[style*="--ch:0"] > .chapter-bar isola-morph-num,
.chapter[style*="--ch:1"] > .chapter-bar isola-morph-num {
  transition: background-color var(--dream-fade) var(--ease), color var(--dream-fade) var(--ease);
}

.chapter[style*="--ch:0"] > .chapter-rule,
.chapter[style*="--ch:1"] > .chapter-rule {
  transition: margin 0.45s var(--ease-enter), border-color var(--dream-fade) var(--ease);
}

html.dream-dark .chapter[style*="--ch:0"] > .chapter-bar,
html.dream-dark .chapter[style*="--ch:1"] > .chapter-bar {
  --ink: #f3f3f3;
  background: #333333;
}

html.dream-dark .chapter[style*="--ch:0"] > .chapter-rule,
html.dream-dark .chapter[style*="--ch:1"] > .chapter-rule {
  border-top-color: rgba(243, 243, 243, 0.45);
  --chapter-rule-c: rgba(243, 243, 243, 0.45);
}

.dream-scope .show-intro-tide svg {
  transition: fill var(--dream-fade) var(--ease);
}

/* Every purple mark in 03 goes green on the dark ground. Only the visible
   strokes carry the purple fill; the masks that reveal them are white and
   must be left alone. */
.dream-scope .draw use[fill="#8F12FE"] {
  transition: fill var(--dream-fade) var(--ease);
}

html.dream-dark .dream-scope .draw use[fill="#8F12FE"] {
  fill: #90FE11;
}

/* While the box is in use the page holds still under it. */
html.dream-lock {
  overflow: hidden;
  overscroll-behavior: none;
}

/* Once <html> clips, the body's own overflow-x stops passing up to the
   window and makes the body a scroller of its own, which unpins every
   sticky numeral. <html> already clips the sides. */
html.dream-lock body {
  overflow: visible;
}

/* ---- Heading ---- */

/* The 03 notebook used to close the section; the form now does. 87px from
   the copy's last baseline to the heading's first (Frame 4). */
.dream {
  position: relative;
  margin-top: 56px;
}

/* Frame 4 sets this heading 32/33, closer than the site's other section
   titles. */
.dream-title {
  line-height: 33px;
}

/* On the dark ground "authentic dream" turns white with the rest of the
   heading, then green sweeps across it from left to right as soon as the
   ground has settled. The words are painted with a half green, half white
   gradient twice their width, clipped to the letters, which slides from its
   white half to its green half: a hard edge running across, no fade. */
html.dream-dark .dream-scope .dream-title em {
  color: transparent;
  background: linear-gradient(90deg, #90FE11 50%, #f3f3f3 50%) 100% 0 / 200% 100% no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  animation: dream-green 0.45s var(--ease) 0.4s forwards;
}

@keyframes dream-green {
  from { background-position: 100% 0; }
  to   { background-position: 0 0; }
}

/* ---- Name and e-mail: written on a line ---- */

/* Each label sits on its line: 10px mono, the line 18px after it, 0.75px,
   27px from one line to the next, the first 39px under the heading's last
   baseline. */
.dream-fields {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.dream-field {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  color: var(--ink);
}

.dream-label {
  flex: none;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 12px;
  white-space: nowrap;
  transition: color 0.3s var(--ease);
}

/* What is typed shows at 12px. The field itself is set at 16px — anything
   smaller makes iOS zoom the page on focus — and scaled down by 3/4, which
   also brings its 1px rule to the mockup's 0.75. */
.dream-input {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 15px;
  /* Lifts the line from the bottom of the label's box to its baseline. */
  margin-bottom: 3px;
}

.dream-input input {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 133.333%;
  /* 6px more under the text (8 at this scale) and as much taller, so the
     line stays on the label's baseline and the text lifts off it
     (the user, 2026-11-12). */
  height: 26px;
  margin: 0;
  padding: 0 0 8px;
  border: 0;
  border-bottom: 1px solid var(--dream-line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 16px/18px var(--font-mono);
  outline: none;
  caret-color: var(--dream-alert);
  transform: scale(0.75);
  transform-origin: left bottom;
  transition: border-color 0.3s var(--ease), color var(--dream-fade) var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

.dream-field.is-invalid .dream-label { color: var(--red, #f0262b); }
.dream-field.is-invalid input { border-bottom-color: var(--red, #f0262b); }

.is-invalid {
  animation: dream-nudge 0.42s var(--ease-settle);
}

@keyframes dream-nudge {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  45% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
}

/* ---- The box: 326 x 456, 8px corners, 24px under the last line ---- */

.dream-box {
  position: relative;
  /* 24 from the e-mail line, which sits 3px above the row's foot. */
  margin-top: 21px;
  width: 100%;
  /* A fixed height, as drawn: only the width follows the screen, so the
     tools, the ruled lines and the margins under them stay exactly where
     Frame 5 puts them on any phone. */
  height: 456px;
  /* It has to fit the screen whole once it is centred, between the three
     pinned numerals and the header pill (48px, 16px off the bottom). */
  max-height: calc(100svh - 3 * var(--chapter-h, 46px) - 64px - 40px);
  border-radius: 8px;
  background: var(--dream-sheet);
  /* A 1.5px edge laid across the outline, as drawn. */
  box-shadow: 0 0 0 0.75px var(--dream-edge), inset 0 0 0 0.75px var(--dream-edge);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dream-fade) var(--ease), box-shadow var(--dream-fade) var(--ease);
}

.dream-box.is-active {
  --dream-edge: #f3f3f3;
  cursor: default;
}

.dream-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}

.dream-box.is-active[data-mode="sketch"] .dream-canvas {
  pointer-events: auto;
  cursor: crosshair;
}

.dream-box[data-mode="text"] .dream-canvas {
  opacity: 0;
}

/* The second sheet (Frame 5): eight ruled lines, 40px apart, 32px in from
   the sides, the first 122px down, the last 54px off the bottom. At 20/40
   the baseline falls 25px into each line; the rule is drawn 8.6px under
   it, as in the mockup, rather than at the foot of the line. The height is
   snapped to whole lines by the script. */
.dream-text {
  --dream-lh: 40px;
  --dream-rule-at: 33.25px;
  position: absolute;
  top: 88px;
  left: 32px;
  right: 32px;
  height: calc(var(--dream-lh) * 8);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  resize: none;
  overflow: hidden;
  background: transparent linear-gradient(to bottom, transparent var(--dream-rule-at), var(--dream-ruled) 0, var(--dream-ruled) calc(var(--dream-rule-at) + 0.75px), transparent 0) 0 0 / 100% var(--dream-lh) local;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  font-style: normal;
  font-size: 20px;
  line-height: var(--dream-lh);
  outline: none;
  caret-color: #90FE11;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s var(--ease), visibility 0s linear 0.45s;
  -webkit-appearance: none;
  appearance: none;
}

.dream-text::placeholder {
  color: var(--dream-placeholder);
  opacity: 1;
}

.dream-box[data-mode="text"] .dream-text {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s var(--ease), visibility 0s;
}

.dream-box.is-active[data-mode="text"] .dream-text {
  pointer-events: auto;
}

.dream-hint {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 50%;
  margin: 0;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  color: var(--dream-hint);
  pointer-events: none;
  transition: opacity 0.3s var(--ease), color var(--dream-fade) var(--ease);
}

.dream-box.has-ink .dream-hint,
.dream-box[data-mode="text"] .dream-hint {
  opacity: 0;
}

/* ---- Tools: 32px squares 12px in, 12px apart; under the pen, the colour
   and the eraser at 24px, 8px apart ---- */

.dream-tools {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.dream-tool-col {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.dream-tool,
.dream-eraser,
.dream-swatch {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dream-tool,
.dream-eraser {
  width: 32px;
  height: 32px;
  background: var(--dream-chip);
  color: var(--ink);
  box-shadow: 0 0 0 0.75px transparent, inset 0 0 0 0.75px transparent;
  transition: background-color var(--dream-fade) var(--ease), color var(--dream-fade) var(--ease), box-shadow 0.25s var(--ease);
}

.dream-tool svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.dream-eraser {
  width: 24px;
  height: 24px;
}

.dream-eraser svg {
  width: 12px;
  height: 11.3px;
  fill: currentColor;
}

/* The tool in use is ringed in green, 1.5px across its edge; so is the
   eraser while it is on. */
.dream-box.is-active .dream-tool[aria-pressed="true"],
.dream-eraser[aria-pressed="true"] {
  box-shadow: 0 0 0 0.75px #90FE11, inset 0 0 0 0.75px #90FE11;
}

/* Under the pen: the colour square and the eraser. Only while drawing. */
.dream-menu {
  display: grid;
  justify-items: center;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease-enter), visibility 0s linear 0.3s;
}

.dream-box.is-active[data-mode="sketch"] .dream-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.3s var(--ease), transform 0.4s var(--ease-enter), visibility 0s;
}

.dream-swatch {
  width: 24px;
  height: 24px;
  background: var(--dream-pen, #90FE11);
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease-settle);
}

.dream-swatch:active {
  transform: scale(0.88);
}

/* ---- GDPR and Send: 24px under the box ---- */

.dream-foot {
  display: flex;
  align-items: center;
  margin-top: 24px;
}

.dream-gdpr {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
}

.dream-gdpr input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* An 11px square with 4px corners, its 1.5px edge laid across the
   outline: 12.5 seen, the square itself on the box's left edge, the text
   20px in from it (Frame 4). */
.dream-check {
  flex: none;
  width: 12.5px;
  height: 12.5px;
  margin: 0 8.25px 0 -0.75px;
  border: 1.5px solid var(--ink);
  border-radius: 4.75px;
  transition: background-color 0.2s var(--ease), border-color 0.3s var(--ease), box-shadow 0.2s var(--ease);
}

.dream-gdpr input:checked + .dream-check {
  background: #90FE11;
}

.dream-gdpr input:focus-visible + .dream-check {
  box-shadow: 0 0 0 3px var(--dream-chip);
}

.dream-gdpr.is-invalid .dream-check {
  border-color: var(--red, #f0262b);
}

/* Four set lines, broken where the copy reads best. 7/10 mono where there
   is room for it; on a narrower phone the size comes down just enough for
   the longest line (43 characters) to fit beside Send, so it is always
   these four lines and never runs into the button. The block is the
   measure: its width is what is left beside Send, 12px clear of it. */
.dream-gdpr-text {
  flex: 1 1 0;
  min-width: 0;
  margin-right: 12px;
  container-type: inline-size;
  font-family: var(--font-mono);
  color: var(--ink);
  transition: color var(--dream-fade) var(--ease);
}

/* 12px so it can be read: at that size the four set lines no longer fit
   beside Send, so the copy runs on and wraps in the space that is left. */
.dream-gdpr-lines {
  display: block;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: -0.02em;
}

.dream-gdpr-lines br {
  display: none;
}

/* Phone: the consent runs the full width, Send under it on the right. */
@media (max-width: 899px) {
  .dream-foot {
    flex-wrap: wrap;
    row-gap: 16px;
  }

  .dream-gdpr {
    flex: 1 1 100%;
  }

  .dream-gdpr-text {
    margin-right: 0;
  }
}

.dream-send {
  flex: none;
  width: 144px;
  height: 40px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: #90FE11;
  color: #333333;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s var(--ease-settle), opacity 0.2s var(--ease);
}

.dream-send:active {
  transform: scale(0.96);
}

.dream-send[disabled] {
  opacity: 0.55;
  cursor: progress;
}

/* Laid over the space under the form rather than adding to it, so the
   240px from Send to the projects never changes. */
.dream-status {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 16px);
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.dream-status.is-on {
  opacity: 1;
}

/* ---- From the form into the projects ----
   The "Ready for design?" fog is gone: no clouds, no blurred tide, no
   words. Its block stays in the page, empty — script.js docks the reel
   off it — and is what holds Send 240px above the first project. 03 now
   ends on the form itself. */
.hs-03 {
  padding-bottom: 0;
}

.show-intro {
  /* 240px from the foot of Send to the photograph (200 plus 40 of room to
     work the box without the page tipping into the projects): the GDPR's
     four lines are never taller than Send, so the form ends where Send does. */
  height: 240px;
  margin-top: 0;
}

.show-intro-fog,
.show-intro-tide,
.show-intro-text {
  display: none;
}

/* Instead the photograph's top dissolves into the page ground: a blur that
   thins out, and over it a veil of the ground's own colour. Both follow an
   eased curve rather than a straight ramp — a straight one shows a band
   where it ends. Dark ground or light, the veil matches it, so there is no
   line between the two. Docked, with the photograph filling the screen, it
   clears away. */
.showcase {
  --ground: 243 243 243;
}

html.dream-dark .showcase {
  --ground: 51 51 51;
}

.showcase::before,
.showcase::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 40svh;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.6s var(--ease);
}

.showcase::before {
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.74) 19%, rgba(0, 0, 0, 0.54) 34%, rgba(0, 0, 0, 0.38) 47%, rgba(0, 0, 0, 0.28) 56%, rgba(0, 0, 0, 0.19) 65%, rgba(0, 0, 0, 0.13) 73%, rgba(0, 0, 0, 0.08) 80%, rgba(0, 0, 0, 0.04) 86%, rgba(0, 0, 0, 0.02) 91%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.74) 19%, rgba(0, 0, 0, 0.54) 34%, rgba(0, 0, 0, 0.38) 47%, rgba(0, 0, 0, 0.28) 56%, rgba(0, 0, 0, 0.19) 65%, rgba(0, 0, 0, 0.13) 73%, rgba(0, 0, 0, 0.08) 80%, rgba(0, 0, 0, 0.04) 86%, rgba(0, 0, 0, 0.02) 91%, transparent 100%);
}

.showcase::after {
  background: linear-gradient(to bottom,
    rgb(var(--ground) / 1) 0%,
    rgb(var(--ground) / 0.74) 19%,
    rgb(var(--ground) / 0.54) 34%,
    rgb(var(--ground) / 0.38) 47%,
    rgb(var(--ground) / 0.28) 56%,
    rgb(var(--ground) / 0.19) 65%,
    rgb(var(--ground) / 0.13) 73%,
    rgb(var(--ground) / 0.08) 80%,
    rgb(var(--ground) / 0.04) 86%,
    rgb(var(--ground) / 0.02) 91%,
    rgb(var(--ground) / 0) 100%);
}

.showcase.is-held::before,
.showcase.is-held::after {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .is-invalid { animation: none; }
}

/* IBM Plex Mono one pixel larger on the PHONE only (the user, 2026-11-12:
   10 -> 11, 12 -> 13; the desktop stays as it was). */
@media (max-width: 899px) {
  .dream-label { font-size: 11px; }
  .dream-hint { font-size: 13px; }
  .dream-gdpr-lines { font-size: 10px; line-height: 13px; }
  .dream-send { font-size: 13px; }
  .dream-status { font-size: 13px; }
}

/* Phone (the user, 2026-11-12): 16px more between the Name & Surname row and
   the E-Mail row, so each typed line clearly belongs to its own label. */
@media (max-width: 899px) {
  .dream-fields { gap: 25px; }
}
/* Phone, dark dream (the user, 2026-11-12): the rules under 01, 02 and 03
   are drawn as a filled 1px box on the phone (style.css), so they take the
   light colour through --chapter-rule-c; 03's own rule too, now on dark. */
@media (max-width: 899px) {
  html.dream-dark .chapter-rule { --chapter-rule-c: rgba(243, 243, 243, 0.45); }
}
/* The empty sheet, when sending (the user, 2026-11-12: a drawing or some
   words are required): its edge turns red. */
.dream-box.is-invalid,
.dream-box.is-active.is-invalid { --dream-edge: var(--red, #f0262b); }
/* Phone (the user, 2026-11-12: keep text and line apart the same way on
   every form): the label rises to the typed text's baseline, so label and
   text sit on one line with the rule under both, as on the other forms.
   Measured: the text's baseline is 9.6px above the label's. */
@media (max-width: 899px) {
  /* Revised the same day: label and text both rest 5px above the rule. The
     field is set at 16px and scaled by 3/4, so 4px under the text is 3. */
  .dream-input input { height: 22px; padding-bottom: 4px; }
  .dream-label { position: relative; top: -6.8px; }
}