/* Instrumentry demo as the hero (brief v4, section 6). Ported from the yambo-site prototype;
   classes that the converter below also uses are prefixed (d-tabs, d-sheet-h). */

.demo-hero {
  --soft: var(--ink-2);
  --on-accent: var(--accent-ink);
}

.demo-box {
  margin-top: 28px;
  border-top: 2px solid var(--ink);
}

.demo-box__head {
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
  color: var(--ink-2);
}

.demo-box__head strong {
  color: var(--ink);
}

.demo-cta {
  margin-top: 26px;
}

.demo-cta .note {
  display: block;
  margin-top: 8px;
}

.demo-more {
  font-size: 15px;
}

.phone {
  width: 100%;
  max-width: 22rem;
  margin-inline: auto;
  padding: 0.75rem 0.6rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 2rem;
  background: var(--ink);
}

.phone__screen {
  height: 34rem;
  overflow-y: auto;
  border-radius: 1.4rem;
  background: #fff;
  color: #1a1a1a;
  font-family: var(--sans);
  font-size: 0.9375rem;
}

.phone__bar {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 0.9375rem;
}

.fq {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e3e3e3;
}

.fq[hidden] {
  display: none;
}

.fq__label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 600;
}

.fq__hint {
  display: block;
  margin: -0.25rem 0 0.45rem;
  font-size: 0.8125rem;
  color: #555;
}

.fq__opt {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.5rem;
}

.fq__opt input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
}

.fq input[type='text'],
.fq input[type='number'] {
  min-height: 2.6rem;
  border-color: #999;
  background: #fff;
  color: #1a1a1a;
}

.fq-group {
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 3px solid var(--accent);
  background: #f6f7f3;
}

.fq-group > legend {
  padding: 0.75rem 1rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #444;
}

.fq-note {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e3e3e3;
  color: #444;
  font-size: 0.875rem;
}

@media (prefers-reduced-motion: no-preference) {
  .fq.appear {
    animation: fq-in 200ms ease-out;
  }

  @keyframes fq-in {
    from {
      background: color-mix(in srgb, var(--accent) 18%, #fff);
    }
  }
}

.skiplog {
  min-height: 1.5em;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--soft);
}


/* ---------- Instrumentry demo as the hero (v4, section 6) ---------- */

.demo {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 56em) {
  .demo {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
  }
}

.demo__paper summary {
  padding-block: 0.6rem;
  font-weight: 600;
  cursor: pointer;
}

.fq > legend {
  padding-inline: 0;
}

.qpage {
  margin: 0.25rem 0 0;
  padding: 1.25rem 1.1rem;
  border: 1px solid var(--rule);
  box-shadow: 4px 4px 0 var(--paper-2);
  background: #fff;
  color: #1a1a1a;
  font: 0.8125rem/1.6 ui-monospace, 'Cascadia Mono', Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (min-width: 56em) {
  /* Beside the form the questionnaire is always open: the summary reads as its heading. */
  .demo__paper summary {
    pointer-events: none;
    list-style: none;
  }

  .demo__paper summary::-webkit-details-marker {
    display: none;
  }

  .qpage {
    max-height: 38rem;
    overflow-y: auto;
  }
}

.d-tabs {
  display: flex;
  gap: 0 1.25rem;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: none;
}

.d-tabs button {
  flex: none;
  min-height: 2.75rem;
  padding: 0.5rem 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--soft);
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  cursor: pointer;
}

.d-tabs button[aria-selected='true'] {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

.tabs__n:not(:empty) {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.75rem;
}

[role='tabpanel'] {
  padding-top: 1rem;
}

[role='tabpanel']:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* The form. On wide screens it sits in a phone frame; on a phone it is simply the page: no phone inside a phone. */
fieldset.fq {
  margin: 0;
  border: 0;
  border-bottom: 1px solid #e3e3e3;
}

.fq input[type='date'] {
  width: 100%;
  min-height: 2.6rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid #999;
  border-radius: 2px;
  background: #fff;
  color: #1a1a1a;
  font: inherit;
}

.fq__x {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: #555;
}

.fq__x--group {
  margin: 0;
  padding: 0 1rem 0.5rem;
}

.fq__x a {
  color: inherit;
  font-weight: 600;
}

.fq__x code,
.sheet .mono {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.92em;
}

.fq__err {
  margin: 0.4rem 0 0;
  color: #a12a1a;
  font-weight: 600;
  font-size: 0.875rem;
}

.fq input[aria-invalid='true'] {
  border-color: #a12a1a;
  box-shadow: inset 0 0 0 1px #a12a1a;
}

.fq__gps {
  display: block;
  padding: 0.6rem 0.75rem;
  border: 1px dashed #999;
  color: #555;
  font-size: 0.875rem;
}

.fq-repeat {
  border-left-style: double;
  border-left-width: 6px;
}

.fq-add {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e3e3e3;
  background: #f6f7f3;
}

.fq-add__btn {
  min-height: 2.75rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: #fff;
  color: #1a1a1a;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
  .fq-note.appear {
    animation: fq-in 200ms ease-out;
  }
}

@media (max-width: 55.99em) {
  .demo-hero .phone {
    max-width: none;
    padding: 0;
    border: 1px solid var(--rule);
    border-radius: 0;
    background: none;
  }

  .demo-hero .phone__screen {
    height: auto;
    overflow: visible;
    border-radius: 0;
  }

  .demo-hero .phone__bar {
    position: static;
  }
}

.skiplog {
  padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--accent);
  background: var(--paper-2);
  color: var(--ink);
}

.skiplog:empty {
  display: none;
}

/* On a phone the line that says what just changed stays in view while you answer. */
@media (max-width: 55.99em) {
  .skiplog {
    position: sticky;
    bottom: 0.5rem;
    z-index: 2;
    box-shadow: 0 0 0 1px var(--rule);
  }
}

.d-sheet-h {
  margin: 1.25rem 0 0.4rem;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.9375rem;
  font-weight: 600;
}

.sheet {
  overflow-x: auto;
  border-block: 1px solid var(--ink);
}

.sheet--narrow {
  max-width: 30rem;
}

.sheet table {
  max-height: none;
  border-collapse: collapse;
  min-width: 46rem;
  width: 100%;
  font-size: 0.8125rem;
}

.sheet--narrow table {
  min-width: 0;
}

.sheet th {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--ink);
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.sheet td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.sheet tr.begin td {
  background: var(--paper-2);
  font-weight: 600;
}

.flags {
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.flags li {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 0 0.75rem 0.9rem;
  border-left: 3px solid var(--accent);
  border-bottom: 1px solid var(--rule);
}

.demo-hero .checks-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.5rem;
  margin: 1.5rem 0 0;
  padding: 0.75rem 0;
  border-block: 1px solid var(--rule);
  list-style: none;
  font-size: 0.9375rem;
}

.demo-hero .checks-strip li::before {
  content: '✓';
  margin-right: 0.4rem;
  color: var(--accent);
  font-weight: 700;
}

.works {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

.works__k {
  color: var(--soft);
}

.works span:not(.works__k) {
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
}


/* Inputs inside the demo form (the page's own input styles are for the converter). */
.demo-hero .fq input[type='text'],
.demo-hero .fq input[type='number'],
.demo-hero .fq input[type='date'] {
  width: 100%;
  min-height: 2.6rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid #999;
  border-radius: 2px;
  background: #fff;
  color: #1a1a1a;
  font: 15px/1.4 var(--sans);
}

/* Hold the demo's space while its data loads, so nothing below it jumps (layout shift). */
#d-form:empty {
  min-height: 40rem;
}

.demo-hero .checks-strip:empty {
  min-height: 3.2rem;
}

@media (min-width: 56em) {
  .demo-hero .qpage {
    height: 38rem;
  }
}

/* ------------------------------------------------------------------ */
/* Visual direction: evidence is the ornament                          */
/* ------------------------------------------------------------------ */

main:has(.demo-hero),
.mast {
  width: min(100% - 32px, 1100px);
}

.demo-top {
  display: grid;
  gap: 20px 48px;
}

.demo-top h1 {
  max-width: 13em;
  font-size: clamp(38px, 5.4vw, 68px);
  line-height: 1;
  letter-spacing: -0.015em;
}

.demo-top__side {
  display: grid;
  gap: 10px;
  align-content: end;
}

.demo-top__side p {
  margin: 0;
}

.demo-top__side .btn {
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 0 26px;
  font-size: 16px;
  font-weight: 600;
}

@media (min-width: 56em) {
  .demo-top {
    grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
    align-items: end;
  }
}

.demo-box {
  border-top: 0;
}

.demo-box__head.yb-label {
  padding: 10px 0;
  border-block: 1px solid var(--yb-ink);
  text-transform: none;
  letter-spacing: 0.02em;
}

.demo-box__head.yb-label b {
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yb-ink);
}

/* The printed page: white paper inside crop marks, set in the serif like a real questionnaire. */
.demo-hero .qpage {
  margin: 0.5rem 0 0;
  padding: 1.75rem clamp(1rem, 3vw, 2.25rem);
  border: 1px solid var(--yb-rule);
  box-shadow: none;
  background: var(--yb-card);
  color: var(--yb-ink);
  font: 1.0625rem/1.35 var(--serif);
  white-space: normal;
}

/* Crop marks sit just outside the page. */
.qwrap.yb-frame {
  margin-top: 0.75rem;
  padding: 9px;
}

.demo-hero .qwrap .qpage {
  margin: 0;
}

.qpage__title {
  margin: 0.25rem 0 1.25rem;
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.2;
}

.qpage__sec {
  margin: 1.4rem 0 0.4rem;
  color: var(--yb-ink);
}

.qpage__note {
  margin: 0.3rem 0;
  font-size: 0.9375rem;
  font-style: italic;
  color: var(--yb-soft);
}

.qpage__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pq {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) 0.75rem;
  align-items: baseline;
  gap: 0.6rem;
  width: 100%;
  padding: 0.45rem 0.4rem;
  margin-inline: -0.4rem;
  border: 0;
  border-radius: 2px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pq:disabled {
  cursor: default;
}

.pq__n {
  font-family: var(--yb-mono);
  font-size: 0.75rem;
  color: var(--yb-soft);
}

.pq__o,
.pq i {
  display: block;
  font-size: 0.9375rem;
}

.pq__o {
  color: var(--yb-soft);
}

.pq i {
  color: var(--yb-instrumentry);
}

.pq__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--yb-instrumentry);
}

.pq:disabled .pq__dot {
  background: none;
}

.pq:hover:not(:disabled),
.pq.is-tied {
  background: color-mix(in srgb, var(--yb-instrumentry) 12%, transparent);
}

.pq:focus-visible {
  outline: 2px solid var(--yb-instrumentry);
  outline-offset: 1px;
}

/* The field a printed question became. */
.fq__n {
  margin-right: 0.15rem;
  font-family: var(--yb-mono);
  font-size: 0.6875rem;
  font-weight: 400;
  color: #2e6b4f;
}

.fq.is-tied {
  box-shadow: inset 4px 0 0 #2e6b4f;
  background: #eef5f0;
}

/* The form sits on the ledger: it is a captured result. */
.demo__main.yb-ledger {
  padding: 0 0 1rem;
  background-color: transparent;
}

@media (min-width: 56em) {
  .demo__main.yb-ledger {
    padding: 0 1.5rem 1.5rem;
    background-color: var(--yb-paper);
  }

  .demo__main .d-tabs {
    background: var(--yb-paper);
    margin-inline: -1.5rem;
    padding-inline: 1.5rem;
  }

  .demo-hero .qpage {
    height: 41rem;
    max-height: none;
    overflow-y: auto;
  }
}

.demo-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: 1.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--yb-ink);
}

.demo-hero .demo-foot .checks-strip {
  margin: 0;
  padding: 0;
  border: 0;
  font-family: var(--yb-mono);
  font-size: 0.8125rem;
}

.demo-foot .demo-more {
  font-weight: 600;
}

.demo-cta {
  margin-top: 14px;
}
