@import url("/css/fonts.css");

/* ---------------------------------------------------------------- tokens */
/* The desktop numbers here are measured off the original cover page rather
   than chosen: 60px side gutter, 40px above the content, a logo capped at
   180px tall, a 450px copy column and a 27px icon. The original is a fixed
   desktop layout, so these are fixed too, and the media query near the bottom
   takes over on small screens. */
:root {
  --paper:   #ffffff;
  /* Brand gold, sampled from the lion mark in the logo (#ac8400 exactly).
     Only used for links and focus rings, which the cover itself has none of. */
  --gold:       #ac8400;
  --gold-light: #e0b43c;
  --ink:     #1c2118;

  --font: "Roboto", "Helvetica Neue", Arial, sans-serif;

  --gutter-x:    60px;
  --gutter-y:    40px;
  --logo-height: 180px;
  --measure:     450px;
  --icon:        27px;
  --fade:        1400ms;
}

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

img, picture, svg { max-width: 100%; display: block; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 700; }

a { color: var(--gold-light); text-underline-offset: 3px; }
a:hover { color: var(--paper); }

:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: 0.8rem 1.2rem; font-size: 0.9rem;
}
.skip-link:focus { left: 1rem; top: 1rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ----------------------------------------------------------- cover stage */
/* The cover is the whole page, so the stage owns the viewport. 100dvh tracks
   the mobile URL bar as it collapses; the 100vh before it is the fallback for
   browsers without dvh, where a fixed 100vh would otherwise leave the copy
   under the browser chrome. */
.cover__stage {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}

/* ---------------------------------------------------------------- gallery */
/* Every frame occupies the same grid cell, so they stack without absolute
   positioning and the container keeps its own size. */
.cover__gallery {
  position: absolute;
  inset: 0;
  display: grid;
  /* Pin the single cell to the viewport. An auto track would grow to the
     tallest photograph (robotics is 4:3), pushing every frame taller than the
     screen and clipping its bottom edge. */
  grid-template: 100% / 100%;
  z-index: 0;
  background: var(--ink);
}

.cover__frame {
  grid-area: 1 / 1;
  min-height: 0;
  opacity: 0;
  transition: opacity var(--fade) ease-in-out;
}

/* Without JS only this rule applies, so the first photograph stays visible and
   the page still reads as designed. */
.cover__frame.is-active { opacity: 1; }

.cover__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* No scrim and no text-shadow: the original runs white copy straight over the
   photograph at full brightness, and anything laid over the top reads as a
   different site. The cost is that the copy is low-contrast against the
   brightest frames, exactly as it is on the original. */

/* ---------------------------------------------------------------- content */
.cover__content {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;        /* the copy sits along the top edge */
  padding: var(--gutter-y) var(--gutter-x);
}

/* The logo is centred across the top; the email icon is taken out of the flow
   and pinned to the right edge so it does not pull the logo off centre. */
.cover__inner {
  position: relative;
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 2rem;
}
.cover__copy {
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

.cover__logo {
  flex: none;
  /* Height-capped, width auto — the same constraint the original puts on its
     logo slice, which is what lands it at 283px wide. */
  height: var(--logo-height);
  width: auto;
}

/* 13px Roboto, as the original sets it. Fixed, not fluid: the original does
   not scale its copy, and scaling it is the thing that stops the page looking
   like the original on a large display. */
.cover__body {
  max-width: var(--measure);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.4;
  text-wrap: pretty;
  /* The original opens its copy with an empty paragraph, which drops the text
     roughly one line below the top of the logo. This is that offset, without
     the empty element. */
  margin-top: 29px;
}

/* The location sits centred under the logo, as a caption to it. */
.cover__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.cover__location {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.04em;
}

/* ------------------------------------------------------------- email icon */
.cover__links {
  position: absolute;
  top: 0;
  right: 0;
}

.icon-link {
  display: grid;
  place-items: center;
  width: var(--icon);
  height: var(--icon);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  color: var(--paper);
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}

.icon-link svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.icon-link:hover,
.icon-link:focus-visible {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--ink);
}

/* ------------------------------------------------------------------ small */
/* Tighter gutters and a logo sized to the screen; the icon stays top right. */
@media (max-width: 860px) {
  :root { --gutter-x: 24px; --gutter-y: 28px; }

  .cover__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
  }

  .cover__copy {
    flex-direction: column;
    gap: 1.75rem;
  }

  .cover__logo {
    height: auto;
    width: min(270px, 62vw);
    margin-inline: auto;
  }

  .cover__body { max-width: none; margin-top: 0; }

  .cover__brand { align-self: center; }
}

/* -------------------------------------------------------------------- 404 */
.page-404 .cover__content { align-items: center; }
.page-404 .cover__inner { justify-content: center; }
.page-404 .cover__copy { flex-direction: column; text-align: center; }
.page-404 .cover__logo { height: var(--logo-height); width: auto; margin-inline: auto; }
.page-404 .cover__body {
  margin: 1.5rem auto 0;
  max-width: 34em;
  /* The 404 centres its text over the middle of the photograph, where there is
     no horizon to fall back on, so this one does get a shadow. */
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}
.page-404 h1 {
  font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0 0 0.6em;
}
