/* ============================================================================
   alkibit.com - /serialization/ page components
   REQUIRES assets/css/site.css to be loaded FIRST: every token, the base
   resets, header, footer, buttons and section rhythm live there. This file
   only adds what no other page uses.

   Note: `.field` here is the product page's form row. It is scoped to this
   file on purpose - the hero diagram also uses `.tree .field` for a
   serialized field label, and neither should leak into a shared sheet.
   ========================================================================= */

/* ------------------------------------------------- hero round-trip panel - */
.trip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: var(--s3);
}

.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  min-width: 0;
}
.panel__bar {
  display: flex; align-items: center; gap: var(--s2);
  padding: .55rem .8rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tint);
  font-family: var(--f-mono); font-size: var(--t-micro);
  color: var(--text-muted); letter-spacing: .02em;
}
.panel__bar svg { width: 13px; height: 13px; color: var(--accent); flex: none; }
.panel__body { padding: .75rem .85rem; font-family: var(--f-mono); font-size: 12px; line-height: 1.9; overflow-x: auto; }

/* hierarchy tree */
.tree { list-style: none; margin: 0; padding: 0; }
.tree ul { list-style: none; margin: 0; padding-left: 13px; border-left: 1px solid var(--border-strong); }
.tree li { white-space: nowrap; }
.tree .node { display: inline-flex; align-items: center; gap: .4rem; color: var(--text); }
.tree .node svg { width: 12px; height: 12px; color: var(--accent); flex: none; }
.tree .field { color: var(--text-muted); padding-left: 17px; }
.tree .field b { color: var(--accent-text); font-weight: 500; }

.trip__arrow {
  display: flex; align-items: center; justify-content: center;
  gap: .5rem; padding-block: 2px;
}
.trip__arrow span {
  font-family: var(--f-mono); font-size: 11px; color: var(--accent-text);
  white-space: nowrap; letter-spacing: .01em;
}
.trip__arrow svg { width: 18px; height: 18px; color: var(--accent); flex: none; }

.trip__json { color: var(--text-muted); white-space: pre; display: block; }
.trip__json .k { color: var(--accent-text); }
.trip__json .s, .trip__json .n { color: var(--text); }

.trip__ok {
  display: flex; align-items: center; gap: .4rem;
  font-family: var(--f-mono); font-size: 11px; color: var(--accent-text);
  padding: .5rem .85rem; border-top: 1px solid var(--border); background: var(--accent-soft);
}
.trip__ok svg { width: 13px; height: 13px; flex: none; }

/* ------------------------------------------------------------ stat strip - */
.stats {
  border-block: 1px solid var(--border);
  background: var(--bg-tint);
}
.stats__inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s4);
  padding-block: var(--s5);
}
@media (max-width: 860px) { .stats__inner { grid-template-columns: repeat(2, 1fr); gap: var(--s5); } }
.stat__n {
  font-family: var(--f-display); font-size: 1.55rem; font-weight: 600;
  letter-spacing: -0.02em; color: var(--accent-text); font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat__l { font-size: var(--t-small); color: var(--text-muted); line-height: 1.4; margin-top: 2px; }

/* -------------------------------------------------------- cost of inaction */
.bill { display: grid; gap: 0; margin-top: var(--s6); }
.bill__item {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: var(--s5);
  padding-block: var(--s5);
  border-top: 1px solid rgba(179, 207, 255, 0.16);
}
.bill__item:last-of-type { border-bottom: 1px solid rgba(179, 207, 255, 0.16); }
@media (max-width: 720px) {
  .bill__item { grid-template-columns: 1fr; gap: var(--s2); }
}
.bill__when {
  font-family: var(--f-mono); font-size: var(--t-micro);
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--c200); padding-top: .35rem; line-height: 1.5;
}
.bill__item h3 { font-size: 1.16rem; margin-bottom: var(--s2); }
.bill__item p { color: #B9C4D4; max-width: 62ch; }
.bill__item code {
  font-size: .9em; color: var(--c100);
  background: rgba(179, 207, 255, .09); padding: .1em .35em; border-radius: 4px;
}

.arith {
  margin-top: var(--s7);
  padding: clamp(1.5rem, 3vw, var(--s6));
  border-radius: var(--r-lg);
  background: rgba(13, 101, 254, 0.16);
  border: 1px solid rgba(128, 174, 254, 0.3);
  max-width: var(--prose);
}
.arith h3 { font-size: 1.16rem; margin-bottom: var(--s3); }
.arith p { color: #CBD5E4; }
.arith p + p { margin-top: var(--s3); }
.arith strong { color: #FFFFFF; }

/* --------------------------------------------------------------- 3 steps - */
.steps { display: grid; gap: var(--s6); counter-reset: step; }
.step {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(1rem, 2.6vw, var(--s6));
  align-items: start;
  padding-top: var(--s6);
  border-top: 1px solid var(--border);
}
.step:first-child { padding-top: 0; border-top: 0; }
@media (max-width: 900px) {
  .step { grid-template-columns: 2.6rem minmax(0, 1fr); }
  .step__code { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .step { grid-template-columns: 1fr; gap: var(--s3); }
}
.step__n {
  counter-increment: step;
  font-family: var(--f-mono); font-size: var(--t-small); font-weight: 500;
  color: var(--accent-text);
  padding-top: .3rem;
  font-variant-numeric: tabular-nums;
}
.step__n::before { content: counter(step, decimal-leading-zero); }
.step h3 { margin-bottom: var(--s3); }
.step p { color: var(--text-muted); }
.step p + p { margin-top: var(--s3); }
.step__txt code {
  font-size: .9em; color: var(--accent-text);
  background: var(--accent-soft); padding: .1em .35em; border-radius: 4px;
}

/* ----------------------------------------------------------- code blocks - */
.code {
  background: var(--code-bg);
  border: 1px solid rgba(179, 207, 255, 0.14);
  border-radius: var(--r-md);
  overflow: hidden;
}
.code__bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: .5rem .85rem;
  border-bottom: 1px solid rgba(179, 207, 255, 0.11);
  font-family: var(--f-mono); font-size: var(--t-micro);
  color: var(--code-dim); letter-spacing: .02em;
}
.code pre {
  margin: 0; padding: .9rem .95rem;
  overflow-x: auto;
  font-size: 12.5px; line-height: 1.75;
  color: var(--code-text);
  tab-size: 2;
}
.code .k { color: var(--code-key); }
.code .t { color: var(--code-type); }
.code .s { color: var(--code-str); }
.code .f { color: var(--code-fn); }
.code .c { color: var(--code-dim); font-style: italic; }

/* ------------------------------------------------------------- type grid - */
.cats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden;
}
.cat { background: var(--bg); padding: var(--s5); }
.cat__h { display: flex; align-items: center; gap: .55rem; margin-bottom: var(--s2); }
.cat__h svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.cat__h h3 { font-size: var(--t-body); font-weight: 600; letter-spacing: -0.012em; }
.cat p { font-size: var(--t-small); color: var(--text-muted); line-height: 1.55; }

.refs { margin-top: var(--s6); display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s3) var(--s6); }
.ref { display: grid; grid-template-columns: 18px 1fr; gap: .6rem; font-size: var(--t-small); }
.ref svg { width: 16px; height: 16px; margin-top: .22rem; color: var(--accent); flex: none; }
.ref b { font-weight: 600; }
.ref span { color: var(--text-muted); }

/* --------------------------------------------------------------- limits - */
.limits { display: grid; gap: 0; }
.limit {
  display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: var(--s5); padding-block: var(--s5);
  border-top: 1px solid var(--border);
}
.limit:last-child { border-bottom: 1px solid var(--border); }
@media (max-width: 720px) { .limit { grid-template-columns: 1fr; gap: var(--s2); } }
.limit__t { font-family: var(--f-mono); font-size: var(--t-small); color: var(--text); font-weight: 500; }
.limit__t em {
  display: block; font-style: normal; font-family: var(--f-body);
  font-size: var(--t-micro); text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted); margin-top: .3rem;
}
.limit p { font-size: var(--t-small); color: var(--text-muted); max-width: 66ch; }
.limit p + p { margin-top: var(--s2); }
.limit code { color: var(--accent-text); font-size: .93em; }

/* --------------------------------------------------------------- feature - */
.split {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 4vw, var(--s8)); align-items: center;
}
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.split p { color: var(--text-muted); }
.split p + p { margin-top: var(--s4); }
.split h2 { margin-bottom: var(--s4); }

.uses { display: grid; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); gap: var(--s5); }
.use {
  padding: var(--s5); border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--bg-raised);
}
.use svg { width: 20px; height: 20px; color: var(--accent); margin-bottom: var(--s3); }
.use h3 { font-size: var(--t-body); margin-bottom: var(--s2); }
.use p { font-size: var(--t-small); color: var(--text-muted); line-height: 1.55; }

/* ------------------------------------------------------------------- faq - */
.faq { max-width: var(--prose); }
.faq details { border-top: 1px solid var(--border); }
.faq details:last-of-type { border-bottom: 1px solid var(--border); }
.faq summary {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4);
  padding-block: var(--s4);
  font-family: var(--f-display); font-size: var(--t-h3); font-weight: 600;
  letter-spacing: -0.018em; line-height: 1.3;
  cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 12px; height: 12px; margin-top: .45rem;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(45deg); transition: transform .18s ease;
}
.faq details[open] summary::after { transform: rotate(-135deg); }
.faq summary:hover { color: var(--accent-text); }
.faq__a { padding-bottom: var(--s5); color: var(--text-muted); max-width: 62ch; }
.faq__a p + p { margin-top: var(--s3); }
.faq__a code { color: var(--accent-text); font-size: .93em; }


.formcard {
  background: var(--n-000); color: var(--brand-dark);
  border-radius: var(--r-lg); padding: clamp(1.5rem, 3vw, var(--s6));
  box-shadow: 0 20px 48px -20px rgba(1, 47, 127, .55);
}
.formcard h3 { color: var(--brand-dark); font-size: var(--t-h3); margin-bottom: var(--s2); }
.formcard > p { font-size: var(--t-small); color: var(--n-500); margin-bottom: var(--s5); }

.field { display: grid; gap: .4rem; margin-bottom: var(--s4); }
.field label { font-size: var(--t-small); font-weight: 600; color: var(--brand-dark); }
.field label span { font-weight: 400; color: var(--n-500); }
.field input, .field select {
  font-family: var(--f-body); font-size: var(--t-body);
  padding: .8rem .9rem;
  border: 1.5px solid var(--n-200); border-radius: var(--r-sm);
  background: var(--n-000); color: var(--brand-dark);
  width: 100%;
  transition: border-color .15s ease;
}
.field input:hover, .field select:hover { border-color: var(--c300); }
.field input:focus, .field select:focus { border-color: var(--accent); outline-offset: 1px; }
.field input::placeholder { color: #98A4B5; }

.formcard .btn { width: 100%; }
.formcard .btn[disabled] { opacity: .5; cursor: not-allowed; }
.form__fine { font-size: var(--t-micro); color: var(--n-500); margin-top: var(--s3); text-align: center; }
.form__status { font-size: var(--t-small); margin-top: var(--s3); }
.form__status:empty { margin-top: 0; }
.form__status[data-state="error"] { color: var(--c700); font-weight: 500; }
.form__status[data-state="ok"] { color: var(--c600); font-weight: 600; }

.setup-note {
  margin-top: var(--s4); padding: var(--s4);
  border: 1px dashed var(--n-200); border-radius: var(--r-sm);
  font-size: var(--t-micro); line-height: 1.6; color: var(--n-500);
}
.setup-note b { color: var(--brand-dark); }
.setup-note code { color: var(--c600); font-size: .95em; }

/* min-height only guards against a zero-height flash while the iframe loads.
   Keep it low: a tall floor would pin the frame and defeat auto-resize. */
.tally-embed { width: 100%; border: 0; border-radius: var(--r-sm); display: block; min-height: 180px; }

