/* A terrestrial globe, printed on laid paper, mounted in brass. */

:root {
  color-scheme: light;
  --paper: #efe4c9;
  --paper-2: #e5d4ad;
  --paper-3: #d9c393;
  --ink: #2a1e14;
  --ink-soft: #5b4632;
  --ink-faint: rgba(42, 30, 20, 0.18);
  --red: #9a3322;
  --sea: #a9bca6;
  --sea-deep: #6f8a78;
  --brass: #a9864b;
  --brass-dark: #6e5429;
  --display: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --caps: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --body: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --gutter: clamp(16px, 4vw, 48px);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 50% 35%, rgba(255, 250, 235, 0.55), rgba(255, 250, 235, 0) 60%),
    radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0) 55%, rgba(110, 76, 30, 0.22) 100%),
    url("../img/paper.svg");
  color: var(--ink);
  font: 400 1.1875rem/1.6 var(--body);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration-color: var(--red); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--red); }
:focus-visible { outline: 2px dashed var(--red); outline-offset: 4px; }

::selection { background: var(--red); color: var(--paper); }

/* ---------- Masthead: the maker's imprint along the top edge ---------- */

.masthead {
  padding: 18px var(--gutter) 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
}

.imprint {
  font: 400 1.05rem/1 var(--caps);
  letter-spacing: 0.14em;
  text-decoration: none;
  white-space: nowrap;
}
.imprint em { font-family: var(--display); font-style: italic; letter-spacing: 0; text-transform: none; }

.masthead nav { display: flex; flex-wrap: wrap; gap: 4px 20px; font: 400 1rem/1.4 var(--caps); letter-spacing: 0.08em; }
.masthead nav a { text-decoration: none; padding: 6px 0; border-bottom: 1px solid transparent; }
.masthead nav a[aria-current="page"] { border-bottom-color: var(--red); color: var(--red); }

.rule {
  margin: 14px var(--gutter) 0;
  height: 7px;
  border-top: 1.5px solid var(--ink);
  border-bottom: 0.5px solid var(--ink);
}

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Cartouche: the label every real globe carries ---------- */

.cartouche {
  position: relative;
  margin: 40px auto 0;
  max-width: 760px;
  text-align: center;
  padding: 30px clamp(18px, 5vw, 56px) 32px;
  border: 1.5px solid var(--ink);
  outline: 0.5px solid var(--ink);
  outline-offset: -7px;
  background: rgba(255, 250, 232, 0.35);
}
.cartouche::before,
.cartouche::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  transform: translateY(-50%) rotate(45deg);
}
.cartouche::before { left: -12px; }
.cartouche::after { right: -12px; }

.kicker { margin: 0; font: 400 0.95rem/1.3 var(--caps); letter-spacing: 0.32em; }
.cartouche .small-italic { margin: 10px 0 0; font: italic 400 1.15rem/1.35 var(--display); color: var(--ink-soft); }
.name {
  margin: 6px 0 0;
  font: 400 clamp(4.2rem, 17vw, 8.5rem)/0.9 var(--caps);
  letter-spacing: 0.08em;
  margin-right: -0.08em;
}
.of-place { margin: 8px 0 0; font: italic 400 1.2rem/1.35 var(--display); }
.flourish { display: block; width: 160px; height: 14px; margin: 18px auto; color: var(--ink); }
.one-liner {
  margin: 0;
  font: italic 400 clamp(1.6rem, 4.6vw, 2.35rem)/1.2 var(--display);
  text-wrap: balance;
}
.one-liner em { font-style: normal; }

/* ---------- The globe itself ---------- */

.globe { margin: 0; position: relative; }
.globe-stage { position: relative; width: 100%; aspect-ratio: 200 / 224; }
.globe-stage canvas {
  position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: 1;
  cursor: grab; touch-action: pan-y; border-radius: 50%;
}
.globe-stage canvas:active { cursor: grabbing; }
.globe-stage canvas.over-pin { cursor: pointer; }
.globe-mount { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.globe-note {
  margin: 10px auto 0;
  max-width: 34ch;
  text-align: center;
  font: italic 400 1.02rem/1.4 var(--display);
  color: var(--ink-soft);
  min-height: 2.8em;
}

/* Pimienta, the globe-maker's dog */
.dog { position: absolute; left: 0; top: 0; width: 63px; height: 42px; margin: -21px 0 0 -31.5px; pointer-events: none; opacity: 0; transition: opacity 0.25s; will-change: transform; z-index: 3; }
.dog.is-out { opacity: 1; }
.dog svg { display: block; width: 100%; height: 100%; overflow: visible; }
.dog .leg { transform-box: fill-box; transform-origin: 50% 0; }
.dog.is-running .leg { animation: gallop 0.22s linear infinite alternate; }
.dog.is-running .leg.b { animation-delay: -0.11s; }
.dog .tail { transform-box: fill-box; transform-origin: 100% 100%; }
.dog.is-sitting .tail { animation: wag 0.18s ease-in-out infinite alternate; }
.bark {
  position: absolute; left: 70%; bottom: 105%;
  font: italic 400 15px/1 var(--display); color: var(--red); white-space: nowrap;
  background: var(--paper); border: 1px solid var(--ink); padding: 4px 7px 5px;
  opacity: 0; transform: translateY(4px) scale(0.8); transform-origin: 0 100%;
  transition: opacity 0.2s, transform 0.2s;
}
.dog.is-sitting .bark { opacity: 1; transform: none; }
@keyframes gallop { from { transform: rotate(-32deg); } to { transform: rotate(32deg); } }
@keyframes wag { from { transform: rotate(-18deg); } to { transform: rotate(14deg); } }

/* ---------- Home composition ---------- */

.orb { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px clamp(24px, 4vw, 56px); align-items: center; margin-top: 44px; }
.orb .globe { max-width: 600px; width: 100%; justify-self: center; }

/* the sea-monster panel, redrawn as a fish */
.anchovy {
  position: relative;
  text-align: center;
  padding: 26px 22px 28px;
  border: 1.5px solid var(--ink);
  background:
    repeating-linear-gradient(0deg, rgba(111, 138, 120, 0.16) 0 1px, transparent 1px 7px),
    rgba(169, 188, 166, 0.35);
}
.anchovy .kicker { color: var(--ink-soft); }
.anchovy svg { display: block; width: min(100%, 320px); margin: 16px auto 6px; color: var(--ink); }
.opinion {
  margin: 0;
  font: 400 clamp(2.8rem, 7vw, 4.6rem)/0.95 var(--display);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.opinion span { color: var(--red); font-style: italic; }
.anchovy .fine { margin: 14px auto 0; max-width: 30ch; font: italic 400 1rem/1.4 var(--display); color: var(--ink-soft); }

.legend-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px clamp(24px, 4vw, 56px); margin: 56px 0 24px; align-items: start; }
.panel-title { margin: 0 0 12px; font: 400 1rem/1.2 var(--caps); letter-spacing: 0.3em; text-align: center; border-bottom: 1px solid var(--ink); padding-bottom: 8px; }
.legend { list-style: none; margin: 0; padding: 0; }
.legend li { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px dotted var(--ink-soft); }
.legend .sym { font: 400 1.1rem/1 var(--caps); color: var(--red); text-align: center; }
.legend .sym.star { font-size: 1.4rem; }
.legend a { font: 400 1.35rem/1.2 var(--display); text-decoration: none; }
.legend a:hover { text-decoration: underline; }
.legend small { display: block; font: italic 400 0.98rem/1.3 var(--display); color: var(--ink-soft); }
.legend .coord { font: 400 0.82rem/1 var(--caps); letter-spacing: 0.06em; color: var(--ink-soft); white-space: nowrap; }
.legend .line { display: inline-block; width: 30px; height: 0; border-top: 1.5px dashed var(--red); vertical-align: middle; }
.legend .line.solid { border-top-style: solid; border-top-color: var(--ink-soft); }

.explanation p { margin: 0 0 12px; }
.explanation p:first-of-type::first-letter { font: 400 3.4em/0.8 var(--display); float: left; margin: 6px 8px 0 0; color: var(--red); }

/* ---------- Plates (project pages) ---------- */

.gores { display: block; width: 100%; max-width: 760px; height: auto; margin: 32px auto 0; color: var(--ink); }

.plate-head { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px 48px; align-items: center; margin-top: 28px; }
.plate-no { margin: 0; font: 400 1rem/1 var(--caps); letter-spacing: 0.34em; color: var(--red); }
.plate-title { margin: 10px 0 0; font: 400 clamp(3rem, 9vw, 5.6rem)/0.95 var(--display); letter-spacing: -0.01em; text-wrap: balance; }
.plate-sub { margin: 14px 0 0; font: italic 400 clamp(1.25rem, 3vw, 1.55rem)/1.35 var(--display); color: var(--ink-soft); text-wrap: balance; }
.coords { margin: 18px 0 0; font: 400 0.95rem/1.4 var(--caps); letter-spacing: 0.1em; }
.plate-head .globe { max-width: 380px; width: 100%; justify-self: center; }

.plate-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px 56px; margin-top: 40px; }
.survey section { padding: 26px 0 8px; border-top: 1px solid var(--ink); }
.survey section:first-child { border-top: 1.5px solid var(--ink); }
.survey h2 { margin: 0 0 12px; display: flex; gap: 16px; align-items: baseline; font: 400 1.9rem/1.1 var(--display); }
.survey h2 b { font: 400 0.95rem/1 var(--caps); letter-spacing: 0.2em; color: var(--red); min-width: 2.2em; }
.survey p { margin: 0 0 16px; max-width: 62ch; }
.survey .aside { font: italic 400 1.2rem/1.45 var(--display); color: var(--ink-soft); border-left: 2px solid var(--red); padding-left: 16px; }

.particulars { align-self: start; position: sticky; top: 24px; border: 1.5px solid var(--ink); outline: 0.5px solid var(--ink); outline-offset: -6px; padding: 22px 22px 16px; background: rgba(255, 250, 232, 0.4); }
.particulars dl { margin: 0; }
.particulars dt { font: 400 0.8rem/1 var(--caps); letter-spacing: 0.18em; color: var(--ink-soft); margin-top: 14px; }
.particulars dd { margin: 4px 0 0; font: 400 1.1rem/1.35 var(--display); }
.particulars .scale { margin-top: 20px; }

.plate-nav { display: flex; justify-content: space-between; gap: 16px; margin: 48px 0 8px; padding: 16px 0; border-top: 1.5px solid var(--ink); border-bottom: 0.5px solid var(--ink); font: 400 1.1rem/1.3 var(--display); }
.plate-nav a { text-decoration: none; }
.plate-nav small { display: block; font: 400 0.8rem/1.2 var(--caps); letter-spacing: 0.2em; color: var(--ink-soft); }
.plate-nav .next { text-align: right; margin-left: auto; }

/* ---------- About ---------- */

.maker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px 56px; margin-top: 40px; align-items: start; }
.maker .survey p:first-child::first-letter { font: 400 3.4em/0.8 var(--display); float: left; margin: 6px 8px 0 0; color: var(--red); }

.postcard {
  position: relative;
  border: 1.5px solid var(--ink);
  background: #f6eed9;
  padding: 22px;
  box-shadow: 6px 7px 0 rgba(42, 30, 20, 0.14);
  transform: rotate(-0.8deg);
}
.postcard .stamp {
  position: absolute; right: 18px; top: 18px; width: 74px; height: 88px;
  border: 2px dotted var(--ink-soft); display: grid; place-items: center; background: var(--sea);
}
.postcard .stamp svg { width: 58px; height: 58px; }
.postcard .postmark { position: absolute; right: 58px; top: 30px; width: 80px; height: 80px; color: var(--red); opacity: 0.75; pointer-events: none; }
.postcard h2 { margin: 0 0 18px; font: 400 1.05rem/1 var(--caps); letter-spacing: 0.3em; }
.postcard label { display: block; font: 400 0.8rem/1 var(--caps); letter-spacing: 0.2em; color: var(--ink-soft); margin-top: 16px; max-width: calc(100% - 96px); }
.postcard label.full { max-width: none; }
.postcard input,
.postcard textarea {
  display: block; width: 100%; margin-top: 4px; border: 0; border-bottom: 1px solid var(--ink-soft);
  background: transparent; font: italic 400 1.25rem/1.6 var(--display); color: var(--ink); padding: 2px 0; border-radius: 0;
}
.postcard textarea {
  resize: vertical; min-height: 7.2em; border: 0;
  background-image: repeating-linear-gradient(transparent 0 calc(1.6em - 1px), rgba(91, 70, 50, 0.6) calc(1.6em - 1px) 1.6em);
  background-attachment: local;
}
.postcard input:focus,
.postcard textarea:focus { outline: none; background-color: rgba(154, 51, 34, 0.05); }
.postcard button {
  margin-top: 20px; font: 400 1rem/1 var(--caps); letter-spacing: 0.2em; color: var(--paper); background: var(--red);
  border: 0; padding: 14px 20px; cursor: pointer; box-shadow: 3px 3px 0 var(--ink);
}
.postcard button:hover { background: var(--ink); }
.postcard .alt { margin: 18px 0 0; font: italic 400 1.05rem/1.45 var(--display); color: var(--ink-soft); }

/* ---------- 404 ---------- */

.lost { text-align: center; margin: 32px auto 0; max-width: 700px; }
.lost .globe { max-width: 420px; margin: 20px auto 0; }
.lost h1 { margin: 8px 0 0; font: italic 400 clamp(3rem, 12vw, 5.6rem)/0.95 var(--display); }
.lost p { margin: 12px auto 0; max-width: 46ch; }
.lost .return { display: inline-block; margin-top: 22px; font: 400 1.05rem/1 var(--caps); letter-spacing: 0.2em; text-decoration: none; border: 1.5px solid var(--ink); padding: 14px 20px; }
.lost .return:hover { background: var(--ink); color: var(--paper); }

/* ---------- Colophon ---------- */

.colophon {
  margin: 56px var(--gutter) 0;
  padding: 16px 0 28px;
  border-top: 0.5px solid var(--ink);
  box-shadow: 0 -5px 0 -4px var(--ink);
  display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: center; justify-content: space-between;
  font: 400 0.85rem/1.4 var(--caps); letter-spacing: 0.1em; color: var(--ink-soft);
}
.scale { display: flex; align-items: center; gap: 10px; }
.scale svg { width: 150px; height: 18px; color: var(--ink); }

/* ---------- Phone ---------- */

@media (max-width: 860px) {
  .orb, .legend-wrap, .plate-head, .plate-body, .maker { grid-template-columns: minmax(0, 1fr); }
  .orb { margin-top: 28px; }
  .plate-head .globe { max-width: 300px; order: -1; }
  .particulars { position: static; }
}

@media (max-width: 520px) {
  body { font-size: 1.1rem; }
  .masthead { justify-content: center; text-align: center; }
  .masthead nav { justify-content: center; gap: 2px 14px; font-size: 0.92rem; }
  .cartouche { margin-top: 26px; }
  .cartouche::before, .cartouche::after { width: 16px; height: 16px; }
  .cartouche::before { left: -9px; }
  .cartouche::after { right: -9px; }
  .kicker { letter-spacing: 0.2em; font-size: 0.85rem; }
  .legend li { grid-template-columns: 32px 1fr; }
  .legend .coord { grid-column: 2; }
  .postcard { transform: none; }
  .colophon { justify-content: center; text-align: center; }
  .dog { width: 48px; height: 32px; margin: -16px 0 0 -24px; }
}

@media (prefers-reduced-motion: reduce) {
  .dog.is-running .leg, .dog.is-sitting .tail { animation: none; }
}
