/* Liliane Carlos — Home.
   Same tokens, face and grid as the project pages.
   Orientation → immersion → clarity. The first frame needs no motion to
   be understood; the field moves only with scrolling, then rests, with the
   three projects standing in it as presences.
   (Approved as "Home V2B", 2026-10-14; the earlier Home is in
   backup/home-v1-2026-10-14/.) */

:root {
  --ground: #f2f0eb;
  --ink: #1c1b19;
  --muted: #8a8680;

  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --margin: clamp(20px, 4vw, 64px);
  --gutter: clamp(16px, 2vw, 32px);
  --small: 0.8125rem;
  --body: 1.0625rem;

  --head: 64px;   /* height of the fixed control layer */
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--ground);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

p, h1, h2, ul { margin: 0; padding: 0; }
ul { list-style: none; }

a { color: inherit; text-decoration: none; text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Control layer ----------
   Fixed, on the page's own ground (no bar, no line): content passes
   beneath it and never under the words. */

.control {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  height: var(--head);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gutter);
  padding: 0 var(--margin);
  background: var(--ground);
  font-size: var(--small);
  letter-spacing: 0.02em;
}

.name {
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
}

.controls {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
}

.inline-nav { display: none; }

.menu-toggle {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  cursor: pointer;
}
.menu-toggle:hover { text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 1px; }

/* Menu (mobile): immediate, no transition */
.menu {
  position: fixed;
  inset: var(--head) 0 0 0;
  z-index: 3;
  padding: 3rem var(--margin) var(--margin);
  background: var(--ground);
  font-size: 1.375rem;
  line-height: 1.7;
}
.menu[hidden] { display: none; }
html.menu-open { overflow: hidden; }

/* ---------- 1 · Orientation ---------- */

.orientation {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  align-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--head) var(--margin) 6rem;
}

.statement {
  grid-column: 1 / -1;
  max-width: 21em;
  font-size: clamp(1.625rem, 1rem + 2.4vw, 3.125rem);
  line-height: 1.14;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

.explore {
  position: absolute;
  left: var(--margin);
  bottom: calc(var(--margin) + env(safe-area-inset-bottom, 0px));
}

/* ---------- 2 · The field ----------
   The approved plate, in the approved type registers. The frame is held
   while the camera travels and rests; the projects are not on the plate
   (they never scale or drift) but in a still layer in front of it. */

.field {
  position: relative;
  height: calc(100vh + var(--travel) + var(--hold));
}

/* "Projects" lands where the field is at rest and the projects are present. */
.anchor {
  position: absolute;
  top: var(--travel);
  left: 0;
  width: 1px;
  height: 1px;
}

.field-frame {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.plate {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  /* The field recedes as the projects come forward (home.js). */
  opacity: var(--field-opacity, 0.2);
  will-change: transform;
}

.at {
  position: absolute;
  left: calc(var(--x) * 1px);
  top: calc(var(--y) * 1px);
  margin: 0;
  white-space: pre;
}

.mid {
  font-size: 72px;
  line-height: 1;
  letter-spacing: -0.015em;
}

.huge {
  font-size: 1100px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.small {
  font-size: 15px;
  line-height: 1.3;
}

/* Records, times, counts: kept, but only as metadata of the field —
   small, quiet, never framed as something to decode. */
.log, .log-line, .count {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 15px;
  letter-spacing: 0.02em;
  color: var(--muted);
  opacity: 0.6;
}
.count {
  font-size: 14px;
  writing-mode: vertical-rl;
  letter-spacing: 0.12em;
}

/* The projects: plain words in front of the field. */
.present {
  position: absolute;
  inset: var(--head) var(--margin) 0;
  opacity: var(--present, 1);
}
.present li {
  position: absolute;
  left: calc(var(--m-inset) * 1vw);
  right: 0;
  top: calc(var(--m-top) * 1%);
}
.present a {
  display: inline-block;
  padding: 0.15em 0;
  font-size: clamp(1.75rem, 1.1rem + 2.4vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}
.present a:hover,
.present a:focus-visible { text-decoration: underline; text-decoration-thickness: 2px; }

/* Before the projects are present they cannot be hit by accident. */
html.js .field:not(.is-present) .present { pointer-events: none; }

/* ---------- 3 · Clarity ---------- */

.index,
.closing {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  padding-inline: var(--margin);
}
.index > *,
.copyright { grid-column: 1 / -1; }

.index { padding-block: 30vh 0; }

.index-label {
  font-size: var(--small);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.index-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.5rem;
  font-size: 1.1875rem;
  line-height: 1.3;
}

.closing {
  padding-block: 18vh var(--margin);
  font-size: var(--small);
  letter-spacing: 0.02em;
}
.copyright { color: var(--muted); }

/* ---------- Desktop ---------- */

@media (min-width: 900px) {
  :root { --head: 72px; }

  .inline-nav {
    display: flex;
    gap: 0 1.75rem;
  }
  .short-projects,
  .menu-toggle,
  .menu { display: none; }
  .controls { gap: 1.75rem; }

  .statement { grid-column: 1 / span 9; }

  .present li {
    left: calc((100% + var(--gutter)) / 12 * (var(--col) - 1));
    top: calc(var(--top) * 1%);
  }

  .index > *,
  .copyright { grid-column: 5 / span 6; }
}

/* ---------- Reduced motion ----------
   No travel, no fades: the field is shown at rest, the projects present
   throughout (home.js). Anchors jump, never animate. */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}


/* ==========================================================================
   Projects as presences.
   Active state (hover or keyboard focus; on touch screens, the project whose
   turn it is while the field holds): the title grows ~7%, the field recedes,
   the project's one fragment gains contrast and a fine line starts from the
   title towards it, stopping halfway. No underline: those four are the
   signal. Going in is quick and precise; coming back is slow.
   Transform, colour and stroke only: no layout shift.
   ========================================================================== */

/* ---------- Field ----------
   Ink is set per fragment instead of on the whole plate, so a single
   fragment can come forward while the others recede. --field-opacity is
   set by home.js for the travel and the rest. */

.plate { opacity: 1; }

.at {
  --dim: 0.8;   /* at rest the fragments sit further back */
  color: rgb(28 27 25 / calc(var(--field-opacity, 0.2) * var(--dim)));
}
/* The giant word: an incomplete presence at the bottom edge, below the
   projects. home.js places it so that about a quarter of its height is
   inside the frame at rest, on any screen (--huge-y, plate units); further
   back than the other fragments. Without the script: lower on the plate. */
.huge {
  top: calc(var(--huge-y, calc(var(--y) + 240)) * 1px);
  color: rgb(28 27 25 / calc(var(--field-opacity, 0.2) * var(--dim) * 0.65));
}
.log, .log-line, .count {
  opacity: 1;
  color: rgb(138 134 128 / calc(var(--field-opacity, 0.2) * 0.6 * var(--dim)));
}

/* Colour changes are eased only once the field is at rest (during the
   travel the colour follows the scroll exactly). Leaving: slow. */
.field.is-present .at,
.field.is-present .echo {
  transition: color 1.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.field.is-present[data-active] .at,
.field.is-present[data-active] .echo {
  transition-duration: 0.6s;
}

.field[data-active] .at { --dim: 0.5; }

.field[data-active="0"] .echo[data-echo="0"],
.field[data-active="1"] .echo[data-echo="1"],
.field[data-active="2"] .echo[data-echo="2"] {
  color: rgb(28 27 25 / 0.62);
}

/* ---------- Projects ---------- */

.present a {
  font-size: clamp(2rem, 1.15rem + 3vw, 3.875rem);
  transform-origin: 0 60%;
  transition: transform 1.1s cubic-bezier(0.4, 0, 0.2, 1);
}
.present a.is-large {
  font-size: clamp(2.875rem, 1.3rem + 4.95vw, 6.125rem);
  letter-spacing: -0.03em;
}
/* No underline and no outline: scale, line, field and fragment carry the
   hover and the keyboard focus (with reduced motion, the outline returns). */
.present a:hover,
.present a:focus-visible { text-decoration: none; outline: none; }

.present a.is-active {
  transform: scale(1.07);
  transition-duration: 0.45s;
  transition-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- The line ----------
   One per project, never between projects. Not an arrow: an open stroke
   that leaves the title and stops in the field. */

.trace {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.trace path {
  fill: none;
  stroke: rgb(28 27 25 / 0.6);
  stroke-width: 1;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: var(--len, 0);
  stroke-dashoffset: var(--len, 0);
  opacity: 0;
  transition:
    stroke-dashoffset 1.6s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 1.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.trace path.is-drawn {
  stroke-dashoffset: 0;
  opacity: 1;
  transition-duration: 1.2s, 0.3s;
  transition-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Touch screens: the field holds a little longer, so each project has its
   own stretch of scrolling (home.js). */
@media (max-width: 899px) {
  .field { --hold: 150vh !important; }
}

/* ---------- Reduced motion ----------
   Contrast only: no scale, no drawn line. */

@media (prefers-reduced-motion: reduce) {
  .present a,
  .present a.is-active { transform: none; transition: none; }
  .trace { display: none; }
  .present a:focus-visible { outline: 1px solid currentColor; outline-offset: 6px; }
  .field.is-present .at,
  .field.is-present .echo,
  .field.is-present[data-active] .at,
  .field.is-present[data-active] .echo { transition-duration: 0.2s; }
}
