/* ============================================================================
   JWT Decoder — tool layer over base.css
   base.css supplies reset, type, forms, buttons, chips, badges, panels, tables,
   header, footer, focus rings. This file adds the accent and only what is
   unique to this tool.

   Accent — violet-magenta, measured against base.css surfaces (WCAG relative
   luminance):
     dark  #c261ef  5.6:1 on --bg   5.2:1 on --surface   5.8:1 on --bg-sunk
     light #690896  9.7:1 on --bg  10.1:1 on --surface   8.9:1 on --bg-sunk
   Both clear the 4.5:1 text floor on all three surfaces in both themes.
   ========================================================================= */
:root { --accent: #c261ef; --accent-dim: rgba(194, 97, 239, 0.14); }
@media (prefers-color-scheme: light) {
  :root { --accent: #690896; --accent-dim: rgba(105, 8, 150, 0.10); }
}

/* ============================================================================
   The instrument bay
   ========================================================================= */

.tool-bay .panel { margin-bottom: 1.25rem; }

.jwt-input-row textarea {
  min-height: 6.5rem;
  resize: vertical;
  font-size: 0.8125rem;
  line-height: 1.5;
  word-break: break-all;
}

.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }

.err {
  display: block;
  min-height: 1.4em;
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--err);
}

.idle-note {
  font-size: 0.9375rem;
  color: var(--text-dim);
  margin: 0.9rem 0 0;
}

/* ---------------------------------------------------------- validity row */

.validity-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
  margin-bottom: 1.5rem;
}
.validity-detail {
  font-size: 0.9375rem;
  color: var(--text-dim);
}

/* -------------------------------------------------------------- sections */

.jwt-part {
  margin-bottom: 1.5rem;
}
.jwt-part:last-child { margin-bottom: 0; }

.jwt-part h3 {
  margin: 0 0 0.6rem;
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.jwt-tag {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
}

.jwt-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr));
}

/* --------------------------------------------------------------- JSON out */

.json-out {
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  min-height: 3rem;
}

.json-out .t-key    { color: var(--text); font-weight: 600; }
.json-out .t-punc   { color: var(--text-faint); }
.json-out .t-string { color: var(--ok); }
.json-out .t-number { color: var(--accent); }
.json-out .t-boolean,
.json-out .t-null   { color: var(--warn); }
.json-out .t-error  { color: var(--err); white-space: pre-wrap; }

.sig-out {
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0.6rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
  color: var(--text-dim);
}

/* -------------------------------------------------------------- claims */

#claims-section .table-scroll { margin-top: 0.6rem; }
#claims-table .claim-name { font-family: var(--mono); font-weight: 600; color: var(--text); white-space: nowrap; }
#claims-table .claim-loc   { color: var(--text-faint); font-size: 0.8125rem; white-space: nowrap; }
#claims-table .claim-value { font-family: var(--mono); font-size: 0.8125rem; overflow-wrap: anywhere; }
#claims-table .claim-desc  { color: var(--text-dim); font-size: 0.875rem; }
#claims-table .claim-ts    { display: block; color: var(--text-faint); font-size: 0.78125rem; margin-top: 0.15rem; }
.no-claims-note { color: var(--text-dim); font-size: 0.9375rem; margin: 0.6rem 0 0; }

/* --------------------------------------------------------------- article */

.section { max-width: 74ch; }
.section table { max-width: none; }

.callout {
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.1rem;
  margin: 0 0 1.2em;
  font-size: 0.9375rem;
  color: var(--text-dim);
}
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--text); }

.pagelinks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.pagelinks a {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1.15rem;
}
.pagelinks a:hover { border-color: var(--accent); }
.pagelinks strong { display: block; color: var(--accent); margin-bottom: 0.15rem; }
.pagelinks span   { display: block; color: var(--text-dim); font-size: 0.875rem; }

.noscript {
  background: var(--err-bg);
  border: 1px solid var(--err);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  color: var(--err);
  font-size: 0.9375rem;
}
