/* Etak Labs company site. Same type and paper as the Reliability landing page, with its own picture: a wide
   coast at first light, in which Reliability's lighthouse is one small light. The hero is animated with CSS
   only. No JavaScript.
   Type: one family, three sizes below the hero (heading, body, small); the hero and page titles are larger. */

:root {
  --paper: #F3F0E4;
  --ink: #1D2232;
  --ink-2: #444B5E;
  --ochre-ink: #765619;
  --cream: #F7F1E3;
  --cream-2: #E4DDCD;
  --gold: #E8B75A;
  --night: #1A2538;
  --rule: rgba(29, 34, 50, 0.18);
  --rule-night: rgba(247, 241, 227, 0.22);
  --font: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --gutter: clamp(16px, 6vw, 96px);
  --measure: 40rem;
  --space: clamp(40px, 5.5vw, 72px);
  --text-heading: clamp(28px, 3.4vw, 40px);
  --text-body: 19px;
  --text-sm: 16px;
  --wide: 68rem;
}

* { box-sizing: border-box; }
html {
  background: var(--paper);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--font);
  font-optical-sizing: auto;
  font-size: var(--text-body);
  line-height: 30px;
  overflow-x: hidden;
}
main { flex: 1 0 auto; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ochre-ink); }
img, svg { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

.skip {
  position: absolute; left: 16px; top: 16px; z-index: 50;
  padding: 8px 12px; border-radius: 9999px;
  background: var(--cream); color: var(--ink); font-size: var(--text-sm); font-weight: 600;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* ---------- bar ---------- */
.bar {
  position: absolute; z-index: 20; top: 16px; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: clamp(20px, 4vw, 44px);
  padding: 6px 8px 6px 14px;
  border-radius: 9999px;
  color: var(--cream);
  background: rgba(20, 28, 46, 0.6);
  border: 1px solid rgba(247, 241, 227, 0.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
}
.bar.solid { position: static; transform: none; margin: 16px auto 0; background: var(--night); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; font-size: 20px; white-space: nowrap; }
.brand:hover { color: var(--cream); }
.brand img { width: 26px; height: 26px; border-radius: 6px; }
.bar nav { display: flex; gap: 2px; flex-wrap: wrap; }
.bar nav a {
  padding: 6px 12px; border-radius: 9999px; text-decoration: none; font-size: var(--text-sm); line-height: 20px;
  white-space: nowrap;
}
.bar nav a:hover { color: var(--cream); background: rgba(247, 241, 227, 0.12); }
.bar nav a[aria-current="page"] { background: rgba(247, 241, 227, 0.16); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; min-height: min(80vh, max(600px, 42vw));
  display: flex; align-items: flex-end;
  color: var(--cream);
  background: var(--night);
}
.hero-text {
  position: relative; width: 100%; max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto;
  padding: 0 var(--gutter) clamp(28px, 6vh, 56px);
}
.hero h1 { margin: 0; font-size: clamp(56px, 10vw, 112px); line-height: 0.95; font-weight: 500; letter-spacing: -0.03em; }
.hero p { margin: 14px 0 0; font-size: clamp(20px, 2.6vw, 28px); line-height: 1.3; color: var(--cream-2); max-width: 26ch; }

/* The picture. Without container units (older browsers) it is the still painting, laid like a cover background. */
.hero-art { position: absolute; inset: 0; overflow: hidden; }
.scene { position: absolute; inset: 0; }
.scene .base { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 70% 30%; }
.scene > :not(.base) { display: none; }

/* With them it is a scene: a 16:9 box laid over the hero the way "cover" would lay it (70% across, 30% down), so
   everything in it is placed by percentage and stays in register however the hero is cropped. The painting fills
   the box. Over it sit the lit lamp, the far lights and three layers of sparkle on the water (each cut from a
   painting of the same scene, so it fades in and out exactly), the glows, the mist, and the boat and gulls.
   The layer boxes come from tools/build_assets.py. Only opacity and transform are animated. */
@supports (width: 1cqw) {
  .hero-art { container-type: size; }
  .scene {
    --w: max(100cqw, 177.778cqh); --h: max(100cqh, 56.25cqw); --px: 0.70;
    inset: auto; width: var(--w); height: var(--h);
    left: calc((100cqw - var(--w)) * var(--px)); top: calc((100cqh - var(--h)) * 0.30);
  }
  .scene .base { object-fit: fill; }
  .scene > :not(.base) { display: block; position: absolute; max-width: none; }

  .lamp { left: 58.75%; top: 41.111%; width: 3.125%; height: 13.333%; }
  .far { left: 11.25%; top: 37.778%; width: 59.375%; height: 11.111%; }
  .shimmer.a { left: 0; top: 40%; width: 98.75%; height: 23.333%; opacity: 0.7; }
  .shimmer.b { left: 0; top: 40%; width: 98.125%; height: 23.333%; opacity: 0.25; }
  .shimmer.c { left: 0; top: 40%; width: 75.625%; height: 18.889%; opacity: 0.5; }

  .sun {
    left: 78%; top: 37.5%; width: 44%; height: 20%; transform: translate(-50%, -50%); opacity: 0.6;
    background: radial-gradient(closest-side, rgba(255, 233, 170, 0.5), rgba(255, 224, 150, 0.2) 55%, rgba(255, 224, 150, 0));
  }
  .mist {
    left: 50%; top: 40.5%; width: 52%; height: 9%; opacity: 0.75; filter: blur(0.5cqw);
    background:
      radial-gradient(closest-side, rgba(243, 240, 228, 0.55), rgba(243, 240, 228, 0)) 8% 60% / 34% 55% no-repeat,
      radial-gradient(closest-side, rgba(243, 240, 228, 0.5), rgba(243, 240, 228, 0)) 52% 40% / 42% 60% no-repeat,
      radial-gradient(closest-side, rgba(243, 240, 228, 0.45), rgba(243, 240, 228, 0)) 96% 75% / 38% 50% no-repeat;
  }
  .glow {
    width: 15%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); opacity: 0.7;
    background: radial-gradient(closest-side, rgba(255, 222, 150, 0.85), rgba(246, 196, 104, 0.38) 22%, rgba(240, 186, 96, 0.12) 55%, rgba(240, 186, 96, 0));
  }
  .glow.main { left: 60.4%; top: 43.2%; }
  .glow.f1, .glow.f2, .glow.f3 { width: 2.6%; }
  .glow.f1 { left: 51.05%; top: 40.15%; }
  .glow.f2 { left: 12.2%; top: 40.2%; }
  .glow.f3 { left: 69%; top: 46.3%; }

  /* The boat: four painted frames side by side, shown one at a time, with its wake behind it. Its waterline sits
     on the line "top". The gulls: eight frames of one wing beat. */
  .boat { left: 0; top: 50.7%; width: 3.6%; aspect-ratio: 300 / 420; translate: calc(var(--w) * 0.52) -70%; }
  .boat .frames, .gull .frames { position: absolute; inset: 0; overflow: hidden; }
  .boat .frames img { display: block; width: 400%; height: 100%; max-width: none; }
  .boat .wake { position: absolute; right: 68%; top: 65%; width: 190%; max-width: none; opacity: 0.8; }
  .gull { left: 0; aspect-ratio: 4 / 3; opacity: 0.85; }
  .gull .frames img { display: block; width: 800%; height: 100%; max-width: none; translate: -25% 0; }
  .gull.g1 { top: 15%; width: 3%; translate: calc(var(--w) * 0.80) 0; }
  .gull.g2 { top: 19%; width: 2.4%; translate: calc(var(--w) * 0.845) 0; }
  .gull.g3 { top: 12.5%; width: 2%; translate: calc(var(--w) * 0.87) 0; }
}

@media (prefers-reduced-motion: no-preference) {
  @supports (width: 1cqw) {
    /* First light: the scene starts cooler and dimmer and warms up once. */
    .hero-art::after {
      content: ""; position: absolute; inset: 0; opacity: 0; pointer-events: none;
      background: linear-gradient(to bottom, #6E7997 0%, #9396AC 42%, #5F6A87 100%); mix-blend-mode: multiply;
      animation: first-light 8s ease-out both;
    }
    .sun { animation: sun 18s ease-in-out infinite; }
    .mist { animation: mist 46s ease-in-out infinite alternate; }
    .lamp { animation: lamp 8s ease-in-out infinite; }
    .glow.main { animation: lamp-glow 8s ease-in-out infinite; }
    .far, .glow.f1 { animation: twinkle 5s ease-in-out infinite; }
    .glow.f2 { animation: twinkle 7s ease-in-out -3s infinite; }
    .glow.f3 { animation: twinkle 9s ease-in-out -5s infinite; }
    .shimmer.a { animation: glint 5s ease-in-out infinite, drift 23s ease-in-out infinite alternate; }
    .shimmer.b { animation: glint 7s ease-in-out -3s infinite, drift 31s ease-in-out -9s infinite alternate-reverse; }
    .shimmer.c { animation: glint 3.7s ease-in-out -1s infinite; }

    .boat { animation: sail 170s linear -75s infinite, pitch 6.5s ease-in-out infinite alternate; transform-origin: 50% 70%; }
    .boat .frames img { animation: boat-frames 1.9s steps(4) infinite; }
    .boat .wake { animation: wake 3.1s ease-in-out infinite alternate; }
    .gull .frames img { animation: flap 4.2s linear infinite; }
    .gull.g1 { animation: fly-1 78s linear -34s infinite, lift 7s ease-in-out infinite alternate; }
    .gull.g2 { animation: fly-2 91s linear -52s infinite, lift 9s ease-in-out -4s infinite alternate; }
    .gull.g3 { animation: fly-3 104s linear -18s infinite, lift 11s ease-in-out -7s infinite alternate; }
    .gull.g2 .frames img { animation-duration: 3.6s; animation-delay: -1.3s; }
    .gull.g3 .frames img { animation-duration: 4.9s; animation-delay: -2.6s; }
  }
}
@keyframes first-light { from { opacity: 0.85; } to { opacity: 0; } }
@keyframes sun { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@keyframes mist { from { translate: -5% 0; opacity: 0.55; } to { translate: 6% 0; opacity: 0.9; } }
/* The lamp turns: a long dim stretch, a swell, a brief full flash as it faces us. */
@keyframes lamp { 0%, 100% { opacity: 0.35; } 38% { opacity: 0.5; } 50% { opacity: 1; } 62% { opacity: 0.5; } }
@keyframes lamp-glow {
  0%, 100% { opacity: 0.18; transform: translate(-50%, -50%) scale(0.55); }
  38%, 62% { opacity: 0.35; transform: translate(-50%, -50%) scale(0.75); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
}
@keyframes twinkle { 0%, 100% { opacity: 0.25; } 45% { opacity: 1; } 60% { opacity: 0.55; } 75% { opacity: 0.95; } }
@keyframes glint { 0%, 100% { opacity: 0.05; } 50% { opacity: 1; } }
@keyframes drift { from { translate: -0.35% 0; } to { translate: 0.35% 0; } }
/* The boat crosses the bay towards the headland and fades out before it; then starts again. */
@keyframes sail {
  0% { translate: calc(var(--w) * 0.36) -70%; opacity: 0; }
  4%, 96% { opacity: 1; }
  100% { translate: calc(var(--w) * 0.71) -70%; opacity: 0; }
}
@keyframes pitch { from { transform: translateY(-2.5%) rotate(-2.2deg); } to { transform: translateY(2.5%) rotate(1.8deg); } }
@keyframes boat-frames { to { translate: -100% 0; } }
@keyframes wake { from { opacity: 0.55; transform: scaleX(0.92); } to { opacity: 0.9; transform: scaleX(1.05); } }
/* Two wing beats, then a glide on level wings (the third frame). Each interval steps through eight frames. */
@keyframes flap {
  0% { translate: 0 0; animation-timing-function: steps(8); }
  18% { translate: -100% 0; animation-timing-function: step-end; }
  18.01% { translate: 0 0; animation-timing-function: steps(8); }
  36% { translate: -100% 0; animation-timing-function: step-end; }
  36.01%, 100% { translate: -25% 0; }
}
@keyframes lift { from { transform: translateY(-45%) rotate(-4deg); } to { transform: translateY(55%) rotate(3deg); } }
@keyframes fly-1 {
  0% { translate: calc(var(--w) * 0.50) calc(var(--h) * 0.03); opacity: 0; }
  6%, 92% { opacity: 0.85; }
  100% { translate: calc(var(--w) * 1.0) calc(var(--h) * -0.05); opacity: 0; }
}
@keyframes fly-2 {
  0% { translate: calc(var(--w) * 0.46) calc(var(--h) * -0.02); opacity: 0; }
  6%, 92% { opacity: 0.8; }
  100% { translate: calc(var(--w) * 1.0) calc(var(--h) * 0.02); opacity: 0; }
}
@keyframes fly-3 {
  0% { translate: calc(var(--w) * 0.55) calc(var(--h) * 0.04); opacity: 0; }
  6%, 92% { opacity: 0.75; }
  100% { translate: calc(var(--w) * 1.0) calc(var(--h) * -0.03); opacity: 0; }
}

/* ---------- sections ---------- */
main section { padding: var(--space) var(--gutter) 0; scroll-margin-top: 8px; }
.inner { max-width: var(--wide); margin: 0 auto; }
h2, .title {
  margin: 0; font-size: var(--text-heading); line-height: 1.15; font-weight: 500; letter-spacing: -0.015em;
  text-wrap: balance;
}
h3 { margin: 0 0 4px; font-size: var(--text-body); line-height: 30px; font-weight: 600; }
p { margin: 0 0 16px; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

/* Heading in a narrow left column, text in a wide right one; one column on small screens. */
.split {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 16px clamp(24px, 5vw, 72px); align-items: start;
}
.split + .split { margin-top: clamp(28px, 4vw, 48px); }

/* Goals: three statements at heading size, ruled off from each other. */
.goals {
  list-style: none; margin: clamp(20px, 3vw, 32px) 0 0; padding: 0;
  border-top: 1px solid var(--rule);
}
.goals li {
  padding: clamp(12px, 1.8vw, 18px) 0; border-bottom: 1px solid var(--rule);
  font-size: var(--text-heading); line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance;
}

/* Work: one ruled row for each project. */
.rows { margin-top: clamp(20px, 3vw, 32px); border-top: 1px solid var(--rule); }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 12px clamp(24px, 5vw, 72px); align-items: start;
  padding: clamp(18px, 2.4vw, 26px) 0; border-bottom: 1px solid var(--rule);
}
.row .title a { text-decoration: none; }
.links { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0; padding: 0; list-style: none; }
.links a { font-size: var(--text-sm); line-height: 24px; }
.go { font-weight: 600; text-decoration: none; }
.go:hover { text-decoration: underline; }
.go::after { content: " \2192"; }
.go.out::after { content: " \2197"; }

/* Theory of change: a dark band. */
main section.band {
  margin-top: var(--space); padding-bottom: var(--space);
  background: var(--night); color: var(--cream);
}
.band a:hover { color: var(--gold); }
.band p { color: var(--cream-2); }
.steps {
  list-style: none; counter-reset: step;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px clamp(24px, 4vw, 56px);
  margin: clamp(24px, 3.5vw, 40px) 0 0; padding: 0;
}
.steps li { position: relative; counter-increment: step; padding-top: 20px; border-top: 1px solid var(--rule-night); }
.steps li::before {
  content: counter(step); display: block; margin-bottom: 12px;
  font-size: var(--text-heading); line-height: 1; color: var(--gold);
}
/* An arrowhead at the end of each rule: one step leads to the next. */
.steps li::after {
  content: ""; position: absolute; top: -5px; right: -1px;
  border: 5px solid transparent; border-left: 8px solid var(--gold); border-right-width: 0;
}
.steps h3 { color: var(--cream); }
.loop {
  display: flex; align-items: center; gap: clamp(16px, 2.4vw, 28px);
  margin: clamp(24px, 3.5vw, 40px) 0 clamp(32px, 4.5vw, 56px);
}
.loop svg { flex: none; width: clamp(56px, 7vw, 80px); height: auto; color: var(--gold); }
.loop p { max-width: 30ch; font-size: var(--text-heading); line-height: 1.2; letter-spacing: -0.015em; color: var(--cream); text-wrap: balance; }
.plain { list-style: none; margin: 0; padding: 0; max-width: var(--measure); }
.plain li { position: relative; padding: 0 0 12px 24px; }
.plain li:last-child { padding-bottom: 0; }
.plain li::before { content: ""; position: absolute; left: 0; top: 14px; width: 12px; height: 1px; background: currentColor; }
.band .plain { color: var(--cream-2); }
.band .plain li::before { background: var(--gold); }

.button {
  display: inline-block; padding: 8px 18px; border-radius: 9999px; text-decoration: none; font-weight: 600;
  background: var(--night); color: var(--cream);
}
.button:hover { color: var(--gold); }

/* ---------- pages other than home ---------- */
.page { padding-top: clamp(28px, 5vw, 56px); }
.page h1 { margin: 0 0 20px; font-size: clamp(44px, 7vw, 80px); line-height: 1; font-weight: 500; letter-spacing: -0.025em; }
.page .rows { margin-top: clamp(28px, 4vw, 44px); }
/* A plain notice on a page that is not finished. */
.status { padding-left: 14px; border-left: 3px solid var(--gold); font-weight: 600; }

/* ---------- footer ---------- */
/* A band of the coast runs the full width. The picture is painted on white, which takes the page colour
   (multiply); the band starts just under the picture's white top and its sea darkens into the footer below. */
.foot { margin-top: clamp(16px, 2.5vw, 32px); color: var(--cream); }
.foot-art {
  position: relative; overflow: hidden;
  height: clamp(150px, 21vw, 440px);
  background: var(--paper);
}
.foot-art img {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
  object-fit: cover; object-position: 50% 58%;
  mix-blend-mode: multiply;
}
.foot-art::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, var(--paper) 0%, rgba(243, 240, 228, 0) 22%),
    linear-gradient(to bottom, rgba(26, 37, 56, 0) 55%, rgba(26, 37, 56, 0.55) 82%, var(--night) 100%);
}
.foot-body { background: var(--night); padding: clamp(20px, 3vw, 36px) var(--gutter) 24px; }
.foot-inner {
  max-width: var(--wide); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px clamp(32px, 8vw, 120px);
}
.foot .brand { font-size: 24px; }
.foot .brand img { width: 30px; height: 30px; }
.foot-brand p { margin: 12px 0 0; max-width: 22ch; color: var(--cream-2); }
.foot-nav { display: flex; flex-wrap: wrap; gap: 32px clamp(32px, 6vw, 80px); }
.foot-nav h2 { margin: 0 0 10px; font-size: var(--text-sm); line-height: 24px; font-weight: 600; letter-spacing: 0; color: var(--cream); }
.foot-nav ul { margin: 0; padding: 0; list-style: none; }
.foot-nav li { font-size: var(--text-sm); line-height: 30px; }
.foot-nav a { color: var(--cream-2); text-decoration: none; }
.foot a:hover { color: var(--gold); }
.foot-nav a:hover { text-decoration: underline; }
.foot-legal {
  max-width: var(--wide); margin: clamp(20px, 3vw, 32px) auto 0; padding-top: 16px;
  border-top: 1px solid var(--rule-night);
  font-size: var(--text-sm); line-height: 24px; color: var(--cream-2);
}

@media (max-width: 800px) {
  .split, .row, .foot-inner { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .steps li::after { display: none; }
}
@media (max-width: 640px) {
  .bar { border-radius: 20px; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 12px; }
  .bar nav { margin-left: -8px; }
  .bar nav a { padding: 6px 8px; font-size: 15px; }
  /* Keeps the links on one line; screen readers still get the whole label. */
  .bar nav .wide { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .hero { min-height: 78vh; }
  .scene { --px: 0.71; }
  .loop { align-items: flex-start; }
}
