/* Page basics, type, buttons, links, the aura and the photos, and the scroll-linked motion every page shares. */

/* Anchors scroll to just below the sticky header bar (--hdr-h, set in layout.css). */
html { scroll-behavior: smooth; background: var(--bg); scroll-padding-top: calc(var(--hdr-h) + 24px); }
body { margin: 0; background: var(--bg); }
[hidden] { display: none !important; }

.site {
  font-family: var(--ff);
  background: var(--bg);
  color: var(--fg);
  font-size: 17px;
  font-weight: 300;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
.site ::selection { background: var(--ember); color: #FFFFFF; }

a { color: inherit; text-decoration: none; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
svg { display: block; }

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 40;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--ff);
  font-weight: 400;
}
.skip:focus-visible { top: 16px; }

.wrap { width: 100%; max-width: 1296px; margin: 0 auto; padding-left: 48px; padding-right: 48px; box-sizing: border-box; }
.band { background: var(--band); }

/* Aura: one soft ember glow from the top right corner over a section's own background colour. */
.aura { background-image: radial-gradient(60% 80% at 100% 0%, var(--aura-ember), transparent 70%); }

/* Photo: a quietly rounded figure its image fills. The image sits a touch larger than the figure, so it can drift as
   the page scrolls and lean in on hover without showing an edge. */
.photo { --photo-radius: 12px; position: relative; margin: 0; overflow: hidden; border-radius: var(--photo-radius); background: var(--band); aspect-ratio: 3 / 2; }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; scale: 1.04; transition: scale 1.2s cubic-bezier(.2,.7,.2,1); }
@media (hover: hover) {
  a:hover .photo img, .photo:hover img { scale: 1.07; }
}

.h1 { font-size: 81px; line-height: .97; letter-spacing: -.03em; font-weight: 350; }
.h2 { font-size: 52px; line-height: 1.04; letter-spacing: -.025em; font-weight: 350; }
.h3 { font-size: 20px; line-height: 1.25; letter-spacing: -.01em; font-weight: 400; }
.h1, .h2, .h3 { text-wrap: balance; }
p, dd, li { text-wrap: pretty; }
.lead { font-size: 22px; line-height: 1.45; color: var(--muted); max-width: 32em; }
.lead-sm { font-size: 19px; }
.muted { color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 400;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: progress; opacity: .7; }
.btn-solid { background: var(--fg); color: var(--bg); }
.btn-solid:hover { background: var(--fg-hover); }
.btn-line { border-color: var(--line); color: var(--fg); background: transparent; }
.btn-line:hover { border-color: var(--fg); }

.textlink {
  font-weight: 400;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 6px;
  text-decoration-color: var(--line);
  transition: text-decoration-color .2s, text-decoration-thickness .2s;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.textlink:hover { text-decoration-color: var(--fg); text-decoration-thickness: 2.5px; }
.textlink-plain { min-height: 0; font-weight: 300; }

.stack { display: grid; }

/* Typed text: an element with the class `typed` holds its words as spans (the `typed` macro). As the page opens they
   drop in one after another, each settling from a little below and out of focus. --w is a word's place (from its
   position, up to 24 words), --step the time between words, --typed-start when the first one comes. Without motion
   the text simply stands. */
.typed .tw { display: inline-block; }
.typed .tw:nth-child(2) { --w: 1; }
.typed .tw:nth-child(3) { --w: 2; }
.typed .tw:nth-child(4) { --w: 3; }
.typed .tw:nth-child(5) { --w: 4; }
.typed .tw:nth-child(6) { --w: 5; }
.typed .tw:nth-child(7) { --w: 6; }
.typed .tw:nth-child(8) { --w: 7; }
.typed .tw:nth-child(9) { --w: 8; }
.typed .tw:nth-child(10) { --w: 9; }
.typed .tw:nth-child(11) { --w: 10; }
.typed .tw:nth-child(12) { --w: 11; }
.typed .tw:nth-child(13) { --w: 12; }
.typed .tw:nth-child(14) { --w: 13; }
.typed .tw:nth-child(15) { --w: 14; }
.typed .tw:nth-child(16) { --w: 15; }
.typed .tw:nth-child(17) { --w: 16; }
.typed .tw:nth-child(18) { --w: 17; }
.typed .tw:nth-child(19) { --w: 18; }
.typed .tw:nth-child(20) { --w: 19; }
.typed .tw:nth-child(21) { --w: 20; }
.typed .tw:nth-child(22) { --w: 21; }
.typed .tw:nth-child(23) { --w: 22; }
.typed .tw:nth-child(24) { --w: 23; }
@media (prefers-reduced-motion: no-preference) {
  .typed { --step: 90ms; --typed-start: 200ms; }
  .typed .tw { animation: word-in .5s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--typed-start) + var(--w, 0) * var(--step)); }
}
@keyframes word-in { from { opacity: 0; transform: translateY(.3em); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

/* Scroll-linked motion: one gentle vocabulary, run on the scroll position (animation-timeline) so it moves as fast as
   the visitor scrolls. Text and photos fade and rise a little into place, the children of .stagger one after the
   other, rules draw from the left and photos drift slightly as they cross the screen. Browsers without scroll-driven
   animations, and visitors who ask for less motion, see everything in place. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .rv { animation: rv-rise linear both; animation-timeline: view(); animation-range: entry 0px entry 240px; }
    .rv-grow { animation: rv-grow linear both; animation-timeline: view(); animation-range: entry 0px entry 280px; }
    .rv-rule { position: relative; border-top-color: transparent !important; }
    .rv-rule::before { content: ""; position: absolute; left: 0; right: 0; top: -1.5px; height: 1.5px; background: var(--fg); transform-origin: left center; animation: rv-line linear both; animation-timeline: view(); animation-range: entry 0px entry 360px; }
    .rv-fill { color: color-mix(in srgb, var(--fg) 20%, transparent); background-image: linear-gradient(var(--fg), var(--fg)); background-repeat: no-repeat; background-size: 0% 100%; background-clip: text; animation: rv-fill linear both; animation-timeline: view(); animation-range: entry 100px entry 700px; }
    .photo { animation: rv-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
    .photo img { animation: photo-drift linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
    .stagger > :nth-child(2) { animation-range: entry 80px entry 320px; }
    .stagger > :nth-child(3) { animation-range: entry 160px entry 400px; }
    .stagger > :nth-child(4) { animation-range: entry 240px entry 480px; }
    .stagger > :nth-child(5) { animation-range: entry 320px entry 560px; }
    .stagger > :nth-child(2)::before { animation-range: entry 80px entry 440px; }
    .stagger > :nth-child(3)::before { animation-range: entry 160px entry 520px; }
    .stagger > :nth-child(4)::before { animation-range: entry 240px entry 600px; }
    .stagger > :nth-child(5)::before { animation-range: entry 320px entry 680px; }
  }
}
@keyframes rv-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes rv-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rv-grow { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@keyframes rv-line { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes rv-line-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes rv-fill { to { background-size: 100% 100%; } }
@keyframes photo-drift { from { translate: 0 -1.5%; } to { translate: 0 1.5%; } }

/* Page changes: moving between the site's pages (the language switch included) is a view transition. The old page
   fades out lifting a little, the new one fades in rising into place; the header bar is its own part
   (view-transition-name in layout.css), so it stays still while the page under it changes. A theme switch is a view
   transition too (theme.js), drawn as a circle spreading from the toggle (html.theme-switching, below). */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: page-out .22s cubic-bezier(.4,0,1,1) both; }
::view-transition-new(root) { animation: page-in .42s cubic-bezier(.2,.7,.2,1) .06s both; }
@keyframes page-out { to { opacity: 0; transform: translateY(-12px); } }
@keyframes page-in { from { opacity: 0; transform: translateY(16px); } }
html.theme-switching::view-transition-old(root), html.theme-switching::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

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

@media (max-width: 900px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .h1 { font-size: 48px; }
  .h2 { font-size: 35px; }
  .lead { font-size: 18px; }
  .photo { --photo-radius: 10px; }
  .aura { background-image: radial-gradient(100% 50% at 100% 0%, var(--aura-ember), transparent 70%); }
  .stack { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
}

/* Phones held upright: the type follows the screen's width (vw) between a floor and the tablet size, and sections
   breathe less. */
@media (max-width: 600px) {
  .site { font-size: 16px; }
  .h1 { font-size: clamp(35px, 9.7vw, 48px); }
  .h2 { font-size: clamp(28px, 7.7vw, 35px); }
  .h3 { font-size: 18px; }
  .lead, .lead-sm { font-size: 17px; }
  .btn { min-height: 48px; padding: 0 20px; font-size: 15px; }
}
