/*
  yashhw.xyz — the only stylesheet.
  Two colours, two typefaces (one family), no framework.
  Change the whole site's look from the four variables below.
*/

:root {
  --bg: #0d2b26; /* verdigris: the patina on old copper */
  --fg: #f4f1ea; /* everything else */
  --sans: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
}

body {
  max-width: 48rem;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

/* Secondary text is the same colour, just quieter. No third colour. */
.dim { opacity: .55; }
.mono, nav, time { font-family: var(--mono); font-size: .875rem; }

a { color: inherit; }
p a { text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* Bracketed links invert on hover: the site's one interaction style. */
nav a, .links a, button {
  text-decoration: none;
  padding: 0 2px;
  transition: background-color .15s, color .15s;
}
nav a:hover, .links a:hover, button:hover,
nav a[aria-current="page"], button[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}

nav { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: 3.5rem; }
nav span { opacity: .5; } /* the • separators */

h1 { font: 400 2rem var(--mono); margin: 0 0 .25rem; }
h2 { font-size: 1.25rem; font-weight: 500; margin: 0 0 1.5rem; }
h3 { font-size: 1.0625rem; font-weight: 400; margin: 0; }

.links { display: flex; flex-wrap: wrap; gap: .25rem .75rem; font-family: var(--mono); font-size: .8125rem; }

hr { border: 0; border-top: 1px solid var(--fg); opacity: .25; margin: 2.5rem 0; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

/* ---------- CV: company + date on one line, role underneath ---------- */

.entry { margin-bottom: 1.75rem; }
.entry header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: .8125rem;
  opacity: .75;
}
.role { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: .375rem; }
.role time { opacity: .55; font-size: .75rem; }
.entry p { margin: .125rem 0 0; opacity: .6; }

/* ---------- Coins: closed <details> rows; open one to see the pieces ---------- */

/* The coins page gets more room, for the map. */
body.wide { max-width: 64rem; }

/* The live value: one big number, the currency picker, one quiet line under it. */
.worth { margin: 2rem 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; }
.worth span { font: 2rem var(--mono); }
.worth small { flex-basis: 100%; }
.worth[hidden], select[hidden] { display: none; }

/* A select that looks like the rest of the bracketed controls. */
select {
  font: inherit; color: var(--fg); background: var(--bg);
  border: 0; border-bottom: 1px solid rgb(244 241 234 / .4);
  padding: 0 2px; cursor: pointer;
}

.controls { display: flex; flex-wrap: wrap; gap: .25rem .75rem; font-family: var(--mono); font-size: .8125rem; margin: 1.5rem 0 2rem; }
.controls span { opacity: .3; }

details { border-top: 1px solid rgb(244 241 234 / .25); }
details:last-of-type { border-bottom: 1px solid rgb(244 241 234 / .25); }

summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .875rem .25rem;
  cursor: pointer;
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::before { content: "+"; font-family: var(--mono); opacity: .5; width: 1.25rem; }
details[open] summary::before { content: "−"; }
summary:hover { background: var(--fg); color: var(--bg); }
summary b { font-weight: 400; flex: 1; }
summary small { font-family: var(--mono); opacity: .55; }

.pieces {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: .75rem .25rem;
  padding: .5rem 0 1.5rem 1.5rem;
}
.pieces a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  text-decoration: none;
  text-align: center;
  font-size: .8125rem;
  line-height: 1.3;
}
.pieces small { font-family: var(--mono); opacity: .55; }

/* Placeholder outline until a photo exists; a photo simply replaces it. */
.face {
  width: 3.5rem;
  height: 3.5rem;
  border: 1px solid var(--fg);
  border-radius: 50%;
  margin-bottom: .25rem;
  object-fit: cover;
  transition: background-color .15s;
}
.note .face { width: 4.75rem; height: 2.375rem; margin: .5625rem 0 .8125rem; border-radius: 2px; }
.pieces a:hover .face { background: var(--fg); }

/* ---------- Single piece ---------- */

.sides { display: flex; gap: 2rem; margin: 2rem 0; }
.sides .face { width: 9rem; height: 9rem; }
.note .sides .face { width: 13rem; height: 6.5rem; }
dl { display: grid; grid-template-columns: 7rem 1fr; gap: .25rem 1rem; margin: 1.5rem 0; }
dt { font-family: var(--mono); font-size: .8125rem; opacity: .55; padding-top: .125rem; }
dd { margin: 0; }

/* "About this coin": closed until asked for. */
.about { margin-top: 2rem; }
.about summary { font-family: var(--mono); font-size: .8125rem; }
.about > div { padding: .5rem 0 1rem; }
.pre { white-space: pre-line; }
.credit { margin-top: -1rem; }

/* Catalogue photos are someone else's coin: shown, but a touch quieter than your own. */
img.face { border-color: transparent; background: none; object-fit: contain; }
img.face.catalogue { opacity: .85; }

/* ---------- Map: the collection as nodes, free to drag ---------- */

.map { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.map[hidden] { display: none; }
.stage {
  flex: 999 1 32rem; min-width: 0; position: relative;
  height: clamp(26rem, 72vh, 46rem);
  border: 1px solid rgb(244 241 234 / .25);
}
.stage svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; }
.hint { position: absolute; left: .75rem; bottom: .5rem; margin: 0; pointer-events: none; }
.panel { flex: 1 1 15rem; min-width: 0; display: flex; flex-direction: column; gap: .5rem; align-self: flex-start; }
.panel p, .panel h3 { margin: 0; }
.panel .list { display: flex; flex-wrap: wrap; gap: 0 .5rem; font-size: .8125rem; }
.panel .list a { text-decoration: none; }
.panel .list a:hover { background: var(--fg); color: var(--bg); }
.panel-pic { width: 6rem; height: 6rem; object-fit: contain; }
.panel-pic.note { width: 10rem; height: 5rem; }

/* Outline = at rest, filled = selected. Two colours, as everywhere. */
.edge { stroke: var(--fg); stroke-opacity: .18; }
.region { fill: var(--fg); opacity: .16; font: 500 12px var(--mono); text-anchor: middle; letter-spacing: .08em; text-transform: uppercase; pointer-events: none; }
.node { cursor: grab; outline: none; }
.node .mark { fill: var(--bg); stroke: var(--fg); transition: fill .15s; }
.node.sub .mark { stroke-dasharray: 3 2; }
.node text { fill: var(--fg); font: 11px var(--mono); pointer-events: none; }
.node .count { text-anchor: middle; dominant-baseline: central; font-size: 10px; }
.node .label { text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; }
.node:hover .mark, .node.on .mark { fill: var(--fg); }
.node:hover .count, .node.on .count { fill: var(--bg); }
.node:focus-visible .mark { stroke-dasharray: 2 2; }
.node.far { opacity: .22; }
.dragging, .dragging .node { cursor: grabbing; }

/* ---------- Page entrance ----------
   Everything below the nav drops in 15px and fades up, a beat after load.
   The nav stays put and scrambles instead (site.js). */

@keyframes enter {
  from { opacity: 0; transform: translateY(-15px); }
}
body > :not(nav) {
  animation: enter .5s cubic-bezier(.33, 1, .68, 1) .25s backwards;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
