/* ANKLE actions: one button + chip family for market and connect verbs.
 * v=20261011a · Ankle 2029 grammar, theme-following (reads theme.js tokens, 2029 fallbacks).
 *
 * Verbs:   Collect (primary) · Make offer · Gift · Remix · Pair agent · Connect coin
 * Root:    put class="ak" and data-theme-owned-color on the surface root.
 * Labels:  always <span> inside the control. theme.js paints every <a> with
 *          !important link color; the span carries the real color.
 * Never:   emoji, navy, labels under 10px, tap targets under 44px.
 *
 *   <a class="ak-act ak-act--primary" href="..."><span>Collect</span></a>
 *   <button class="ak-act" type="button"><span>Make offer</span></button>
 *   <button class="ak-act ak-act--quiet" type="button"><span>Gift</span></button>
 *   <a class="ak-act ak-act--connect" href="..."><i class="ak-glyph ak-glyph--agent"></i><span>Pair agent</span></a>
 *   <a class="ak-act ak-act--connect" href="..."><i class="ak-glyph ak-glyph--coin"></i><span>Connect coin</span></a>
 *   <span class="ak-chip"><span>Edition of 10</span></span>       static label
 *   <button class="ak-chip" aria-pressed="true"><span>All</span></button>   filter (44px)
 *   <span class="ak-chip ak-chip--ad"><span>Ad</span></span>       paid placement, always
 *
 * Connect grammar: the dashed square is ANKLE's mark and means an open slot.
 * Not connected = dashed outline. Connected = the square fills in. The coin is
 * an option inside a world, never the headline.
 */
@font-face {
  font-family: 'Areal';
  src: url('/static/fonts/areal-variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

.ak {
  --ak-ink: var(--fg, #0a0a0a);
  --ak-ground: var(--bg, #ffffff);
  --ak-well: var(--panel, #fafafa);
  --ak-line: var(--line, #e5e5e5);
  --ak-muted: var(--muted, #636363);
  --ak-radius: var(--radius, 12px);
  --ak-mark: #1501ee;            /* the dotted-square mark's own blue; marks only, never fills a bar */
  --ak-body: var(--body-font, 'Areal', 'InterAnkle', Inter, Arial, sans-serif);
  --ak-mono: 'Fragment Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ak-ink);
  font-family: var(--ak-body);
  -webkit-text-size-adjust: 100%;
}
.ak *, .ak *::before, .ak *::after { box-sizing: border-box; }
/* Ankle 2029 / Original speak Areal; every other theme keeps its own face. */
body.theme-ankle-2029 .ak,
body.theme-ankle-original .ak { --ak-body: 'Areal', 'InterAnkle', Inter, Arial, sans-serif; }
.ak [hidden] { display: none !important; }

/* ── Actions ─────────────────────────────────────────────────────────────── */
/* Paint is driven by three private variables so every variant also survives the
 * theme.css rule that repaints every <button> with !important (see block below). */
.ak-act {
  --_bg: var(--ak-ground);
  --_bd: var(--ak-ink);
  --_bs: solid;
  --_fg: var(--ak-ink);
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  margin: 0;
  padding: 0 16px;
  border: 1px var(--_bs) var(--_bd);
  border-radius: var(--ak-radius);
  background: var(--_bg);
  font: 600 12px/1 var(--ak-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none !important;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.ak-act > span { color: var(--_fg) !important; }
.ak-act:hover { --_bg: var(--ak-well); }
.ak-act:active { transform: translateY(1px); transition: none; }
.ak-act:focus-visible { outline: 2px solid var(--ak-ink); outline-offset: 2px; }

/* Primary: black on white. One per surface. */
.ak-act--primary,
.ak-act--primary:hover { --_bg: var(--ak-ink); --_bd: var(--ak-ink); --_fg: var(--ak-ground); }
.ak-act--primary:hover { opacity: .86; }

/* Quiet: secondary verbs (Make offer, Gift, Remix). */
.ak-act--quiet { --_bd: var(--ak-line); }
.ak-act--quiet:hover { --_bd: var(--ak-ink); --_bg: var(--ak-ground); }

/* Text: inline navigation that still has a 44px target. */
.ak-act--text,
.ak-act--text:hover { --_bg: transparent; --_bd: transparent; padding: 0 8px; }
.ak-act--text > span { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ak-act--text:hover > span { text-decoration-thickness: 2px; }

/* Connect: an open slot. Dashed edge until connected. */
.ak-act--connect { --_bs: dashed; --_bg: transparent; }
.ak-act--connect:hover { --_bs: solid; --_bg: var(--ak-ground); }
.ak-act--connected,
.ak-act--connected:hover { --_bs: solid; --_bd: var(--ak-line); --_bg: var(--ak-ground); }

.ak-act--block { display: flex; width: 100%; }
.ak-act--sm { padding: 0 12px; font-size: 11px; }

/* Truthful disabled state: looks disabled, says why in its label. */
.ak-act[disabled],
.ak-act[aria-disabled="true"] {
  --_bs: dashed;
  --_bd: var(--ak-line);
  --_bg: transparent;
  --_fg: var(--ak-muted);
  cursor: not-allowed;
  opacity: 1;
  transform: none;
}

/* theme.css (Ankle 2029 / Original) repaints every <button> with !important:
 * 8px radius, #f5f5f5 ground, near-black text. That turned the primary action into
 * white-on-grey. Repeat the class to outrank it; the paint stays variable-driven. */
.ak button.ak-act.ak-act.ak-act,
.ak button.ak-chip.ak-chip.ak-chip {
  background: var(--_bg) !important;
  border: 1px var(--_bs) var(--_bd) !important;
  color: var(--_fg) !important;
  box-shadow: none !important;
  font-family: var(--ak-mono) !important;
  font-weight: 600 !important;
  transition: background-color 120ms ease, border-color 120ms ease !important;
}
.ak button.ak-act.ak-act.ak-act { border-radius: var(--ak-radius) !important; }
.ak button.ak-chip.ak-chip.ak-chip { border-radius: 999px !important; }

.ak-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ── Glyphs: built from the mark ─────────────────────────────────────────── */
.ak-glyph {
  display: inline-block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  background: center / contain no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='1' y='1' width='14' height='14' fill='none' stroke='%231501ee' stroke-width='2' stroke-dasharray='3 2'/%3E%3C/svg%3E");
  font-style: normal;
}
.ak-glyph--agent { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='1' y='1' width='14' height='14' fill='none' stroke='%231501ee' stroke-width='2' stroke-dasharray='3 2'/%3E%3Crect x='6' y='6' width='4' height='4' fill='%231501ee'/%3E%3C/svg%3E"); }
.ak-glyph--coin { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='1' y='1' width='14' height='14' fill='none' stroke='%231501ee' stroke-width='2' stroke-dasharray='3 2'/%3E%3Ccircle cx='8' cy='8' r='3' fill='none' stroke='%231501ee' stroke-width='2'/%3E%3C/svg%3E"); }
.ak-glyph--on.ak-glyph--agent,
.ak-act--connected .ak-glyph--agent { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='1' y='1' width='14' height='14' fill='%231501ee' stroke='%231501ee' stroke-width='2'/%3E%3Crect x='6' y='6' width='4' height='4' fill='%23ffffff'/%3E%3C/svg%3E"); }
.ak-glyph--on.ak-glyph--coin,
.ak-act--connected .ak-glyph--coin { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='1' y='1' width='14' height='14' fill='%231501ee' stroke='%231501ee' stroke-width='2'/%3E%3Ccircle cx='8' cy='8' r='3' fill='none' stroke='%23ffffff' stroke-width='2'/%3E%3C/svg%3E"); }

/* The mark itself (Alex's artwork) and the one waiting state. */
.ak-mark {
  display: inline-block;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  /* Small sizes: the same dashed square drawn as vector so the dashes survive. */
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='1.25' y='1.25' width='21.5' height='21.5' fill='none' stroke='%231501ee' stroke-width='2.5' stroke-dasharray='3.2 2.2'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* Large sizes: Alex's original artwork. */
.ak-mark--art,
.ak-wait .ak-mark { background-image: url('/static/ANKL_blue_box_refined.png?v=dotted-square-v1'); }
.ak-wait { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 56px 0; }
.ak-wait .ak-mark { width: 48px; height: 48px; animation: akSquareFloat 3.2s linear infinite; }
@keyframes akSquareFloat {
  0% { transform: perspective(420px) translateY(0) rotateX(12deg) rotateY(0deg); }
  50% { transform: perspective(420px) translateY(-6px) rotateX(-12deg) rotateY(180deg); }
  100% { transform: perspective(420px) translateY(0) rotateX(12deg) rotateY(360deg); }
}
@media (prefers-reduced-motion: reduce) { .ak-wait .ak-mark { animation: none; } }

/* ── Chips ───────────────────────────────────────────────────────────────── */
.ak-chip {
  --_bg: var(--ak-ground);
  --_bd: var(--ak-line);
  --_bs: solid;
  --_fg: var(--ak-ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border: 1px var(--_bs) var(--_bd);
  border-radius: 999px;
  background: var(--_bg);
  font: 600 11px/1 var(--ak-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
}
.ak-chip > span { color: var(--_fg) !important; overflow: hidden; text-overflow: ellipsis; }
.ak-chip--muted { --_fg: var(--ak-muted); }
.ak-chip--ink { --_bg: var(--ak-ink); --_bd: var(--ak-ink); --_fg: var(--ak-ground); }
/* Paid placement. Always shown, never softened. */
.ak-chip--ad { --_bd: var(--ak-ink); --_bg: var(--ak-ground); --_fg: var(--ak-ink); }

button.ak-chip,
a.ak-chip {
  appearance: none;
  -webkit-appearance: none;
  height: auto;
  min-height: 44px;
  padding: 0 14px;
  margin: 0;
  cursor: pointer;
  text-decoration: none !important;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 120ms ease, background-color 120ms ease;
}
button.ak-chip:hover,
a.ak-chip:hover { --_bd: var(--ak-ink); }
button.ak-chip:focus-visible,
a.ak-chip:focus-visible { outline: 2px solid var(--ak-ink); outline-offset: 2px; }
.ak-chip[aria-pressed="true"],
.ak-chip[aria-pressed="true"]:hover { --_bg: var(--ak-ink); --_bd: var(--ak-ink); --_fg: var(--ak-ground); }
.ak-chip .ak-n { color: var(--ak-muted) !important; font-weight: 500; }
.ak-chip[aria-pressed="true"] .ak-n { color: var(--ak-ground) !important; opacity: .7; }

/* ── Page frame ──────────────────────────────────────────────────────────── */
.ak-page { max-width: 1120px; margin: 0 auto; padding: 20px 16px 112px; }
.ak-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; }
.ak-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ak-h1 { margin: 0; font: 700 28px/1.05 var(--ak-body); letter-spacing: -.01em; color: var(--ak-ink) !important; }
.ak-h { margin: 0; font: 650 18px/1.2 var(--ak-body); color: var(--ak-ink) !important; }
.ak-sub { margin: 6px 0 0; font: 400 15px/1.45 var(--ak-body); color: var(--ak-muted) !important; max-width: 56ch; }
.ak-eyebrow { display: block; margin: 0 0 8px; font: 600 11px/1.2 var(--ak-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ak-muted) !important; }
.ak-filters { display: grid; gap: 10px; margin: 0 0 16px; }
.ak-filters .ak-row { gap: 6px; }
.ak-rule { height: 1px; border: 0; background: var(--ak-line); margin: 28px 0; }
.ak-more { display: flex; justify-content: center; margin: 20px 0 0; }
.ak-note { font: 500 11px/1.5 var(--ak-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ak-muted) !important; }

/* ── Tiles ───────────────────────────────────────────────────────────────── */
.ak-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .ak-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1040px) { .ak-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.ak-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--ak-ground);
  border: 1px solid var(--ak-line);
  border-radius: var(--ak-radius);
  overflow: hidden;
  transition: border-color 120ms ease;
}
.ak-tile:hover { border-color: var(--ak-ink); }
.ak-tile:focus-within { border-color: var(--ak-ink); }
/* The whole tile is the link; the world link sits above it. */
.ak-go { position: static; text-decoration: none !important; outline: none; }
.ak-go::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.ak-go:focus-visible::after { outline: 2px solid var(--ak-ink); outline-offset: -2px; }
.ak-media {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  background: var(--ak-well);
  overflow: hidden;
}
.ak-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ak-mosaic { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; height: 100%; }
.ak-mosaic img { min-height: 0; }
.ak-type {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 14px;
}
.ak-type .ak-mark { width: 26px; height: 26px; }
.ak-type__word {
  font: 650 22px/1.05 var(--ak-body);
  color: var(--ak-ink) !important;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ak-flag { position: absolute; top: 8px; left: 8px; z-index: 2; }
.ak-body { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; padding: 10px 12px 12px; min-width: 0; }
.ak-name {
  font: 600 15px/1.25 var(--ak-body);
  color: var(--ak-ink) !important;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ak-by {
  font: 500 11px/1.35 var(--ak-mono);
  letter-spacing: .02em;
  color: var(--ak-muted) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ak-in { position: relative; z-index: 2; padding: 14px 0; margin: -14px 0; color: var(--ak-ink) !important; text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.ak-in > span { color: var(--ak-ink) !important; }
.ak-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 4px; min-width: 0; }
.ak-price { font: 650 15px/1.1 var(--ak-body); color: var(--ak-ink) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ak-price .ak-alt { display: block; margin-top: 2px; font: 500 11px/1.2 var(--ak-mono); color: var(--ak-muted) !important; }
@media (max-width: 420px) {
  .ak-foot { flex-direction: column; align-items: flex-start; }
}

/* ── Empty and error ─────────────────────────────────────────────────────── */
.ak-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 28px 20px;
  border: 1px dashed var(--ak-line);
  border-radius: var(--ak-radius);
  background: var(--ak-ground);
}
.ak-empty .ak-mark { width: 32px; height: 32px; }
.ak-empty .ak-row { margin-top: 6px; }

/* ── Connections: agent + coin, woven into a world ───────────────────────── */
.ak-conn { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.ak-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  padding: 0 14px 0 12px;
  border: 1px solid var(--ak-line);
  border-radius: 999px;
  background: var(--ak-ground);
  text-decoration: none !important;
  transition: border-color 120ms ease;
}
a.ak-pill:hover { border-color: var(--ak-ink); }
a.ak-pill:focus-visible { outline: 2px solid var(--ak-ink); outline-offset: 2px; }
.ak-pill__main { font: 650 14px/1 var(--ak-body); color: var(--ak-ink) !important; white-space: nowrap; }
.ak-pill__sub { font: 500 11px/1 var(--ak-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ak-muted) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ── Booth header ────────────────────────────────────────────────────────── */
.ak-booth { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: start; margin: 0 0 20px; }
.ak-booth__img { width: 64px; height: 64px; border-radius: var(--ak-radius); background: var(--ak-well); border: 1px solid var(--ak-line); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.ak-booth__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ak-host { display: block; margin: 4px 0 0; font: 500 12px/1.3 var(--ak-mono); color: var(--ak-muted) !important; overflow-wrap: anywhere; }
