/* Electrify Earth. Colours from Grid2Poster's japanese_ink theme: paper, two inks and one
   rust-vermilion accent. Dark mode is the same page at the end of a very late sunset: the
   Earth's night side in space, its limb still lit, the stars behind it (landing.js). */
@font-face {
  font-family: "Zen Old Mincho";
  src: url("fonts/zen-old-mincho-latin-400.woff2") format("woff2");
  font-display: swap;
}

:root {
  --paper: #f8f4ec;
  --paper-2: #fdfbf6;
  --ink: #26231f;
  --ink-2: #6a6a6a;
  --shu: #a32c10;
  --shu-fade: rgba(163, 44, 16, 0);
  --hair: rgba(38, 35, 31, .18);
  --bar: rgba(38, 35, 31, .42);
  --card-shadow: 0 1px 2px rgba(38, 35, 31, .28), 0 8px 22px rgba(38, 35, 31, .12);
  --serif: "Zen Old Mincho", "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}
/* The night: deep space, starlight for ink, the last of the sunset for vermilion. Set by the
   script in landing.html's head; dark is the site's default, so a page without scripts (no
   `data-theme`) is dark too. */
:root[data-theme="dark"],
:root:not([data-theme]) {
  --paper: #04060d;
  --paper-2: #0e1424;
  --ink: #ece3d1;
  --ink-2: #9aa3b8;
  --shu: #ff9466;
  --shu-fade: rgba(255, 148, 102, 0);
  --hair: rgba(236, 227, 209, .16);
  --bar: rgba(236, 227, 209, .42);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, .7), 0 10px 30px rgba(0, 0, 0, .55), 0 0 0 1px rgba(236, 227, 209, .07);
  color-scheme: dark;
}
.for-dark { display: none; }
:root[data-theme="dark"] .for-dark { display: inline; }
:root[data-theme="dark"] .for-light { display: none; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.defs { position: absolute; }

.page {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
  min-height: 600px;
  overflow: hidden;
  isolation: isolate;      /* the sky canvas paints beneath everything in it, flow content too */
}

/* ---------------------------------------------------------------- corners */
.top {
  position: absolute;
  z-index: 5;
  top: 22px;
  left: 28px;
  right: 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}
.top > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.seal {
  display: block;
  width: 46px;
  height: 46px;
  padding: 5px;
  background: var(--shu);
  border-radius: 4px;
  filter: url(#rough);
  transition: transform .25s ease;
}
.brand:hover .seal { transform: rotate(-4deg); }
.seal__mark {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--paper);
  -webkit-mask: url("../figures/earthpv-logo-mark-white.png") center / contain no-repeat;
  mask: url("../figures/earthpv-logo-mark-white.png") center / contain no-repeat;
}
.brand__name {
  font-size: 14px;
  letter-spacing: .3em;
  text-transform: uppercase;
}

.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 12px; }
.btn {
  position: relative;
  display: inline-block;
  padding: 10px 22px 11px;
  font-size: 15px;
  letter-spacing: .06em;
  text-decoration: none;
  isolation: isolate;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  background: var(--paper-2);
  filter: url(#rough-fine);
  transition: background-color .18s ease, border-color .18s ease;
}
.btn--ink { color: var(--paper-2); }
.btn--ink::before { background: var(--ink); }
.btn:hover, .btn:focus-visible { color: var(--paper-2); }
.btn:hover::before, .btn:focus-visible::before { background: var(--shu); border-color: var(--shu); }
.btn--shu { color: var(--paper-2); }
.btn--shu::before { background: var(--shu); border-color: var(--shu); }
.btn--shu:hover::before, .btn--shu:focus-visible::before { background: var(--ink); border-color: var(--ink); }
.github { display: block; width: 26px; height: 26px; margin-left: 2px; color: var(--ink); transition: color .18s ease; }
.github svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.github:hover, .github:focus-visible { color: var(--shu); }
a:focus-visible, .mode:focus-visible { outline: 2px solid var(--shu); outline-offset: 3px; }
/* The light switch: a crescent by day, the sun by night, as on the rest of the site. */
.mode {
  display: block;
  width: 24px;
  height: 24px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: color .18s ease, transform .3s ease;
}
.mode svg { display: block; width: 100%; height: 100%; filter: url(#rough-fine); }
.mode__moon { fill: currentColor; }
.mode__sun { fill: currentColor; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.mode .mode__sun, :root[data-theme="dark"] .mode .mode__moon { display: none; }
:root[data-theme="dark"] .mode .mode__sun { display: block; }
.mode:hover, .mode:focus-visible { color: var(--shu); transform: rotate(-14deg); }

/* ------------------------------------------------------------------ globe */
.stage { position: relative; min-height: 0; }
/* The night sky behind the whole page, drawn once per size by landing.js. */
#sky { position: absolute; z-index: -1; inset: 0; width: 100%; height: 100%; display: none; pointer-events: none; }
:root[data-theme="dark"] #sky { display: block; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#earth { touch-action: none; cursor: grab; outline: none; }
#earth.is-over { cursor: pointer; }
#earth.is-drag { cursor: grabbing; }
#over { pointer-events: none; }

.readout, .world-label {
  position: absolute;
  z-index: 3;
  margin: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .9s ease;
}
.readout.is-on, .world-label.is-on { opacity: 1; }
.readout { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.readout b {
  color: var(--shu);
  font-size: clamp(34px, 3.6vw, 52px);
  font-weight: 400;
  line-height: 1;
}
.readout span { font-size: 14px; line-height: 1.25; color: var(--ink); }
.readout .readout__best { display: block; margin-top: 5px; }
.world-label a { color: inherit; pointer-events: auto; text-underline-offset: 2px; }
.world-label {
  transform: translate(-100%, -50%);
  font-size: 13px;
  line-height: 1.25;
  text-align: right;
  white-space: nowrap;
  color: var(--ink-2);
}

/* The paper slip that follows the pointer. */
.card {
  position: absolute;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
  max-width: 350px;
  width: max-content;
  padding: 11px 15px 12px;
  background: var(--paper-2);
  border-left: 3px solid var(--shu);
  box-shadow: var(--card-shadow);
  color: var(--ink);
  text-decoration: none;
  pointer-events: none;
  transform: rotate(-.6deg);
}
.card[hidden] { display: none; }
.card.is-pinned { pointer-events: auto; }
.card strong { font-size: 20px; font-weight: 400; line-height: 1.2; }
.card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.card__title { display: flex; flex-direction: column; gap: 1px; }
.card__tier {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tier-text, var(--ink-2));
}
.card__tier:empty, .card__line:empty, .card__note:empty { display: none; }
.card__line { font-size: 14px; }
/* The calibration badge of the atlas page: the same disc, mark and light-panel metals. */
.medal {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--tier-hi), var(--tier) 58%, var(--tier-lo));
  box-shadow: 0 0 0 1.5px var(--tier-ring), 0 1px 3px rgba(38, 35, 31, .4);
}
.medal::after {
  content: "";
  width: 23px;
  height: 23px;
  background: var(--tier-ink);
  -webkit-mask: url("../figures/earthpv-logo-mark-white.png") center / contain no-repeat;
  mask: url("../figures/earthpv-logo-mark-white.png") center / contain no-repeat;
}
.card__head[data-tier=""] .medal { display: none; }
.card__head[data-tier="gold"] {
  --tier: #a9760a; --tier-hi: #d8a53c; --tier-lo: #7d5405; --tier-ink: #fff8e6;
  --tier-text: #8a6108; --tier-ring: rgba(169, 118, 10, .45);
}
.card__head[data-tier="silver"] {
  --tier: #5f6e82; --tier-hi: #93a2b5; --tier-lo: #414c5b; --tier-ink: #fff;
  --tier-text: #4d5a6b; --tier-ring: rgba(95, 110, 130, .45);
}
.card__head[data-tier="bronze"] {
  --tier: #9c4a14; --tier-hi: #cf7a3f; --tier-lo: #6f3209; --tier-ink: #fdeade;
  --tier-text: #8a3f10; --tier-ring: rgba(156, 74, 20, .48);
}
:root[data-theme="dark"] .card__head[data-tier="gold"] { --tier-text: #e6bb5c; --tier-ring: rgba(230, 187, 92, .5); }
:root[data-theme="dark"] .card__head[data-tier="silver"] { --tier-text: #b9c5d6; --tier-ring: rgba(185, 197, 214, .45); }
:root[data-theme="dark"] .card__head[data-tier="bronze"] { --tier-text: #e59a66; --tier-ring: rgba(229, 154, 102, .5); }
/* Width 0 and min-width 100%: the note wraps to the card instead of widening it. In vermilion,
   like the bar below 400 m2 whose gap it names, at the size of the card's lines and behind a
   warning sign (owner, 2026-11-12). */
.card__note {
  position: relative;
  width: 0;
  min-width: 100%;
  margin-top: 7px;
  padding-left: 25px;
  color: var(--shu);
  font-size: 14px;
  font-style: italic;
  line-height: 1.3;
}
.card__note::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  background: var(--shu);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M10.3 2.9a2 2 0 0 1 3.4 0l9.4 16.2a2 2 0 0 1-1.7 3H2.6a2 2 0 0 1-1.7-3ZM10.9 8.5h2.2l-.45 7.2h-1.3ZM12 17.1a1.35 1.35 0 1 0 0 2.7 1.35 1.35 0 1 0 0-2.7Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M10.3 2.9a2 2 0 0 1 3.4 0l9.4 16.2a2 2 0 0 1-1.7 3H2.6a2 2 0 0 1-1.7-3ZM10.9 8.5h2.2l-.45 7.2h-1.3ZM12 17.1a1.35 1.35 0 1 0 0 2.7 1.35 1.35 0 1 0 0-2.7Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.card__go { margin-top: 6px; font-size: 14px; color: var(--shu); }
/* The atlas's size chart, four bars of label, bar and figure; the bar below 400 m2 in vermilion. */
.card__sizes {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 3px 9px;
  width: 280px;
  max-width: 100%;
  margin: 7px 0 0;
  padding-top: 7px;
  border-top: 1px solid var(--hair);
  font-size: 12.5px;
  line-height: 1.35;
}
.card__sizes[hidden] { display: none; }
.card__sizes-head {
  grid-column: 1 / -1;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.card__size-label { font-family: var(--mono); font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.card__size-track { display: flex; align-items: center; height: 10px; }
.card__size-bar { height: 100%; background: var(--bar); }
.card__size-bar.is-small { background: var(--shu); }
/* More is there, by an unknown amount: the bar goes on and fades out, as on the atlas's chart. */
.card__size-fade {
  flex: none;
  width: 12%;
  height: 100%;
  background: linear-gradient(to right, var(--shu), var(--shu-fade));
}
.card__size-value { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.card__size-label.is-small, .card__size-value.is-small { color: var(--shu); font-weight: 600; }
.card__size-value.not-measured { color: var(--shu); font-style: italic; font-weight: 400; }

/* ------------------------------------------------- title, as on a Grid2Poster */
.title {
  position: relative;
  z-index: 2;
  padding: 0 24px 18px;
  text-align: center;
}
.title h1 {
  margin: 0 -.24em 0 0;    /* the last letter's tracking would otherwise pull it off centre */
  font-size: min(54px, 6.4vw, calc((100vw - 600px) / 13.6), 6.2vh);
  font-weight: 400;
  line-height: 1.14;
  color: var(--shu);
  letter-spacing: .24em;
  text-transform: uppercase;
  white-space: nowrap;
}
/* At night the title takes the colours of the sky just after the sun has gone. */
:root[data-theme="dark"] .title h1 span {
  background: linear-gradient(100deg, #ffd890 0%, #ffa36a 34%, #f2737a 66%, #b77bd0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.rule {
  display: block;
  width: min(420px, 62vw);
  height: 6px;
  margin: 5px auto 7px;
  fill: var(--ink);
}
.subtitle {
  margin: 0;
  font-size: 19px;
  letter-spacing: .05em;
  color: var(--shu);
  text-wrap: balance;
}
.ledger a { text-underline-offset: 2px; }
.atlas-links ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 11px;
  margin: 10px auto 0;
  padding: 0;
  max-width: 900px;
  list-style: none;
  font-size: 14px;
}
.atlas-links a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.atlas-links a:hover, .atlas-links a:focus-visible { color: var(--shu); border-color: var(--shu); }

/* ------------------------------------------------------------ lower corners */
.legend {
  position: absolute;
  z-index: 3;
  left: 28px;
  bottom: 22px;
  width: 248px;
  font-size: 13px;
  color: var(--ink);
}
.legend p { margin: 0; }
.legend__row { display: flex; align-items: center; gap: 9px; line-height: 1.65; }
.legend__note { margin-top: 8px !important; font-size: 11.5px; line-height: 1.4; color: var(--ink-2); }
.key { flex: none; display: block; width: 16px; height: 11px; }
.key--ink { background: #fffdf8; border: 1px solid var(--ink); filter: url(#rough-fine); }
.key--ramp { background: linear-gradient(90deg, #f9ded1, #e07050 50%, var(--shu)); border: 1px solid rgba(38, 35, 31, .3); }
.key--pencil {
  border: 1px solid rgba(38, 35, 31, .55);
  background: repeating-linear-gradient(115deg, rgba(38, 35, 31, .3) 0 1px, transparent 1px 3.5px);
  filter: url(#rough-fine);
}
/* The keys in the globe's night colours (landing.js, THEMES.dark). */
:root[data-theme="dark"] .key--ink { background: #4a5878; border-color: #efe5cf; }
:root[data-theme="dark"] .key--ramp {
  background: linear-gradient(90deg, #5c3050, #d64a2e 45%, #ff9e48 75%, #ffeec4);
  border-color: rgba(236, 227, 209, .3);
}
:root[data-theme="dark"] .key--pencil {
  border-color: rgba(160, 182, 226, .55);
  background: repeating-linear-gradient(115deg, rgba(160, 182, 226, .3) 0 1px, transparent 1px 3.5px);
}

.oet {
  position: absolute;
  z-index: 3;
  right: 28px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  letter-spacing: .05em;
  color: var(--ink-2);
  text-decoration: none;
  transition: color .18s ease;
}
.oet svg { width: 40px; height: auto; filter: url(#rough-fine); }
.oet:hover { color: var(--ink); }

/* -------------------------------------------------- narrow and short screens */
/* The title block sits between the two lower corners, so it may not reach them. */
.subtitle, .atlas-links ul { max-width: calc(100vw - 590px); margin-left: auto; margin-right: auto; }
@media (max-height: 780px) { .legend__note { display: none; } }

@media (max-width: 1180px) {
  /* The corners stop being corners: they become a row under the title. */
  .page { grid-template-columns: 1fr auto; grid-template-rows: minmax(0, 1fr) auto auto; }
  .stage, .title { grid-column: 1 / -1; }
  .stage { margin-top: 14px; }    /* the brush stroke stays clear of the buttons above it */
  .top { grid-column: 1 / -1; }
  .title h1 { font-size: min(46px, 6.4vw, 6.2vh); }
  .subtitle, .atlas-links ul { max-width: none; }
  .legend, .oet { position: static; align-self: end; padding: 0 28px 16px; }
  .legend { width: auto; display: flex; flex-wrap: wrap; gap: 0 20px; }
  .legend__note { display: none; }
}
@media (max-width: 1040px), (max-height: 620px) {    /* NARROW_W in landing.js */
  html, body { height: auto; }
  .page { display: block; height: auto; min-height: 0; overflow: visible; }
  .title h1 { font-size: min(46px, 6.4vw); }
  .top { position: static; padding: 16px 16px 0; }
  .brand__name { display: none; }
  .btn { padding: 8px 16px 9px; font-size: 14px; }
  .stage { height: calc(min(100vw, 70vh) + 68px); margin-top: 6px; }   /* 40px: the readout's figures */
  .readout { position: static; justify-content: center; opacity: 1; margin: 4px 0 12px; }
  .title { padding: 12px 16px 16px; }
  .legend, .oet { position: static; margin: 0 16px; padding: 0; }
  .legend { display: block; width: auto; padding-top: 4px; }
  .legend__note { display: block; }
  .oet { justify-content: flex-end; padding: 12px 0 18px; }
  .card { max-width: calc(100vw - 32px); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
