/* The shell stylesheet.
 *
 * DL-01  Every colour in this file is a var() onto tokens.generated.css, which is
 *        generated from the contract. There is not a hex literal in here and the
 *        gate in tests/shell/styles.test.ts fails the build if one appears.
 * DL-02  Interaction is near-white (--act). The mark green is the wordmark, the
 *        focus ring and the active-nav marker, and nothing else.
 * DL-09  390px is a Done-condition. Nothing here has a fixed width, every box is
 *        border-box, and the two rows that could overflow wrap instead.
 * DL-10  Structure is hairlines on the ground colour. No shadows, no gradients,
 *        radius tops out at 6px.
 * DL-11  Every number, ticker, address and micro-label is mono with tabular-nums.
 *        The display face carries the wordmark and headings and nothing else.
 *
 * Floor: no text below 11px, anywhere. Doc 11's 9px micro-label sits below doc
 * 11's own stated minimum; the minimum wins and 11px is the smallest size used.
 */

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--ink);
  color: var(--t2);          /* the root inherits a UA white otherwise, and DL-01 has no white */
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--t2);
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 400;         /* doc 11: body weight moves to 400 below 15px */
  line-height: 1.6;
}

/* There is deliberately no `overflow-x: hidden` on the body. It would make the
 * 390px assertion in the acceptance run pass over a layout that genuinely
 * overflows — a clip is not a fit, and a control that cannot go red is not a
 * control. DL-09 is measured, not hidden. */

/* One focus ring, one colour, everywhere. --mark's third and last job. */
:focus-visible {
  outline: 2px solid var(--mark);
  outline-offset: 2px;
  border-radius: 3px;
}

a { color: inherit; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 8px 12px;
  background: var(--surf);
  color: var(--t1);
  font-size: 13px;
  border-radius: 4px;
}
.skip:focus { left: 8px; z-index: 10; }

/* ---------------------------------------------------------------- header */

.head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--ink);
  border-bottom: 1px solid var(--rule);
}

.head__bar,
.nav,
.head__strip {
  width: 100%;
  max-width: 1320px;        /* doc 11 §2 shell */
  margin: 0 auto;
  padding-left: 18px;
  padding-right: 18px;
}

.head__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.wordmark {
  flex: 0 0 auto;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.035em;
  color: var(--mark);        /* --mark job 1 of 3 */
  text-decoration: none;
}

/* ------------------------------------------------------------ scan field */

.scan {
  flex: 1 1 240px;
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 1px;                  /* hairline gutter */
}

.scan__label {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.scan__input {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--ink2);
  border: 1px solid var(--rule);
  border-radius: 4px 0 0 4px;
  color: var(--t1);
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  padding: 8px 10px;
}
.scan__input::placeholder { color: var(--t3); }
.scan__input:hover { border-color: var(--rule2); }

/* DL-02: the primary action is filled near-white and it is not a money action. */
.scan__go {
  flex: 0 0 auto;
  background: var(--act);
  color: var(--act-on);
  border: 1px solid var(--act);
  border-radius: 0 4px 4px 0;
  font-family: var(--ui);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
}

/* -------------------------------------------------------------- nav */

.nav { padding-bottom: 0; }

.nav__list {
  display: flex;
  flex-wrap: wrap;           /* DL-09: seven items at 390px wrap; they never scroll sideways */
  align-items: stretch;
  gap: 0 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__item { display: flex; }

.nav__link {
  display: inline-flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 2px solid transparent;
  color: var(--t2);
  font-family: var(--ui);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.nav__link:hover { color: var(--t1); }

/* --mark job 3 of 3: the active-nav marker. Not a fill, and never near a value. */
.nav__link[aria-current="page"] {
  color: var(--t1);
  border-bottom-color: var(--mark);
}

/* Visibly disabled: dimmed to the disabled token, struck through the underline
 * slot, not a pointer, and carrying its reason as the title. */
.nav__link--reserved {
  color: var(--t4);
  border-bottom-color: transparent;
  cursor: not-allowed;
  font-weight: 400;
  text-decoration: line-through;
  text-decoration-color: var(--t4);
  text-decoration-thickness: 1px;
}
.nav__link--reserved:hover { color: var(--t4); }

/* ----------------------------------------------------- chains + risk note */

.head__strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 14px;
  padding-top: 8px;
  padding-bottom: 8px;
  border-top: 1px solid var(--rule);
}

.chains { min-width: 0; }

.chains__list {
  display: flex;
  flex-wrap: wrap;           /* six chips fit 390px by wrapping, never by scrolling */
  gap: 6px;                  /* chip row */
  list-style: none;
  margin: 0;
  padding: 0;
}

.chain__btn {
  display: flex;
  flex-direction: column;    /* logo, ticker beneath — doc 11 §3.5 */
  align-items: center;
  gap: 2px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--t3);
}
.chain__btn:hover { background: var(--surf2); }
.chain__btn[aria-pressed="true"] {
  background: var(--surf2);
  border-color: var(--rule2);
  color: var(--t1);
}

/* The chain accent tints the mark and nothing else — 13% alpha, per doc 11 §2.
 * It never colours text and it never colours a value. */
.chain__mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;        /* asset icon */
  background: color-mix(in srgb, var(--chain) 13%, transparent);
  border: 1px solid var(--rule);
  color: var(--t2);
  font-family: var(--disp);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.chain__ticker {
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.10em;
  line-height: 1.2;
}

/* --------------------------------------------------------- risk-free note */

.riskfree {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  color: var(--t3);
}

.riskfree__tail {
  font-family: var(--ui);
  font-size: 11px;
  overflow-wrap: anywhere;
}

/* DL-13: dotted underline, never a question mark, opens on tap or click.
 * <details> is that mechanism with no script attached to it. */
.def { position: relative; }

.def__term {
  display: inline;
  list-style: none;
  cursor: pointer;
  color: var(--t2);
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 600;
  text-decoration: underline dotted var(--t3);
  text-underline-offset: 3px;
}
.def__term::-webkit-details-marker { display: none; }

.def__body {
  position: absolute;
  z-index: 6;
  top: calc(100% + 6px);
  left: 0;
  width: min(340px, calc(100vw - 36px));
  background: var(--surf);
  border: 1px solid var(--rule2);
  border-radius: 4px;
  padding: 10px 12px;
  color: var(--t2);
  font-size: 12px;
  line-height: 1.5;
}
.def__body p { margin: 0 0 6px; }
.def__body p:last-child { margin-bottom: 0; }

/* The source line is mandatory; it is what makes this a citation, not a tooltip. */
.def__source {
  color: var(--t3);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- route */

.route {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px 18px 70px;   /* doc 11 §2 shell padding */
  min-width: 0;
}
.route:focus { outline: none; }

.route__placeholder {
  border: 1px dashed var(--rule2);
  border-radius: 4px;
  padding: 18px;
}
.route__placeholder-line {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--t2);
}
.route__placeholder-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--t3);
}

/* One breakpoint, and it only changes how the header rows pack. Nothing appears
 * or disappears with width — mobile hides, it never drops, and here it does not
 * even hide. */
@media (min-width: 920px) {
  .head__bar { flex-wrap: nowrap; }
  .scan { flex: 0 1 420px; margin-left: auto; }
  .head__strip { flex-wrap: nowrap; }
}

/* Visually hidden, still announced. The reserved items carry their reason in a
 * `title`, which the brief asks for and which a screen reader may not read; the
 * same sentence is in the accessibility tree here so the reason is not
 * pointer-only. */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
