/* ---------------------------------------------------------------------------
   plinth: the look.

   Design reference: drinkcollider.com, read from screenshots rather than from
   a description of it. Taken as a language and rebuilt from nothing: no CSS,
   markup, copy or asset came across.

   The grammar that was kept:

   - Warm cream ground with near-black ink. A light page, not a dark one.
   - A giant wordmark, edge to edge, cropped by the viewport, that content
     overlaps rather than clears.
   - A full-bleed landscape behind the hero, atmospheric and warm.
   - Hard rules and boxed sections. Structure carried by lines, not by shadows.
   - Pill buttons, thin outline, small uppercase labels.
   - One hot accent, orange, plus cooler tones from the product art.

   Deliberately not here, on Arsalan's instruction:
   - No glowing orbs or radial blobs anywhere. They are the default background
     of every generated page and they read as filler.
   - No coloured bar down one edge of a panel to signal state. State is carried
     by the whole border, a background tint and a chip, so a panel never looks
     like it has a stripe stuck to it.

   The landscape is generated, in `index.html`, as inline SVG. Nothing is
   downloaded and nothing is anybody else's, so there is no licence to honour
   and no third party who can take it away.
   --------------------------------------------------------------------------- */

:root {
  --ground: #f7f2ea;
  --surface: #fffdf9;
  --surface-2: #efe7d9;
  --line: rgba(16, 14, 12, 0.16);
  --rule: rgba(16, 14, 12, 0.85);
  --text: #0d0b0a;
  --dim: #6a635a;

  --accent: #d9530a;
  --warn: #b8791a;
  --bad: #b3311a;

  --glow: rgba(217, 83, 10, 0.07);
  --shadow: rgba(48, 34, 18, 0.16);

  --seller: #d9530a;
  --creator: #6b5bd0;
  --market: #2f8f76;

  --settled: #2f7a55;
  --reverted: #b3311a;

  /* Apple glass: a translucent plate that picks up what is behind it. The
     blur does the work, the saturation stops it going grey, and the inner
     highlight is a light on the surface rather than an accent colour. */
  --glass-top: rgba(255, 253, 249, 0.74);
  --glass-bottom: rgba(255, 253, 249, 0.56);
  --glass-line: rgba(16, 14, 12, 0.12);
  --glass-sheen: rgba(255, 255, 255, 0.65);

  /* The landscape, back to front. Deliberately pale and low contrast: it is
     scenery behind a page people have to read, not a photograph. Ridge 4 is
     furthest away and lightest, which is how distance actually looks. */
  --sky-top: #fdfaf5;
  --sky-bottom: #f2e7d4;
  --ridge-4: #f0e6d4;
  --ridge-3: #e9dcc5;
  --ridge-2: #e1d1b6;
  --ridge-1: #d8c5a5;

  --display: "Sora", ui-sans-serif, system-ui, sans-serif;
  --sans: "Figtree", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r: 4px;
  --r-glass: 18px;
  --band: 70rem;
}

:root[data-theme="dark"] {
  --ground: #0c0b09;
  --surface: #16130f;
  --surface-2: #1d1915;
  --line: rgba(247, 242, 234, 0.16);
  --rule: rgba(247, 242, 234, 0.8);
  --text: #f7f2ea;
  --dim: #9c948a;

  /* Orange that reads on cream burns on near-black, so it is re-picked rather
     than reused. A token carrying meaning must not derive from one carrying
     appearance. */
  --accent: #ff8442;
  --warn: #e0a24a;
  --bad: #e2603f;

  --glow: rgba(255, 132, 66, 0.1);
  --shadow: rgba(0, 0, 0, 0.6);

  --seller: #ff8442;
  --creator: #9a8bea;
  --market: #4fc3a5;

  --settled: #56b98c;
  --reverted: #e2603f;

  --glass-top: rgba(30, 26, 21, 0.7);
  --glass-bottom: rgba(22, 19, 15, 0.55);
  --glass-line: rgba(247, 242, 234, 0.14);
  --glass-sheen: rgba(255, 255, 255, 0.14);

  --sky-top: #0e0c09;
  --sky-bottom: #1a150f;
  --ridge-4: #17130e;
  --ridge-3: #1d1812;
  --ridge-2: #241d15;
  --ridge-1: #2c2419;
}

/* ------------------------------------------------------------- the backdrop */

/*
 * The landscape sits behind everything, fixed, and never scrolls out. Its
 * layers move at different rates under a real scroll position, which is the
 * only motion on it. No drift, no float, no pulse.
 */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.backdrop svg {
  width: 100%;
  height: 100%;
  display: block;
}

.backdrop .ridge {
  transition: transform 0.1s linear;
  will-change: transform;
}

/* Grain over the whole thing, so the gradient never bands on a wide screen.
   An SVG element without explicit dimensions collapses to its default 300 by
   150, which renders as a grey rectangle in the corner rather than as texture
   across the page. */
.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: multiply;
}

:root[data-theme="dark"] .grain {
  mix-blend-mode: screen;
  opacity: 0.28;
}

body {
  background: transparent;
}

/* --------------------------------------------------------------- typography */

.wordmark,
.hero-title,
h2,
h3 {
  font-family: var(--display);
}

.wordmark {
  font-weight: 800;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}

.hero-title {
  font-weight: 800;
  font-size: clamp(2.6rem, 6.6vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  max-width: 16ch;
}

.hero-title em {
  font-style: normal;
  color: var(--accent);
}

h2 {
  font-weight: 800;
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  letter-spacing: -0.03em;
}

h3 {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.015em;
}

.lede {
  max-width: 48ch;
  font-size: 1.06rem;
}

/* --------------------------------------------------- the giant wordmark */

/*
 * The reference's signature: the name at a size the viewport cannot hold, cut
 * off at both edges.
 *
 * It does not sit under the copy, though. The reference overlaps a photograph;
 * here it would overlap text somebody has to read, and a wordmark behind a
 * paragraph is a legibility problem with a rationale attached.
 *
 * `overflow: clip` rather than `hidden`, so the page never grows a horizontal
 * scrollbar. Pointer events off because it is decoration that happens to be
 * text, and catching it while selecting a paragraph is irritating.
 */
.megaword {
  position: relative;
  overflow: clip;
  margin: 0 0 0.6rem;
  line-height: 0.78;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.megaword span {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(4.5rem, 20vw, 16rem);
  letter-spacing: -0.055em;
  color: var(--text);
  white-space: nowrap;
  opacity: 0.88;
}

@media (max-width: 40rem) {
  .megaword {
    margin-bottom: 0.3rem;
  }
}

/* -------------------------------------------------------------- Apple glass */

/*
 * One plate, used by every panel. The blur is what makes it glass; the
 * gradient stops it reading as flat film; the sheen is a highlight along the
 * top edge, which is a light on a surface rather than a colour accent.
 */
.glass {
  position: relative;
  background: linear-gradient(180deg, var(--glass-top), var(--glass-bottom));
  border: 1px solid var(--glass-line);
  border-radius: var(--r-glass);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-sheen), 0 10px 34px -18px var(--shadow);
}

@supports not (backdrop-filter: blur(1px)) {
  /* Without blur the plate is just translucent, and translucent over a busy
     landscape is unreadable. Fall back to opaque rather than to unreadable. */
  .glass {
    background: var(--surface);
  }
}

.btn {
  border-radius: 999px;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn[disabled],
.pill[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ------------------------------------------------------------------ reveals */

/*
 * Revealed by a position check inside the scroll handler that already exists,
 * never by IntersectionObserver. Observers coalesce callbacks, so an element
 * entering and leaving the viewport between two ticks never reports as
 * intersecting and stays invisible for good. Fast scroll, a deep link and the
 * End key all reproduce it, silently.
 */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s cubic-bezier(0.2, 0.7, 0.3, 1), transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .backdrop .ridge {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ------------------------------------------------------------ wallet strip */

.wallet {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1px;
  margin-top: 1.5rem;
  padding: 0;
  overflow: hidden;
}

.wallet .cell {
  padding: 0.9rem 1.1rem;
  background: linear-gradient(180deg, var(--glass-top), var(--glass-bottom));
}

.wallet .k {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 0.3rem;
}

.wallet .v {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.wallet .v.accent {
  color: var(--accent);
}

.wallet .cell.actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* A demo badge that cannot be missed and cannot be mistaken for a chain. */
.badge-demo {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--warn);
  border: 1px solid var(--warn);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
}

/* ---------------------------------------------------------------- the market */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.1rem;
  margin-top: 1.5rem;
}

.item {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.25s ease;
}

.item:hover {
  transform: translateY(-4px);
  box-shadow: inset 0 1px 0 var(--glass-sheen), 0 20px 44px -22px var(--shadow);
}

.item .art {
  aspect-ratio: 1;
  width: 100%;
  display: block;
  border-bottom: 1px solid var(--glass-line);
  background: var(--surface-2);
}

.item .art svg,
.item .art img {
  width: 100%;
  height: 100%;
  display: block;
}

.item .meta {
  padding: 0.85rem 0.95rem;
  display: grid;
  gap: 0.55rem;
}

.item .row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.item .id {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--dim);
}

.item .price {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}

.item .owner {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--dim);
}

/* State is the whole border plus a tint, never a stripe down one side. */
.item.is-mine {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--glass-line));
}

.item.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

.item .actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.item .actions .btn {
  padding: 0.34rem 0.8rem;
  font-size: 0.74rem;
}

.price-input {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.34rem 0.55rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--glass-line);
  border-radius: var(--r);
}

.price-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--dim);
  font-size: 0.92rem;
}

/* --------------------------------------------------------------- the split */

.split-bar {
  display: flex;
  height: 2.6rem;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--glass-line);
  background: var(--surface-2);
}

.split-bar span {
  display: block;
  width: 0;
  transition: width 0.8s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.split-bar .s-seller {
  background: var(--seller);
}
.split-bar .s-creator {
  background: var(--creator);
}
.split-bar .s-market {
  background: var(--market);
}

.split-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1px;
  margin-top: 1rem;
  border: 1px solid var(--glass-line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--glass-line);
}

.split-legend div {
  padding: 0.65rem 0.8rem;
  background: var(--surface);
}

.split-legend .k {
  display: block;
  font-size: 0.66rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 0.2rem;
}

.split-legend .v {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
}

.split-legend .l-seller .v {
  color: var(--seller);
}
.split-legend .l-creator .v {
  color: var(--creator);
}
.split-legend .l-market .v {
  color: var(--market);
}

/* -------------------------------------------------------------------- scenes */

.scene {
  margin: 1.5rem 0 0;
  padding: 1.4rem;
}

.scene-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.9rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--glass-line);
}

.scene-note {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  color: var(--dim);
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

.lanes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1px;
  border: 1px solid var(--glass-line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--glass-line);
}

.lane {
  padding: 1rem;
  background: var(--surface);
  transition: background 0.3s ease;
}

/* Tint the whole panel, no stripe. */
.lane.is-reverted {
  background: color-mix(in srgb, var(--reverted) 7%, var(--surface));
}

.lane.is-settled {
  background: color-mix(in srgb, var(--settled) 8%, var(--surface));
}

.lane h3 {
  margin: 0 0 0.15rem;
}

.lane .lane-sub {
  font-size: 0.78rem;
  color: var(--dim);
  margin: 0 0 0.9rem;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.steps li {
  display: grid;
  grid-template-columns: 1.3rem 1fr;
  gap: 0.5rem;
  align-items: start;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  opacity: 0.25;
  transform: translateX(-4px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.steps li.is-on {
  opacity: 1;
  transform: none;
}

.steps li .mark {
  width: 1.3rem;
  text-align: center;
  color: var(--dim);
}

.steps li.is-good .mark {
  color: var(--settled);
}
.steps li.is-bad .mark,
.steps li.is-bad {
  color: var(--reverted);
}

.verdict {
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--glass-line);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  min-height: 1.2rem;
}

.verdict.is-bad {
  color: var(--reverted);
}
.verdict.is-good {
  color: var(--settled);
}

/* ------------------------------------------------------------------- status */

/* One line that tells the user what the page is doing right now. Signing and
   waiting for a block are different states, and one spinner for both makes the
   twenty seconds between them feel like a hang. */
.status {
  margin-top: 1rem;
  min-height: 1.4rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status.is-bad {
  color: var(--reverted);
}
.status.is-good {
  color: var(--settled);
}

.status a {
  color: inherit;
}

.spinner {
  width: 0.8rem;
  height: 0.8rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

/* --------------------------------------------------------------- responsive */

@media (max-width: 40rem) {
  .scene {
    padding: 1rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 0.8rem;
  }

  .split-bar {
    height: 2.1rem;
  }
}
