/* Home page: a field guide shot like a photo feature. */

@font-face {
  font-family: "Anybody";
  src: url("fonts/anybody-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-stretch: 50% 150%;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("fonts/literata-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("fonts/literata-italic-latin.woff2") format("woff2");
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
}

:root {
  --night: #0f1f19;
  --paper: #f6f9f7;
  --ink: #11201a;
  --kingfisher: #15b4cc;
  --chestnut: #732c19;
  --leaf: #bdd24e;
  --sky: #b6c3e1;
  --tab: 3.5rem;
  --pad: clamp(1.25rem, 5vw, 5rem);
  --display: "Anybody", "Arial Narrow", sans-serif;
  --text: "Literata", Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--chestnut) var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.65 var(--text);
  padding-right: var(--tab);
}

::selection { background: var(--leaf); color: var(--ink); }

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 4px; }
:focus-visible { outline: 3px solid currentColor; outline-offset: 4px; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 135%;
  line-height: .95;
  letter-spacing: -.01em;
  text-wrap: balance;
}
h2 { font-size: clamp(2.5rem, 6.5vw, 5.5rem); text-transform: uppercase; }
h3 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
p { max-width: 62ch; text-wrap: pretty; }

.skip { position: absolute; left: -999px; z-index: 30; background: var(--leaf); color: var(--ink); padding: .75rem 1rem; }
.skip:focus { left: 1rem; top: 1rem; }

/* Thumb tabs: the guide's index, always on the page edge. */
.tabs {
  position: fixed;
  z-index: 20;
  inset: 0 0 0 auto;
  width: var(--tab);
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  background: var(--night);
}
.tabs a {
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  font: 800 1rem/1 var(--display);
  font-stretch: 120%;
  text-decoration: none;
  margin-left: .75rem;
  transition: margin-left .35s cubic-bezier(.16, 1, .3, 1);
}
.tabs a:hover { margin-left: .25rem; }
.tabs a[aria-current="true"] { margin-left: -.5rem; }
.tabs a:focus-visible { outline-offset: -6px; }
.t-developer { background: var(--kingfisher); color: var(--ink); }
.t-migration { background: var(--sky); color: var(--ink); }
.t-apps { background: var(--chestnut); color: #fff; }
.t-plates { background: var(--leaf); color: var(--ink); }

/* Plate captions: species, then the true camera settings where known. */
figcaption {
  font: 600 .875rem/1.45 var(--display);
  font-stretch: 105%;
  padding-top: .625rem;
}
figcaption i { font-family: var(--text); font-weight: 400; }
figcaption span { display: block; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Cover */
.cover {
  position: relative;
  min-height: 100svh;
  background: var(--night);
  color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.cover-photo { position: absolute; inset: 0; }
.cover-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 40% 100%; }
.cover-title { position: relative; z-index: 1; padding: var(--pad) var(--pad) 0; }
.cover h1 {
  font-size: clamp(3.25rem, 11vw, 10.5rem);
  font-stretch: 150%;
  line-height: .86;
  text-transform: uppercase;
  text-shadow: 0 2px 24px rgb(5 15 10 / .45);
}
.cover h1 span { display: block; }
.cover-foot {
  position: relative;
  z-index: 1;
  align-self: flex-end;
  width: min(30rem, 100%);
  margin: 0 var(--pad) var(--pad);
  padding: 1.5rem;
  background: var(--night);
}
.cover-line { font-size: 1.375rem; line-height: 1.45; }
.button {
  display: inline-block;
  margin-top: 1.25rem;
  padding: .85rem 1.4rem;
  background: var(--kingfisher);
  color: var(--ink);
  font: 800 1rem/1.2 var(--display);
  font-stretch: 120%;
  text-decoration: none;
}
.button:hover { background: var(--leaf); }
.cover-foot figcaption { margin-top: 1.25rem; border-top: 1px solid rgb(255 255 255 / .3); }

@media (prefers-reduced-motion: no-preference) {
  /* One authored moment: the cover pulls into focus, like the lens did. */
  .cover-photo img { animation: pull-focus 1.5s cubic-bezier(.16, 1, .3, 1) both; }
  @keyframes pull-focus {
    from { filter: blur(18px) saturate(.7); transform: scale(1.07); }
    to { filter: blur(0) saturate(1); transform: scale(1); }
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tabs a { transition: none; }
}

section { scroll-margin-top: 0; }

/* Entry: the developer */
.developer {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  background: var(--kingfisher);
}
.developer-entry { padding: calc(var(--pad) * 1.4) var(--pad) var(--pad); container-type: inline-size; }
.developer h2 { font-size: clamp(2.25rem, 12cqi, 5.5rem); }
.latin { font-style: italic; font-size: 1.375rem; line-height: 1.45; margin-top: 1rem; }
.entry { margin-top: 2.5rem; border-top: 3px solid var(--ink); }
.entry div {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgb(17 32 26 / .4);
}
.entry dt { font: 800 1rem/1.7 var(--display); font-stretch: 115%; }
.portrait { display: flex; flex-direction: column; background: var(--night); color: #fff; }
.portrait img { flex: 1; width: 100%; min-height: 24rem; object-fit: cover; object-position: 55% 25%; }
.portrait figcaption { padding: .875rem 1.25rem 1.125rem; }

/* Entry: range and migration. The ground is sampled from the sky photo. */
.migration { background: var(--sky); overflow: hidden; }
.sky-plate { position: relative; }
.sky-plate img {
  width: 100%;
  height: clamp(22rem, 52vw, 46rem);
  object-fit: cover;
  object-position: 45% 45%;
  -webkit-mask-image: linear-gradient(transparent, #000 12%, #000 80%, transparent);
  mask-image: linear-gradient(transparent, #000 12%, #000 80%, transparent);
}
.sky-plate h2 { position: absolute; z-index: 1; right: var(--pad); top: var(--pad); max-width: 9ch; text-align: right; font-size: clamp(2.5rem, 4.5vw, 4.5rem); }
.sky-plate figcaption { position: absolute; right: var(--pad); bottom: 1rem; text-align: right; }
.route {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr;
  padding: 2rem var(--pad) calc(var(--pad) * 1.2);
}
.route li { position: relative; border-top: 3px dashed var(--ink); padding: 2.25rem 2rem 0 0; }
.route li::before {
  content: "";
  position: absolute;
  top: -.7rem;
  left: 0;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--ink);
}
.route li:last-child { border-top-color: transparent; }
.route li:last-child::before { background: var(--chestnut); outline: .35rem solid var(--paper); }
.route h3 { margin-bottom: .25rem; }
.route .when { font: 600 1rem/1.5 var(--display); margin-bottom: 1rem; font-variant-numeric: tabular-nums; }
.route p + p { margin-top: .75rem; }

/* Entry: apps */
.apps { background: var(--chestnut); color: #fff; padding: calc(var(--pad) * 1.4) var(--pad) var(--pad); }
.apps > p { margin-top: 1.25rem; font-size: 1.25rem; }
.app {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: end;
  margin-top: clamp(3rem, 7vw, 6rem);
}
.app:nth-of-type(even) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.app:nth-of-type(even) figure { order: 2; }
.app img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.app-text p { margin-top: 1rem; }
.app-text .status { font-style: italic; }
.links { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1.75rem; margin-top: 1.5rem; padding-top: .75rem; border-top: 3px solid currentColor; }
.links a { display: inline-block; padding: .4rem 0; font: 700 1rem/1.4 var(--display); font-stretch: 110%; }
.apps .contact { margin-top: clamp(3rem, 6vw, 5rem); }

/* Entry: plates */
.plates { padding: calc(var(--pad) * 1.4) var(--pad) var(--pad); }
.plates > p { margin-top: 1.25rem; }
.gallery {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 2.5rem 1.25rem;
  margin-top: 3rem;
}
.gallery figure { grid-column: span 6; }
.gallery .wide { grid-column: 1 / -1; }
.gallery .major { grid-column: span 8; }
.gallery .minor { grid-column: span 4; align-self: end; }
.plate { display: block; width: 100%; padding: 0; border: 0; overflow: hidden; background: var(--night); color: inherit; cursor: zoom-in; }
.gallery img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; transition: transform .6s cubic-bezier(.16, 1, .3, 1); }
.gallery .minor img { aspect-ratio: 4 / 5; }
.gallery .wide img { aspect-ratio: 21 / 9; object-position: 50% 62%; }
.plate:hover img { transform: scale(1.03); }
.plate:focus-visible { outline-color: var(--chestnut); }

/* Plate viewer */
.viewer { margin: auto; width: min(96vw, 1600px, 132vh); max-width: none; max-height: 96vh; border: 0; background: var(--night); color: #fff; padding: .75rem; }
.viewer::backdrop { background: rgb(5 15 10 / .92); }
.viewer form { display: flex; justify-content: flex-end; margin-bottom: .75rem; }
.viewer .button { margin: 0; border: 0; cursor: pointer; }
.viewer img { width: 100%; }

/* Photos are not draggable or long-press savable (a deterrent only). */
img { -webkit-user-drag: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* Close */
footer { background: var(--night); color: #fff; padding: calc(var(--pad) * 1.2) var(--pad); }
footer .now { font: 600 clamp(1.5rem, 3vw, 2.5rem)/1.3 var(--display); font-stretch: 115%; max-width: 28ch; text-wrap: balance; }
footer .links { margin-top: 2.5rem; }
footer .fine { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; font-size: 1rem; }

@media (max-width: 900px) {
  :root { --tab: 0px; }
  html { scroll-padding-bottom: 4rem; }
  body { padding: 0 0 3.5rem; }
  .tabs {
    inset: auto 0 0 0;
    width: auto;
    height: 3.5rem;
    grid-template-rows: none;
    grid-template-columns: repeat(4, 1fr);
  }
  .tabs a, .tabs a:hover { writing-mode: horizontal-tb; margin: 0; font-size: .875rem; font-stretch: 100%; }
  .tabs a[aria-current="true"] { margin: 0; box-shadow: inset 0 0 0 3px currentColor; }

  .cover { min-height: calc(100svh - 3.5rem); justify-content: flex-start; }
  .cover-photo { position: relative; flex: 1; min-height: 16rem; order: 2; }
  .cover-photo img { position: absolute; object-position: 18% 100%; }
  .cover-title { order: 1; padding-bottom: 1.5rem; }
  .cover h1 { font-stretch: 100%; font-size: clamp(3.5rem, 19vw, 8rem); }
  .cover-foot { order: 3; align-self: stretch; width: auto; margin: 0; padding: 1.25rem var(--pad); }
  .cover-line { font-size: 1.125rem; }

  .developer, .app, .app:nth-of-type(even) { grid-template-columns: minmax(0, 1fr); }
  .app:nth-of-type(even) figure { order: 0; }
  .entry div { grid-template-columns: minmax(0, 1fr); gap: .125rem; }

  .sky-plate h2 { position: static; max-width: none; text-align: left; padding: 3.5rem var(--pad) 0; }
  .sky-plate img { height: 24rem; object-position: 28% 50%; }
  .route { grid-template-columns: minmax(0, 1fr); }
  .route li { border-top: 0; border-left: 3px dashed var(--ink); padding: 0 0 2.5rem 1.75rem; }
  .route li::before { top: .25rem; left: -.72rem; }
  .route li:last-child { border-left-color: transparent; padding-bottom: 0; }

  .gallery figure, .gallery .major, .gallery .minor { grid-column: 1 / -1; }
  .gallery .minor img, .gallery .wide img { aspect-ratio: 3 / 2; }
}
