/*
  Hermanos Grille. The page is one of the company's own sheets: white paper that turns a faint blue towards its sides,
  a fine navy frame, and a title block along its foot that says which sheet you are on. Inside the frame there is one
  drawing and one line of words at a time. Nothing else.
*/

@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm_plex_sans_regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm_plex_sans_medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm_plex_sans_semibold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  /* the shirt's navy, the app's ink and paper */
  --navy: #28428D;
  --ink: #14171C;
  --paper: #FFFFFF;
  --sky: #E9F0FC;
  --slate: #4E576B;
  --dark: #0B1330;

  /* what the sheet is drawn with: these turn over when the room's lights go out (html.is-night) */
  --line: var(--navy);
  --text: var(--ink);
  --quiet: var(--slate);
  --ground: var(--paper);
  --rig: #8A92A5;              /* the hoist's grey: the stones' grey, a touch lighter */

  --m: clamp(8px, 1.4vw, 20px);          /* the paper left outside the frame */
  /* ... and on each side, that plus whatever the phone keeps for itself there (a notch, the home line) */
  --mt: calc(var(--m) + env(safe-area-inset-top, 0px));
  --mr: calc(var(--m) + env(safe-area-inset-right, 0px));
  --mb: calc(var(--m) + env(safe-area-inset-bottom, 0px));
  --ml: calc(var(--m) + env(safe-area-inset-left, 0px));
  --pad: clamp(18px, 4.2vw, 60px);       /* the room inside it */
  --block: 64px;                         /* the title block's height */
  --turn: 520ms cubic-bezier(.4, 0, .2, 1);
}

html.is-night {
  --line: #B7C6F3;
  --text: #F3F6FF;
  --quiet: #A9B6DB;
  --ground: var(--dark);
  --rig: #8D98BA;
}

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

/*
  The page turns a sheet at a time: one turn of the wheel or one swipe goes to the next sheet and stops there, never
  between two or past one ("so I don't have to over scroll every time and find the right spot", the product owner,
  2026-11-28). A last sheet taller than the window (a small phone held sideways) still scrolls within itself.
*/
html { scroll-behavior: smooth; scroll-snap-type: y mandatory; -webkit-text-size-adjust: 100%; }
.sheet { scroll-snap-align: start; scroll-snap-stop: always; }

body {
  margin: 0;
  min-height: 100svh;
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text);
  /* the paper: white, a blue you only see when you look for it at its two sides */
  background: linear-gradient(90deg, var(--sky) 0, var(--paper) 18%, var(--paper) 82%, var(--sky) 100%) fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--navy); color: #fff; }

a { color: inherit; }
a:focus-visible { outline: 2px solid var(--line); outline-offset: 4px; border-radius: 2px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* the room's lights going out: a dark ground that grows from the middle of the sheet as the room is walked into
   (js/main.js cuts it to a square that widens until it is the whole sheet) */
.night { position: fixed; inset: 0; z-index: 0; background: var(--dark); opacity: 0; pointer-events: none; }

/* the drawings */
.scene { position: fixed; inset: 0; z-index: 1; width: 100%; height: 100%; opacity: 0; pointer-events: none; }

/* the architect's lettering of the printed sheet: small, spaced, in the line's colour. Used for what a cell is. */
.lbl, .place, .contact dt {
  margin: 0;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--line);
  transition: color var(--turn);
}

/* the head: the name, and where */
.head {
  position: fixed;
  z-index: 4;
  top: var(--mt);
  left: var(--ml);
  right: var(--mr);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: clamp(16px, 2.6vw, 30px) var(--pad) 0;
  pointer-events: none;
}
.mark {
  display: block;
  width: clamp(124px, 15vw, 196px);
  aspect-ratio: 450.57 / 99.92;
  background: var(--line);
  -webkit-mask: url("img/wordmark.svg") center / contain no-repeat;
  mask: url("img/wordmark.svg") center / contain no-repeat;
  transition: background-color var(--turn);
  pointer-events: auto;
}
.place { padding-top: 0.35em; }

/* a sheet: as tall as the window, its one line of words at its foot, on the left, as a drawing's note is */
main { position: relative; z-index: 2; }
.sheet {
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding: 0 calc(var(--mr) + var(--pad)) calc(var(--mb) + var(--block) + clamp(26px, 7vh, 76px)) calc(var(--ml) + var(--pad));
}
.say {
  margin: 0;
  max-width: 13em;
  font-size: clamp(2.15rem, 6.1vw, 5.1rem);
  font-weight: 400;
  letter-spacing: -0.024em;
  line-height: 1.03;
  color: var(--text);
  transition: color var(--turn);
}

/*
  With the script running, the words do not scroll past: each sheet's line stands in the same place at the sheet's
  foot and gives way to the next as the page is walked (js/main.js sets how much of each is there). The sheets
  themselves are then only the room to scroll through. Without the script the page is four plain sheets, one under
  the other.
*/
html.js .sheet { display: block; padding: 0; }
html.js .sheet > .say,
html.js .sheet > .last {
  position: fixed;
  z-index: 3;
  left: calc(var(--ml) + var(--pad));
  bottom: calc(var(--mb) + var(--block) + clamp(26px, 7vh, 76px));
  /* clear of the hoist at the right edge */
  max-width: calc(100vw - var(--ml) - var(--mr) - 2 * var(--pad) - 64px);
  opacity: 0;
  visibility: hidden;
  will-change: opacity, transform;
}

/*
  The last sheet is the one that can outgrow the window: six rows on a small phone, or any phone held sideways. When
  it does (js/main.js measures, and marks it "flows"), it is no longer pinned: it is the foot of an ordinary page and
  scrolls like one, and the head gets a ground of its own so the rows pass under it, not through it.
*/
html.js .sheet-last.flows {
  display: flex;
  align-items: flex-end;
  padding: calc(var(--mt) + 104px) calc(var(--mr) + var(--pad)) calc(var(--mb) + var(--block) + 26px) calc(var(--ml) + var(--pad));
}
html.js .sheet-last.flows > .last { position: static; max-width: none; transform: none !important; }
html.head-solid .head { background: var(--ground); padding-bottom: 14px; border-bottom: 1px solid var(--line); transition: background-color var(--turn), border-color var(--turn); }
/* and the strips of paper outside the frame, over and under it, are paper: nothing scrolls through them */
html.head-solid .frame::before,
html.head-solid .frame::after {
  content: "";
  position: absolute;
  left: calc(-1 * var(--ml) - 1px);
  right: calc(-1 * var(--mr) - 1px);
  background: linear-gradient(90deg, var(--sky) 0, var(--paper) 18%, var(--paper) 82%, var(--sky) 100%) fixed;
}
html.head-solid .frame::before { bottom: calc(100% + 1px); height: var(--mt); }
html.head-solid .frame::after { top: calc(100% + 1px); height: var(--mb); }

/* the last sheet's line, and at its end the figure when it is drawn small (it has the figure's own proportions) */
.last-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.mini { flex: none; width: clamp(84px, 27vw, 124px); aspect-ratio: 56.3 / 51.6; margin-bottom: 0.1em; }

/* the last sheet: how to reach them, ruled like the title block */
.last { width: min(100%, 34rem); }
.contact { margin: clamp(22px, 4vh, 40px) 0 0; border-top: 1px solid var(--line); transition: border-color var(--turn); }
.contact > div { display: grid; grid-template-columns: 7.4rem 1fr; align-items: baseline; padding: 0.85rem 0 0.9rem; border-bottom: 1px solid var(--line); transition: border-color var(--turn); }
.contact > div[hidden] { display: none; }
.contact dd { margin: 0; font-size: 1.16rem; line-height: 1.35; overflow-wrap: anywhere; }
/* the telephone is what most people came for: it is the biggest thing in the list */
.contact dd.big { font-size: 1.62rem; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
/* something a tap acts on has a line under it; something only said (no address yet, a sample) has none */
.contact a { text-decoration: none; }
.contact a[href] { border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.contact a[href]:hover { color: var(--line); }
.sample { margin: clamp(18px, 3vh, 30px) 0 -8px; }

/*
  The drafting machine: two fine rules that cross where the mouse is and run the whole sheet, as the arms of the
  machine an architect draws at. There only while the mouse moves (js/main.js), and only where there is a mouse.
*/
.cross { position: fixed; inset: var(--mt) var(--mr) var(--mb) var(--ml); z-index: 3; opacity: 0; pointer-events: none; overflow: hidden; }
.cross::before, .cross::after { content: ""; position: absolute; background: var(--line); opacity: 0.26; transition: background-color var(--turn); }
.cross::before { left: 0; right: 0; top: 0; height: 1px; transform: translate3d(0, calc(var(--y, 0px) - var(--mt)), 0); }
.cross::after { top: 0; bottom: 0; left: 0; width: 1px; transform: translate3d(calc(var(--x, 0px) - var(--ml)), 0, 0); }

/* the frame round the sheet */
.frame {
  position: fixed;
  z-index: 5;
  inset: var(--mt) var(--mr) var(--mb) var(--ml);
  border: 1px solid var(--line);
  pointer-events: none;
  transition: border-color var(--turn);
}

/* the title block along the frame's foot */
.block {
  position: fixed;
  z-index: 6;
  left: var(--ml);
  right: var(--mr);
  bottom: var(--mb);
  height: var(--block);
  display: grid;
  /* the G, the name, then the telephone (when there is one), the sheet's name and its number */
  grid-template-columns: var(--block) minmax(0, 1fr) auto auto auto;
  border: 1px solid var(--line);
  background: var(--ground);
  transition: background-color var(--turn), border-color var(--turn);
}
.block a { text-decoration: none; }
.block a[href]:hover { text-decoration: underline; text-underline-offset: 3px; }
/* a cell or a line with nothing to say is not there (its own display would bring it back) */
.cell[hidden], .call[hidden] { display: none; }
.call { display: none; }
.cell { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 0 clamp(12px, 1.5vw, 20px); border-left: 1px solid var(--line); transition: border-color var(--turn); }
.cell:first-child { border-left: 0; }
.cell-g { align-items: center; padding: 0; }
.g {
  display: block;
  width: 46%;
  aspect-ratio: 80.33 / 58.05;
  background: var(--line);
  -webkit-mask: url("img/g.svg") center / contain no-repeat;
  mask: url("img/g.svg") center / contain no-repeat;
  transition: background-color var(--turn);
}
.name, .trades, .val { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name { font-size: 0.86rem; font-weight: 600; color: var(--text); transition: color var(--turn); }
.trades { margin-top: 0.15rem; font-size: 0.74rem; color: var(--quiet); transition: color var(--turn); }
.val { margin-top: 0.42rem; font-size: 0.98rem; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text); transition: color var(--turn); }
.cell-plan { width: 8.6rem; }
.cell-sheet { width: 5.4rem; }

/* the hoist at the sheet's right edge (index.html says what it is; js/main.js draws and moves it) */
.hoist {
  position: fixed;
  z-index: 4;
  right: calc(var(--mr) + clamp(12px, 2vw, 30px));
  top: 50%;
  width: 52px;
  height: min(40vh, 290px);
  margin-top: calc(min(40vh, 290px) / -2 - var(--block) / 2);
  color: var(--line);
  transition: color var(--turn);
}
.hoist .rig { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.hoist .grey { stroke: var(--rig); fill: none; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; transition: stroke var(--turn); }
/* the wheel, the load and the winch: thin lines in the house's blue, as the G is drawn */
.hoist .line { stroke: currentColor; fill: none; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
/* the far side of the sphere, seen through it */
.hoist .back { opacity: 0.22; }
.hoist .rope { stroke: currentColor; stroke-width: 1.2; }
.hoist .weight { fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linejoin: round; stroke-linecap: round; }
/* the levels: a faint mark beside the load where it comes to rest for each sheet; the one for the sheet you are on
   is darker and longer. The link is a full-size target round it (placed by js/main.js). */
.hoist .lvl { position: absolute; left: -10px; width: 26px; height: 26px; margin-top: -13px; }
.hoist .tick { position: absolute; left: 6px; top: 12.5px; width: 8px; height: 1px; background: currentColor; opacity: 0.3; transform-origin: right; transition: opacity var(--turn), transform var(--turn); }
.hoist .lvl[aria-current] .tick, .hoist .lvl:hover .tick { opacity: 1; transform: scaleX(1.5); }

@media (max-width: 640px) {
  :root { --block: 54px; }
  .block { grid-template-columns: var(--block) minmax(0, 1fr) auto; }
  .cell-plan, .cell-phone, .trades { display: none; }
  .name { font-size: 0.78rem; white-space: normal; line-height: 1.2; }
  /* with a telephone, the name keeps to one line and the number goes under it */
  .has-phone .name { white-space: nowrap; }
  .call:not([hidden]) { display: block; margin: 0.18rem 0 0; font-size: 0.92rem; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--line); transition: color var(--turn); }
  .contact dd.big { font-size: 1.42rem; }
  .cell-sheet { width: 4.6rem; }
  /* on a phone each row's name goes over its value: an e-mail address is one long word and needs the whole width */
  .contact > div { grid-template-columns: 1fr; row-gap: 0.28rem; }
  .hoist { height: min(32vh, 210px); margin-top: calc(min(32vh, 210px) / -2 - var(--block) / 2); }
}

/* a short window: the rows close up before anything has to scroll */
@media (max-height: 720px) {
  .contact { margin-top: 16px; }
  .contact > div { padding: 0.56rem 0 0.6rem; }
  .contact dd { font-size: 1.04rem; }
  .contact dd.big { font-size: 1.3rem; }
  .sample { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}
