/* The look is the paint colour explorer's, carried over: quiet and classic,
   with room for the colours to speak. Ported from islands' styles.gleam. */

:root {
  color-scheme: light;
  --ink: #2a2723;
  --muted: #857e75;
  --line: #e8e3da;
  --paper: #fbfaf7;
  --page: #fafaf8;
  --serif: 'Cormorant Garamond', 'Playfair Display', Georgia, 'Times New Roman', serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
[hidden] { display: none !important; }

/* Site header and footer */
.site-head, .site-main, .site-foot { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.site-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.5rem 2rem; padding-top: 1.5rem; padding-bottom: 1.5rem;
}
.site-name {
  color: inherit; text-decoration: none;
  font-family: var(--serif); font-size: 1.6rem; line-height: 1.1;
}
.site-nav { display: flex; gap: 1.5rem; }
.site-nav a {
  color: var(--muted); text-decoration: none;
  font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase;
}
.site-nav a:hover { color: var(--ink); }
.site-main { padding-bottom: 2rem; }
.site-foot {
  padding-top: 1rem; padding-bottom: 3rem;
  color: var(--muted); font-size: 0.78rem; text-align: center;
}
.site-foot p { margin: 0.3rem 0; }
.site-foot a { color: inherit; }

.explorer {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: clamp(1.25rem, 4vw, 3.25rem);
}

/* Heading */
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.header h2 {
  margin: 0.35rem 0 0;
  font-family: var(--serif);
  font-size: clamp(2.1rem, 5vw, 3.1rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.005em;
}
.lede { margin: 0.6rem 0 0; color: var(--muted); }
.lede a { color: inherit; text-underline-offset: 3px; }

/* Sections */
.nav {
  display: flex; flex-wrap: wrap; gap: 0 2rem;
  margin: 2rem 0 2.25rem;
  border-bottom: 1px solid var(--line);
}
.nav a {
  margin-bottom: -1px; padding: 0.75rem 0;
  border-bottom: 1px solid transparent;
  color: var(--muted); text-decoration: none;
  font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  transition: color 0.2s, border-color 0.2s;
}
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); border-bottom-color: var(--ink); }

/* Toolbar */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 2rem;
  margin-bottom: 1.5rem;
}
.search {
  flex: 1 1 16rem;
  padding: 0.55rem 0;
  border: none; border-bottom: 1px solid var(--line); background: none;
  font-size: 1rem;
}
.search:focus { outline: none; border-bottom-color: var(--ink); }
.select { display: flex; flex-direction: column; gap: 0.2rem; }
.select span {
  color: var(--muted); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
}
select {
  padding: 0.45rem 1.6rem 0.45rem 0;
  border: none; border-bottom: 1px solid var(--line); border-radius: 0;
  background: none; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 0.55rem center, right 0.25rem center;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.summary { margin: 0 0 1.5rem; color: var(--muted); font-size: 0.85rem; }

/* Colour tiles */
.grid {
  display: grid; gap: 2rem 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.tile {
  position: relative;
  color: inherit; text-decoration: none;
  display: flex; flex-direction: column; align-items: flex-start;
  min-width: 0;
}
.tile .swatch {
  position: relative;
  display: block; width: 100%; aspect-ratio: 1 / 1.1; margin-bottom: 0.7rem;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.tile:hover .swatch, .tile:focus-visible .swatch {
  transform: translateY(-3px);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), 0 14px 28px -12px rgba(40, 30, 20, 0.35);
}
.tile .name { font-size: 0.92rem; line-height: 1.3; overflow-wrap: anywhere; }
.tile .brand {
  margin-top: 0.2rem;
  color: var(--muted); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
}
.tile .note-line { margin-top: 0.2rem; color: var(--muted); font-size: 0.78rem; font-style: italic; }

/* The ring in the corner that says a chip opens something, drawn in the
   swatch's own `color`: black or white, whichever reads on it. */
.tile .swatch::after, .combo .swatch::after {
  content: "↗";
  position: absolute; right: 0.4rem; bottom: 0.4rem;
  display: grid; place-items: center;
  width: 1.3rem; height: 1.3rem;
  border: 1px solid currentColor; border-radius: 50%;
  font-size: 0.72rem; line-height: 1;
  opacity: 0.5;
  transition: opacity 0.25s ease;
}
.tile:hover .swatch::after, .tile:focus-visible .swatch::after,
.part:hover .swatch::after, .part:focus-visible .swatch::after { opacity: 1; }
.end-marker { height: 1px; }

@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 0.9rem; }
}

.rank {
  position: absolute; top: 0.6rem; left: 0.6rem;
  min-width: 1.9rem; padding: 0.15rem 0.5rem; border-radius: 999px;
  background: rgba(251, 250, 247, 0.92); color: var(--ink);
  font-size: 0.78rem; text-align: center; letter-spacing: 0.02em;
}

/* Rows of colours on a colour page */
.strip {
  display: grid; gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
}
@media (max-width: 480px) {
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 0.9rem; }
}

/* Same lightness, round the wheel: twelve chips, two rows of six, with a ring
   round this colour where it sits among them. */
.grid.ring { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1.5rem 1rem; }
.grid.ring .swatch { aspect-ratio: 1 / 1; }
.tile.current .swatch,
.tile.current:hover .swatch { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--ink); transform: none; }
@media (max-width: 640px) {
  .grid.ring { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem 0.75rem; }
}
@media (max-width: 400px) {
  .grid.ring { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Text buttons */
.text-button {
  padding: 0; border: none; background: none; color: inherit; text-decoration: none;
  font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
  border-bottom: 1px solid currentColor;
}
.text-button:hover { color: var(--muted); }

/* Match a colour */
.match { display: grid; grid-template-columns: 260px 1fr; gap: 3rem; align-items: start; }
.picker { display: flex; flex-direction: column; align-items: flex-start; gap: 1.25rem; }
.picker-holder { display: flex; flex-direction: column; gap: 0.9rem; width: 100%; max-width: 240px; }
.sv-box {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  border-radius: 2px; overflow: hidden; touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.sv-box canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
.sv-dot {
  position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border-radius: 50%; border: 3px solid #fff; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.35);
}
.hue-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px; margin: 0; border-radius: 11px; cursor: pointer;
  background: linear-gradient(to right,
    #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.hue-slider::-webkit-slider-thumb {
  -webkit-appearance: none; box-sizing: border-box;
  width: 20px; height: 20px; border-radius: 50%;
  background: transparent; border: 3px solid #fff; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
}
.hue-slider::-moz-range-thumb {
  box-sizing: border-box; width: 20px; height: 20px; border-radius: 50%;
  background: transparent; border: 3px solid #fff; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
}
.chosen { display: flex; align-items: center; gap: 0.75rem; }
.chosen-swatch {
  display: block; width: 44px; height: 44px; border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.hex { margin: 0; font-family: ui-monospace, monospace; letter-spacing: 0.08em; }
.hex-input {
  width: 8.5ch; padding: 0.3rem 0; border: none; border-bottom: 1px solid var(--line);
  background: none; text-transform: uppercase;
}
.hex-input:focus { outline: none; border-bottom-color: var(--ink); }
.match-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1rem 2rem; margin-bottom: 1.75rem;
}
.match-head h3 {
  margin: 0; font-family: var(--serif); font-weight: 400; font-size: 1.9rem; line-height: 1.1;
}
.match-head .quiet { margin: 0.3rem 0 0; }

@media (max-width: 760px) {
  .match { grid-template-columns: 1fr; gap: 1.75rem; }
  .nav { margin: 1.25rem 0 1.5rem; }
  .header .eyebrow, .header h2 { display: none; }
  .lede { margin: 0; }
  .picker {
    display: grid; align-items: start;
    grid-template-columns: minmax(0, 170px) minmax(0, 1fr);
    gap: 1rem 1.25rem;
  }
  .picker .quiet { grid-row: 1; grid-column: 1 / -1; margin: 0; }
  .picker-holder { grid-row: 2; max-width: 170px; }
  .picker .chosen {
    grid-row: 2; flex-direction: column; align-items: stretch; gap: 0.45rem;
  }
  .picker .chosen-swatch { width: 100%; height: 60px; }
  .picker .hex { font-size: 0.82rem; letter-spacing: 0.04em; }
  .match-head { gap: 0.9rem 1.25rem; margin-bottom: 1.25rem; }
  .match-head h3 { font-size: 1.5rem; }
  .match-head .quiet { display: none; }
}

/* Bits of a colour's page */
.back-link { margin: 0 0 1.25rem; font-size: 0.9rem; }
.back-link a, .pager a { color: inherit; text-underline-offset: 3px; }
.codes dd { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-width: 0; }
.codes code { font-family: ui-monospace, monospace; font-size: 0.85rem; overflow-wrap: anywhere; }
.copy {
  flex: none; padding: 0.25rem 0.7rem;
  border: 1px solid var(--line); border-radius: 999px; background: none;
  color: var(--muted); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  transition: color 0.2s, border-color 0.2s;
}
.copy:hover { color: var(--ink); border-color: var(--ink); }

.section-head { margin: 3.25rem 0 1.4rem; }
.section-head:first-child { margin-top: 0; }
.section-head h4 { margin: 0; font-family: var(--serif); font-size: 1.8rem; font-weight: 400; }
.section-head .quiet { margin: 0.25rem 0 0; }

.pager {
  display: flex; justify-content: space-between; gap: 1rem;
  margin: 1.75rem 0 0; font-size: 0.9rem;
}

/* Colour schemes: the pairs joined, with this colour as a band below */
.related { margin-bottom: 2.25rem; }
.related:last-child { margin-bottom: 0; }
.related h4 { margin: 0.5rem 0 0.75rem; font-family: var(--serif); font-weight: 400; font-size: 1.15rem; }
.hint { margin: 0 0 1.5rem; }
.hint-chip {
  display: inline-block; width: 1.4em; height: 0.8em; vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.combo { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.combo .part {
  display: flex; flex-direction: column; align-items: flex-start;
  min-width: 0; color: inherit; text-decoration: none;
}
.combo .swatch { position: relative; display: block; width: 100%; height: 170px; }
@media (max-width: 480px) { .combo .swatch { height: 120px; } }
.combo .base { display: block; width: 100%; height: 26px; margin-bottom: 0.8rem; }
.combo .part:first-child .swatch { border-top-left-radius: 2px; }
.combo .part:last-child .swatch { border-top-right-radius: 2px; }
.combo .part:first-child .base { border-bottom-left-radius: 2px; }
.combo .part:last-child .base { border-bottom-right-radius: 2px; }
.combo .part:hover .swatch, .combo .part:focus-visible .swatch { filter: brightness(1.04); }
.combo .part:hover .name { text-decoration: underline; text-underline-offset: 3px; }
.combo .brand {
  padding-right: 0.5rem;
  color: var(--muted); font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase;
}
.combo .name { padding-right: 0.5rem; font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; }

/* Messages */
.quiet { color: var(--muted); font-size: 0.9rem; }

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

/* --- Saving ------------------------------------------------------------- */

.saved-count:not(:empty)::before { content: "("; }
.saved-count:not(:empty)::after { content: ")"; }
.site-nav { flex-wrap: wrap; gap: 0.4rem 1.5rem; }

/* The Save button on a colour: a heart, filled once it's saved. */
.save {
  display: inline-flex; align-items: center; gap: 0.45rem;
  margin: 1rem 0 0; padding: 0.55rem 1.1rem;
  border: 1px solid var(--ink); border-radius: 999px; background: none;
  font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase;
  transition: background 0.2s, color 0.2s;
}
.save .heart { color: transparent; -webkit-text-stroke: 1px var(--ink); font-size: 0.95rem; letter-spacing: 0; }
.save:hover { background: #fff; }
.save.on { background: var(--ink); color: var(--paper); }
.save.on .heart { color: #e0607e; -webkit-text-stroke: 0; }

.button {
  display: inline-block; padding: 0.8rem 1.5rem; border: none;
  background: var(--ink); color: var(--paper); text-decoration: none;
  font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase;
  transition: background 0.2s;
}
.button:hover { background: #46413b; }

/* A saved colour with a × to take it off. */
.kept-tile { position: relative; min-width: 0; }
.drop {
  position: absolute; top: -0.5rem; right: -0.5rem; z-index: 1;
  width: 1.6rem; height: 1.6rem; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--paper); color: var(--muted);
  font-size: 1rem; line-height: 1;
}
.drop:hover { background: var(--ink); color: var(--paper); }

.kept-actions { margin: 1.75rem 0 2rem; }
.naming-label {
  display: block; color: var(--muted);
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
}
.kept-actions .naming { max-width: 20rem; font-size: 1rem; margin-top: 0.2rem; }
.file-name { margin: 0.45rem 0 1rem; font-size: 0.82rem; overflow-wrap: anywhere; }
.file-name strong { color: var(--ink); font-weight: 500; }
.kept-does { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; }
.naming {
  display: block; width: 100%; padding: 0.3rem 0;
  border: none; border-bottom: 1px solid var(--line); background: none;
}
.naming:focus { outline: none; border-bottom-color: var(--ink); }
.naming::placeholder { color: var(--muted); }

/* --- Colour dating ------------------------------------------------------ */
/* Carried over from the painting site's deck. */

.dating { max-width: 560px; margin: 2.25rem auto 0; }
.dating-help { text-align: center; margin: 2rem 0 0; }
.stack { position: relative; height: clamp(190px, 40vh, 360px); }
.card {
  position: absolute; inset: 0; border-radius: 8px;
  box-shadow: 0 18px 40px -18px rgba(40, 30, 20, 0.5);
  transition: transform 0.25s ease, opacity 0.25s ease;
  touch-action: pan-y; user-select: none;
}
.card.behind { transform: scale(0.94) translateY(14px); opacity: 0.75; }
.card.top { cursor: grab; }
.card.top:active { cursor: grabbing; }
.stamp {
  position: absolute; top: 1rem; padding: 0.35rem 0.8rem;
  border: 2px solid currentColor; border-radius: 4px;
  font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
  opacity: 0; pointer-events: none;
}
.stamp.nah { right: 1rem; transform: rotate(12deg); }
.stamp.keep { left: 1rem; transform: rotate(-12deg); }
.controls {
  position: absolute; left: 0; right: 0; bottom: -1.35rem;
  display: flex; justify-content: center; gap: 0.75rem;
}
.controls button {
  min-width: 7rem; min-height: 2.7rem; padding: 0.7rem 1.4rem; border-radius: 999px;
  font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase;
  box-shadow: 0 6px 18px -8px rgba(40, 30, 20, 0.6);
  transition: background 0.2s, color 0.2s;
}
.controls .pass { border: 1px solid var(--ink); background: var(--paper); }
.controls .pass:hover { background: var(--ink); color: var(--paper); }
.controls .keep { border: 1px solid var(--ink); background: var(--ink); color: var(--paper); }
.controls .keep:hover { background: #46413b; }
.controls button:disabled { opacity: 0.5; box-shadow: none; cursor: not-allowed; }
.under { min-height: 2.8rem; margin: 2.3rem 0 0; text-align: center; }
.under p { margin: 0; }
.under .name { font-family: var(--serif); font-size: 1.5rem; line-height: 1.2; }
.under .brand { margin-top: 0.15rem; color: var(--muted); font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; }
.waiting { text-align: center; color: var(--muted); font-size: 0.9rem; padding-top: 4rem; }
.owned-up {
  margin: 1rem 0 0; padding: 0.8rem 1rem;
  border: 1px dashed var(--line); border-radius: 10px; text-align: center;
}
.owned-up p { margin: 0; }
.owned-up .owning-up { font-size: 1.05rem; }
.owned-up .owned-note { margin-top: 0.3rem; color: var(--muted); font-size: 0.85rem; }
.full-notice { margin: 1rem 0 0; text-align: center; font-size: 0.86rem; color: #9a3b2a; }
.full-notice a { color: inherit; }

/* --- A colour's page: the colour as a column ------------------------------ */
/* The swatch is the left-hand column and stays put while the rest scrolls
   beside it, so the colour is always there to compare against. On a phone it
   sits on top, and a slim band of it sticks once it has scrolled away. */

.colour-page {
  display: grid; grid-template-columns: minmax(240px, 36%) minmax(0, 1fr); align-items: start;
  background: var(--paper); border: 1px solid var(--line);
}
.colour-swatch {
  position: sticky; top: 0; height: 100vh; max-height: 100vh;
  transition: background 0.25s ease;
}
.colour-band { display: none; }
.colour-main { padding: 2.5rem 2.75rem 3rem; min-width: 0; }
.colour-info h3 {
  margin: 0.3rem 0 0.2rem;
  font-size: clamp(2.2rem, 5vw, 3.2rem); line-height: 1.1; overflow-wrap: anywhere;
}
.colour-info dl { margin: 2rem 0 0; }
.colour-info dl div {
  display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem;
  padding: 0.9rem 0; border-top: 1px solid var(--line); font-size: 0.9rem;
}
.colour-info dt {
  color: var(--muted); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding-top: 0.15rem;
}
.colour-info dd { margin: 0; }
.colour-info dl.codes { margin-top: 1.5rem; }
.colour-info dl.codes div { padding: 0.55rem 0; align-items: center; }
.about { margin: 1.5rem 0 0; max-width: 60ch; line-height: 1.6; }
.colour-main .section-head { margin: 3.25rem 0 1.4rem; }
.colour-main .strip { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.colour-main .pager { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.combo .swatch { margin-bottom: 0.8rem; }

@media (max-width: 720px) {
  .colour-page { grid-template-columns: minmax(0, 1fr); }
  .colour-swatch { position: static; height: 280px; }
  .colour-band {
    display: flex; justify-content: space-between; gap: 1rem;
    position: sticky; top: 0; z-index: 5;
    padding: 0.7rem 1.25rem; font-size: 0.85rem;
    box-shadow: 0 6px 14px -10px rgba(0, 0, 0, 0.4);
  }
  .colour-main { padding: 1.75rem 1.25rem 2rem; }
}
@media (max-width: 400px) { .colour-info dl div { grid-template-columns: 6.5rem 1fr; } }

/* --- The home page ---------------------------------------------------------- */

.home-page .header h2 { font-size: clamp(2.6rem, 7vw, 4.2rem); }
.spectrum {
  display: flex; height: 72px; margin: 2.25rem 0 2.5rem;
  border-radius: 4px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.spectrum a { flex: 1 1 0; min-width: 0; transition: flex-grow 0.2s ease; }
.spectrum a:hover, .spectrum a:focus-visible { flex-grow: 6; }
.parts { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.part-card {
  display: block; padding: 1.1rem 1.1rem 1.25rem;
  border: 1px solid var(--line); background: #fff; color: inherit; text-decoration: none;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.part-card:hover, .part-card:focus-visible { transform: translateY(-2px); box-shadow: 0 14px 28px -16px rgba(40, 30, 20, 0.35); }
.part-colours { display: flex; height: 44px; margin-bottom: 1rem; border-radius: 2px; overflow: hidden; }
.part-colours span { flex: 1; }
.part-card h3 { margin: 0 0 0.3rem; font-family: var(--serif); font-size: 1.45rem; font-weight: 400; }
.part-card p { margin: 0; }
.surprise { margin: 2.25rem 0 0; text-align: center; }
.surprise a { color: inherit; text-underline-offset: 3px; }
@media (max-width: 760px) { .home-page .header h2 { display: block; } .spectrum { height: 52px; } }

/* --- The colour match game -------------------------------------------------- */
/* Carried over from the painting site's game. Kept compact, so the two halves,
   the picker and the colours to choose from fit on one screen. */

.game-page .header h2 { font-size: clamp(1.9rem, 4vw, 2.5rem); }
.game-page .lede { margin-top: 0.35rem; }

.game { margin-top: 2rem; }
.game h3 { margin: 0 0 0.75rem; font-size: 1rem; font-weight: 400; }
.board {
  display: grid; grid-template-columns: 1fr 1fr;
  height: clamp(110px, 19vh, 210px);
  border-radius: 8px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.half { position: relative; }
.tag {
  position: absolute; left: 0.75rem; top: 0.7rem;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  background: rgba(251, 250, 247, 0.85); color: var(--ink);
  font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase;
}
/* The colours to choose from have to be on screen while you play, not below
   the fold. On a phone they come straight after the two halves, above the
   picker; on a computer they sit beside the picker. */
.play {
  display: grid; gap: 1.1rem; margin: 1.25rem 0 0;
  grid-template-areas: "nearest" "shapes" "picker" "misses" "score" "help";
}
.game .shapes { grid-area: shapes; justify-self: start; }
.game .picker-holder { grid-area: picker; display: flex; flex-direction: column; gap: 0.9rem; width: 100%; max-width: 420px; }
@supports (height: 1svh) { .game .picker-holder { max-width: min(420px, 46svh); } }
.game .nearest { grid-area: nearest; position: relative; }
.game .misses { grid-area: misses; min-width: 0; }
.game .score-row { grid-area: score; }
.game .help { grid-area: help; }
.game .help p { margin: 0 0 0.75rem; }
@media (min-width: 760px) {
  .play {
    grid-template-columns: minmax(0, 420px) 1fr; column-gap: 1.75rem; align-items: start;
    grid-template-rows: auto auto auto 1fr auto auto;
    grid-template-areas: "picker nearest" "picker shapes" "picker help" "picker ." "misses misses" "score score";
  }
}
.game .hue-slider { height: 30px; border-radius: 15px; }
.wheel-box { position: relative; width: 100%; aspect-ratio: 1 / 1; touch-action: none; }
.wheel-box canvas { display: block; width: 100%; height: 100%; cursor: crosshair; border-radius: 50%; }
.value-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 30px; margin: 0; border-radius: 15px; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.value-slider::-webkit-slider-thumb {
  -webkit-appearance: none; box-sizing: border-box; width: 20px; height: 20px; border-radius: 50%;
  background: transparent; border: 3px solid #fff; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
}
.value-slider::-moz-range-thumb {
  box-sizing: border-box; width: 20px; height: 20px; border-radius: 50%;
  background: transparent; border: 3px solid #fff; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
}
.shapes { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.shape {
  padding: 0.5rem 1.1rem; border: none; background: none; color: var(--muted);
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
}
.shape.on { background: var(--ink); color: var(--paper); }
.shape:hover:not(.on) { background: var(--line); color: var(--ink); }
.game .hint {
  position: relative; margin: 0 0 1.25rem; padding: 0.9rem 1.1rem 1rem;
  border-radius: 8px; background: var(--ink); color: var(--paper);
  box-shadow: 0 10px 26px -12px rgba(40, 30, 20, 0.6);
}
.game .hint p { margin: 0 0 0.75rem; font-size: 0.92rem; line-height: 1.45; }
.game .hint::after {
  content: ""; position: absolute; left: 2rem; bottom: -9px;
  border-left: 9px solid transparent; border-right: 9px solid transparent; border-top: 9px solid var(--ink);
}
.hint-ok {
  padding: 0.45rem 1.1rem; border: 1px solid var(--paper); border-radius: 999px;
  background: none; color: var(--paper);
  font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
}
.hint-ok:hover { background: var(--paper); color: var(--ink); }
.options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.option { display: flex; flex-direction: column; align-items: flex-start; padding: 0; border: none; background: none; text-align: left; }
.option .swatch {
  display: block; width: 100%; aspect-ratio: 1 / 0.6; margin-bottom: 0.45rem;
  border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease;
}
.option:hover:not(:disabled) .swatch { transform: translateY(-3px); }
.option .name {
  font-size: 0.85rem; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* The names are enough here; it's the colours that matter. */
.game .option .make { display: none; }
/* Beside the picker on a computer: one row of six small chips, so all six are
   on screen with the two halves above them. */
@media (min-width: 760px) {
  .options { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 0.75rem 0.6rem; }
  .option .name { font-size: 0.76rem; }
}
.option .make { margin-top: 0.15rem; color: var(--muted); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; }
.option.tried { opacity: 0.35; cursor: not-allowed; }
.option.tried .name { text-decoration: line-through; }
.miss-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.miss { display: block; width: 2.2rem; height: 2.2rem; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); opacity: 0.55; }
.won { margin-top: 1.75rem; }
.won h3 { font-family: var(--serif); font-size: 1.8rem; }
.won p { max-width: 60ch; }
.won a { color: inherit; }
.after-game { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.after-game .save { margin: 0; }
.share, .fresh, .league-open {
  padding: 0.8rem 1.5rem; border: 1px solid var(--ink); border-radius: 999px;
  font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase;
}
.share { background: var(--ink); color: var(--paper); }
.share:hover { background: #46413b; }
.fresh, .league-open { background: var(--paper); color: var(--ink); }
.fresh:hover, .league-open:hover { background: var(--ink); color: var(--paper); }
.score-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem; padding-top: 1.25rem; border-top: 1px solid var(--line);
}
.score-row .quiet { margin: 0; }
.score-does { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.league-said { font-weight: 500; }
.to-beat { margin: 0.9rem 0 0; font-size: 0.95rem; }
.line { margin-top: 0.75rem; font-family: ui-monospace, monospace; font-size: 0.8rem; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .board { height: clamp(104px, 16vh, 180px); }
  .options { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
  .option .swatch { aspect-ratio: 1 / 0.62; margin-bottom: 0.35rem; }
  .option .name { font-size: 0.78rem; }
  .option .make { font-size: 0.55rem; }
}

/* --- The match game's league table, a pop-up ------------------------------ */

.league {
  width: min(680px, calc(100vw - 32px)); max-height: min(88vh, 960px);
  padding: 0; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 24px 60px -20px rgba(40, 30, 20, 0.55);
}
.league::backdrop { background: rgba(42, 39, 35, 0.45); }
.league-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; background: var(--paper); border-bottom: 1px solid var(--line);
}
.league-head h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 1.9rem; line-height: 1.1; }
.league-close {
  flex: none; width: 2.2rem; height: 2.2rem; border: 1px solid var(--line); border-radius: 50%;
  background: none; font-size: 1.2rem; line-height: 1;
}
.league-close:hover { background: var(--ink); color: var(--paper); }
.league-body { padding: 1rem 1.25rem 1.5rem; }
.league-summary { margin: 0; font-size: 1rem; }
.league-this { margin: 0.25rem 0 0; font-size: 0.88rem; }
.league-body h3 {
  margin: 1.6rem 0 0.4rem; color: var(--muted); font-weight: 400;
  font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase;
}
.league-says { margin: 0 0 0.9rem; font-size: 0.85rem; }
.league .dot { flex: none; display: block; width: 2rem; height: 2rem; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.league-top { list-style: none; margin: 0; padding: 0; }
.league-top li {
  display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto auto; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0; border-top: 1px solid var(--line); font-size: 0.9rem;
}
.league-top li:last-child { border-bottom: 1px solid var(--line); }
.league-top .place { font-family: var(--serif); font-size: 1.3rem; line-height: 1; text-align: right; color: var(--muted); }
.league-top li.you .place { color: var(--ink); }
.league-colour { display: flex; align-items: center; gap: 0.65rem; min-width: 0; color: inherit; text-decoration: none; }
.league-colour .league-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.league-colour:hover .league-name, .league-played a:hover .league-name { text-decoration: underline; text-underline-offset: 3px; }
.league-moves { font-variant-numeric: tabular-nums; white-space: nowrap; }
.league-when { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.you-tag {
  flex: none; margin-left: 0.45rem; padding: 0.1rem 0.45rem; border-radius: 999px;
  background: var(--ink); color: var(--paper); vertical-align: 0.1em;
  font-size: 0.58rem; letter-spacing: 0.14em; text-transform: uppercase;
}
.league-played {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem 0.75rem;
}
.league-played a { display: flex; flex-direction: column; gap: 0.3rem; color: inherit; text-decoration: none; }
.league-played .dot { width: 100%; height: auto; aspect-ratio: 1 / 0.5; }
.league-played .league-name { font-size: 0.85rem; line-height: 1.25; }
.league-played li.here .dot { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--ink); }
.league-figures { color: var(--muted); font-size: 0.74rem; line-height: 1.3; }
.league-play { font-weight: 500; }
.league-more-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem;
  margin-top: 1.5rem;
}
.league-count { font-size: 0.82rem; }
.league-more:disabled { opacity: 0.6; cursor: wait; }
@media (max-width: 560px) {
  .league-head h2 { font-size: 1.6rem; }
  .league-top li { grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: 0.6rem; }
  .league-when { display: none; }
  .league-played { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- The "?" by a colour scheme's name ---------------------------------------- */
/* Shows on hover, and on a tap or a Tab, since a phone can't hover. Not there
   at all until then (display: none, not just invisible), because a hidden
   one still pokes out past the edge of a phone and makes the page scroll
   sideways. */

.tip { position: relative; display: inline-block; margin-left: 0.45rem; vertical-align: 0.1em; }
.tip-q {
  width: 1.25rem; height: 1.25rem; padding: 0;
  border: 1px solid var(--muted); border-radius: 50%; background: none; color: var(--muted);
  font-family: system-ui, sans-serif; font-size: 0.72rem; line-height: 1;
  cursor: help;
}
.tip-q:hover, .tip-q:focus-visible { border-color: var(--ink); color: var(--ink); }
.tip-text {
  display: none;
  position: absolute; left: 50%; bottom: calc(100% + 0.55rem); z-index: 10;
  width: max-content; max-width: 18rem; padding: 0.65rem 0.8rem;
  transform: translateX(-50%);
  border-radius: 6px; background: var(--ink); color: var(--paper);
  font-family: system-ui, sans-serif; font-size: 0.82rem; line-height: 1.45; text-align: left;
  box-shadow: 0 10px 24px -12px rgba(40, 30, 20, 0.6);
}
.tip-text::after {
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--ink);
}
.tip:hover .tip-text, .tip:focus-within .tip-text { display: block; }
/* On a phone, across the width of the heading it explains, so it can't run
   off the screen. */
@media (max-width: 560px) {
  .related h4 { position: relative; }
  .tip { position: static; }
  .tip-text { left: 0; right: 0; width: auto; max-width: none; transform: none; bottom: calc(100% + 0.4rem); }
  .tip-text::after { display: none; }
}

/* What a win shares, shown before it's shared. */
.share-box {
  margin: 1.5rem 0 1.25rem; padding: 1.1rem 1.2rem 1.2rem;
  border: 1px solid var(--line); background: #fff; max-width: 40rem;
}
.share-text { margin: 0.5rem 0 0; font-size: 1rem; line-height: 1.5; overflow-wrap: anywhere; }
.share-box .after-game { margin-top: 0.9rem; }
.copy-share {
  padding: 0.8rem 1.5rem; border: 1px solid var(--ink); border-radius: 999px;
  background: var(--paper); color: var(--ink);
  font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase;
}
.copy-share:hover { background: var(--ink); color: var(--paper); }
.share-said { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.88rem; }

/* How long saved colours last, under the list on My colours. */
.kept-note { margin: 3rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--line); max-width: 42rem; }
.kept-note h4 { margin: 0 0 0.5rem; font-family: var(--serif); font-size: 1.3rem; font-weight: 400; }
.kept-note p { margin: 0 0 0.6rem; }
.kept-note ul { margin: 0 0 0.75rem; padding-left: 1.25rem; }
.kept-note li { margin: 0.2rem 0; }
.kept-note strong { color: var(--ink); font-weight: 500; }
