/*
  52 BLUE, version zero. One stylesheet. Nothing here asks another machine for anything.

  The two families. Each face is served from this site and has a system stack behind it,
  so the page is whole before the font arrives and whole if it never does.
*/
:root {
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", P052, Georgia, serif;
  --font-text: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;

  /* colour: three from the reference, one from the Foundation's 52 BLUE page */
  --abyss: #05080c;
  --bone: #e6ddd0;
  --phosphor: #b7d9c9;
  --blue: #8fd8ee;
  --bone-soft: #c8c2b7;
  --rule: rgba(230, 221, 208, 0.17);

  /* type scale: six sizes, each with one job */
  --t-note: 0.9375rem;                                 /* hints and the depth reading */
  --t-body: clamp(1.0625rem, 1rem + 0.32vw, 1.1875rem);
  --t-term: clamp(1.375rem, 1.24rem + 0.62vw, 1.625rem); /* the name of a planned part */
  --t-lead: clamp(1.4375rem, 1.14rem + 1.3vw, 2rem);    /* the opening lines and the answer in words */
  --t-head: clamp(2.375rem, 1.62rem + 3.3vw, 3.875rem);
  --t-name: clamp(4.75rem, min(21.5vw, 31vh), 15.5rem); /* 52 BLUE */

  --measure: 36rem;
  --edge: clamp(1.25rem, 8.5vw, 9.5rem);
}

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/fraunces-latin-opsz-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/fraunces-latin-opsz-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/figtree-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Loads only if a letter outside basic Latin is typed into the box, such as a vowel with a macron. */
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/figtree-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

html {
  color-scheme: dark;
  background: var(--abyss);
  color: var(--bone);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Without scripts the water is this one long fall of colour: down the page is down in the water. */
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-text);
  font-size: var(--t-body);
  line-height: 1.62;
  color: var(--bone);
  background: linear-gradient(180deg, #2f8399 0, #14546c 7%, #0b364d 17%, #072132 31%, #05141f 50%, #050c12 72%, #05080c 90%, #030508 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection { background: rgba(143, 216, 238, 0.32); color: #fff; }

.water {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: 0;
}
.js .water { display: block; }
/* The lit water, where the browser can draw it. It lies under the first canvas. */
.js .deep-layer { display: none; }
.js.deep .deep-layer { display: block; }

/* On a narrow screen: a band of open water at the top, where the whale swims clear of the words. */
.veil {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--band, 0);
  z-index: 3;
  pointer-events: none;
}
.narrow .veil { display: block; }
html.narrow { scroll-padding-top: calc(var(--band, 0px) + 0.75rem); }
.js body { background: var(--abyss); }

main, .foot { position: relative; z-index: 1; }

.col {
  width: min(100% - 2 * var(--edge), var(--measure));
  margin-left: var(--edge);
}

h1, h2, dt { font-family: var(--font-display); font-optical-sizing: auto; text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
p { margin: 0; }
p + p { margin-top: 1.05em; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}
a:hover { color: var(--blue); }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- the top ---------- */

.top {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding-bottom: clamp(3rem, 10vh, 6.5rem);
}
.top-words { width: min(100% - 2 * var(--edge), 60rem); }

h1 {
  margin: 0 0 0 -0.045em;
  font-size: var(--t-name);
  font-weight: 320;
  line-height: 0.84;
  letter-spacing: -0.034em;
  white-space: nowrap;
}
.what {
  margin-top: clamp(1.1rem, 3.2vh, 2rem);
  max-width: 21em;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 340;
  font-size: var(--t-lead);
  line-height: 1.24;
  letter-spacing: -0.005em;
}
.status {
  margin-top: 1.15rem;
  font-weight: 500;
  color: var(--bone);
}

/* The still whale and the still light: shown only when scripts are off. */
.still-whale {
  position: absolute;
  top: 17vh;
  right: 7vw;
  width: min(74vw, 34rem);
  height: auto;
  overflow: visible;
}
.sw-body { fill: #0c3044; }
.sw-low { fill: #082231; }
.sw-back { fill: none; stroke: rgba(206, 240, 232, 0.55); stroke-width: 2; stroke-linecap: round; }
.sw-line { fill: none; stroke: rgba(183, 217, 201, 0.3); stroke-width: 1.4; stroke-linecap: round; }
.sw-pleat { fill: none; stroke: rgba(183, 217, 201, 0.13); stroke-width: 1.1; stroke-linecap: round; }
.sw-eye { fill: rgba(214, 236, 226, 0.7); }
.top::before {
  content: "";
  position: absolute;
  inset: 0 0 30% 0;
  background:
    linear-gradient(104deg, transparent 8%, rgba(206, 240, 236, 0.13) 12%, transparent 19%),
    linear-gradient(106deg, transparent 27%, rgba(206, 240, 236, 0.1) 33%, transparent 41%),
    linear-gradient(108deg, transparent 49%, rgba(206, 240, 236, 0.12) 54%, transparent 60%),
    linear-gradient(110deg, transparent 68%, rgba(206, 240, 236, 0.08) 74%, transparent 83%);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent);
  mask-image: linear-gradient(180deg, #000, transparent);
  pointer-events: none;
}
.js .still-whale, .js .top::before { display: none; }

/* ---------- the parts of the page ---------- */

.part { padding-block: clamp(4.25rem, 12vh, 8.5rem); }

h2 {
  margin: 0 0 0.62em -0.03em;
  font-size: var(--t-head);
  font-weight: 370;
  line-height: 1.03;
  letter-spacing: -0.02em;
}

.lead p {
  font-family: var(--font-display);
  font-weight: 350;
  font-size: var(--t-lead);
  line-height: 1.3;
  letter-spacing: -0.006em;
  max-width: 20em;
}
.lead p + p { margin-top: 0.85em; }

.plan { margin: 0; }
.plan > div { padding-block: 1.35rem 1.5rem; border-top: 1px solid var(--rule); }
.plan > div:last-child { border-bottom: 1px solid var(--rule); }
.plan dt { font-size: var(--t-term); font-weight: 430; line-height: 1.15; letter-spacing: -0.01em; }
.plan dd { margin: 0.45rem 0 0; }

.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding-block: 1.05rem; border-top: 1px solid var(--rule); }
.plain li:last-child { border-bottom: 1px solid var(--rule); }
p + .plain { margin-top: 1.9rem; }

/* ---------- the sketch ---------- */

.script-off {
  margin-top: 2rem;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(230, 221, 208, 0.42);
  border-radius: 12px;
  background: rgba(5, 8, 12, 0.45);
}
.js .script-off { display: none; }

.ask { margin-top: 2.4rem; }
html:not(.js) .ask { display: none; }
.ask label { display: block; font-weight: 600; }
.hint { font-size: var(--t-note); line-height: 1.5; color: var(--bone-soft); }
.ask .hint { margin-top: 0.15rem; }

.ask-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.85rem;
}
#line {
  flex: 1 1 100%;
  min-width: 0;
  padding: 0.85rem 1.05rem;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--bone);
  caret-color: var(--blue);
  background: rgba(3, 6, 10, 0.5);
  border: 1px solid rgba(230, 221, 208, 0.55);
  border-radius: 14px;
  -webkit-appearance: none;
  appearance: none;
}
#line:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-color: var(--blue); border-radius: 14px; }

.btn {
  min-height: 3rem;
  padding: 0 1.45rem;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1;
  color: var(--bone);
  background: rgba(3, 6, 10, 0.35);
  border: 1px solid rgba(230, 221, 208, 0.6);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover:not(:disabled) { border-color: var(--bone); background: rgba(230, 221, 208, 0.1); }
.btn:focus-visible { border-radius: 999px; }
.btn-main { color: #05080c; background: var(--bone); border-color: var(--bone); }
.btn-main:hover:not(:disabled) { background: #f6f0e6; border-color: #f6f0e6; }
.btn:disabled { opacity: 0.42; cursor: default; }
.sketch[data-state="playing"] #stop { border-color: var(--blue); color: var(--blue); }

.sketch-note { min-height: 1.6em; margin-top: 0.75rem; color: var(--blue); }

.trace {
  display: block;
  width: 100%;
  height: clamp(7.5rem, 21vh, 12.5rem);
  margin-block: 0.75rem 0.5rem;
}
html:not(.js) .trace, html:not(.js) .strip { display: none; }
.strip { display: block; width: 100%; height: 4.5rem; }

.said {
  min-height: 3.9em;
  margin-top: 1.1rem;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 350;
  font-size: clamp(1.3125rem, 1.15rem + 0.75vw, 1.625rem);
  line-height: 1.3;
}
html:not(.js) .said { display: none; }

.after { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.1rem; }
.after[hidden] { display: none; }
.after .hint { flex: 1 1 100%; margin-top: 0.1rem; }

.promise { margin-top: 2.6rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.limits { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }

/* ---------- the depth reading ---------- */

.gauge {
  display: none;
  position: fixed;
  z-index: 2;
  top: 50%;
  right: clamp(1.1rem, 2.4vw, 2.5rem);
  height: 42vh;
  width: 1px;
  transform: translateY(-50%);
  pointer-events: none;
  --at: 0;
}
.js .gauge { display: block; }
.gauge-line { position: absolute; inset: 0; background: rgba(230, 221, 208, 0.26); }
/* a small mark every tenth of the way down: every 52 metres on the page's own scale */
.gauge-line::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: -1px;
  left: -3px;
  width: 7px;
  background: repeating-linear-gradient(180deg, rgba(230, 221, 208, 0.5) 0, rgba(230, 221, 208, 0.5) 1px, transparent 1px, transparent 10%);
  border-bottom: 1px solid rgba(230, 221, 208, 0.5);
}
.gauge-dot {
  position: absolute;
  left: 50%;
  top: calc(var(--at) * 100%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  transform: translate(-50%, -50%);
}
.gauge-read {
  position: absolute;
  right: 12px;
  top: calc(var(--at) * 100%);
  transform: translateY(-50%);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--bone);
  padding: 0.3rem 0.5rem;
  border-radius: 999px;
  background: rgba(5, 8, 12, 0.52);
}

/* ---------- the foot ---------- */

.foot {
  padding-block: clamp(3rem, 9vh, 5.5rem) clamp(4rem, 12vh, 7rem);
}
.foot .col { padding-top: 2rem; border-top: 1px solid var(--rule); }
.foot p + p { margin-top: 0.4em; }

/* ---------- small screens ---------- */

@media (max-width: 819px) {
  .top { padding-bottom: clamp(2.5rem, 7vh, 4rem); }
  /* the depth line sits in the right margin, clear of the words, and its reading runs down beside it */
  .gauge { right: 0.6rem; height: 34vh; }
  .gauge-dot { width: 6px; height: 6px; }
  .gauge-read {
    right: 6px;
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    writing-mode: vertical-rl;
    padding: 0.45rem 0.22rem;
  }
  .btn { flex: 1 1 auto; }
  .after .btn { flex: 0 1 auto; }
}

/* ---------- the opening: one moment, then calm ---------- */

@keyframes surface {
  from { opacity: 0; transform: translateY(0.3em); }
  to { opacity: 1; transform: none; }
}
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: no-preference) {
  .js .top h1 { animation: surface 2.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s both; }
  .js .top .what { animation: surface 2.2s cubic-bezier(0.2, 0.7, 0.2, 1) 1.2s both; }
  .js .top .status { animation: surface 2.2s cubic-bezier(0.2, 0.7, 0.2, 1) 1.7s both; }
  .js .gauge { animation: appear 2s ease 2.4s both; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .water, .veil, .gauge, .trace, .strip, .ask, .after { display: none !important; }
  body { background: #fff; color: #000; }
}
