/* ==========================================================================
   Bayarcash PHP Demo — design system

   Warm paper, deep pine, editorial type. No gradients, no glow, no grain:
   the craft is in spacing, hierarchy and rhythm, so it still reads well
   in five years. Colour is reserved for payment state, where it means
   something.

   Built mobile-first. Every layout rule starts single-column.
   ========================================================================== */

:root {
    --paper:     #f7f9fc;
    --card:      #ffffff;
    --sunken:    #f1f5fa;

    --ink:       #16203d;
    --ink-soft:  #47536e;
    --muted:     #7a8499;
    --faint:     #a8b0c0;

    --line:      #e2e7f0;
    --line-soft: #edf1f7;

    /* Sampled from the Bayarcash logo. */
    --pine:      #233984;   /* brand navy, the primary */
    --pine-deep: #1a2b66;
    --pine-tint: #eaeefa;
    --sky:       #2492d6;   /* brand blue, the secondary */

    --ok:        #16794f;
    --pending:   #a16207;
    --bad:       #b3261e;
    --idle:      #8b93a5;

    /* One family throughout. --mono and --display are kept as roles so the
       intent stays readable, but all three resolve to Lexend. */
    --sans:    'Lexend', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono:    var(--sans);
    --display: var(--sans);

    --r:   4px;
    --tap: 44px;             /* minimum comfortable touch target */
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-wrap: break-word;

    /* Two very light layers, fixed so the page glides over them: a soft pine
       wash for depth at the top, and a fine dot grid for a quiet technical
       texture. Both sit well below the content -- panels are opaque. */
    background-color: var(--paper);
    background-image: radial-gradient(circle, rgba(22, 32, 61, .07) 1px, transparent 1.4px);
    background-size: 22px 22px;
    background-attachment: fixed;
}

/* Ambient layer: two soft brand-coloured fields drifting slowly behind the
   page. Long durations and small travel, so it reads as depth rather than
   decoration. Sits behind everything and ignores pointer events. */
.ambient {
    position: fixed;
    inset: -20vmax;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.ambient i {
    position: absolute;
    display: block;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .5;
}

.ambient i:nth-child(1) {
    width: 44vmax; height: 44vmax;
    top: -6vmax; left: 8vmax;
    background: rgba(35, 57, 132, .16);
    animation: drift-a 44s ease-in-out infinite;
}

.ambient i:nth-child(2) {
    width: 38vmax; height: 38vmax;
    top: 6vmax; right: 6vmax;
    background: rgba(36, 146, 214, .15);
    animation: drift-b 56s ease-in-out infinite;
}

.ambient i:nth-child(3) {
    width: 30vmax; height: 30vmax;
    bottom: 2vmax; left: 34vmax;
    background: rgba(36, 146, 214, .1);
    animation: drift-a 68s ease-in-out infinite reverse;
}

@keyframes drift-a {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50%      { transform: translate3d(4vmax, 3vmax, 0) scale(1.08); }
}

@keyframes drift-b {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1.05); }
    50%      { transform: translate3d(-5vmax, 4vmax, 0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .ambient i { animation: none; }
}

.shell {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 1.15rem 4rem;
    padding-left: max(1.15rem, env(safe-area-inset-left));
    padding-right: max(1.15rem, env(safe-area-inset-right));
}

@media (min-width: 700px) {
    .shell { padding: 0 2rem 5.5rem; }
}

/* ---------- masthead ---------- */

.masthead { padding: 1.5rem 0 1rem; }

@media (min-width: 700px) { .masthead { padding: 2rem 0 1.1rem; } }

.wordmark {
    margin: 0;
    line-height: 0;              /* the logo is the heading */
}

/* The wordmark only. The supplied asset bundles a tagline in its right third
   that is illegible at any size keeping the mark proportionate, so it is
   cropped off -- our own tagline sits below instead. ~5:1, 34-42px tall. */
.wordmark img {
    display: block;
    width: clamp(170px, 43vw, 212px);
    max-width: 100%;
    height: auto;
}

.tagline b {
    font-weight: 600;
    color: var(--ink);
}

.tagline {
    margin: .3rem 0 0;
    font-size: .82rem;
    line-height: 1.5;
    color: var(--muted);
}

.tagline .sep { margin: 0 .5rem; color: var(--faint); }

.env {
    font-family: var(--mono);
    font-size: .66rem;
    letter-spacing: .09em;
    text-transform: uppercase;
    padding: .26rem .6rem;
    border: 1px solid var(--line);
    border-radius: 2px;
    color: var(--ink-soft);
    background: var(--card);
    white-space: nowrap;
}

.env[data-env="production"] {
    color: var(--bad);
    border-color: #eccbc7;
    background: #fdf5f4;
}

/* ---------- nav: scrolls sideways on narrow screens rather than wrapping ---------- */

.nav {
    display: flex;
    gap: 1.5rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.nav::-webkit-scrollbar { display: none; }

.nav a {
    position: relative;
    font-size: .92rem;
    text-decoration: none;
    color: var(--muted);
    padding: .55rem 0 .8rem;
    white-space: nowrap;
    transition: color .18s;
}

.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--pine); font-weight: 600; }

.nav a[aria-current="page"]::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: var(--pine);
}

/* An outbound tab is marked, so leaving the demo is never a surprise. */
.nav a.nav-out::after {
    content: '\2197';
    font-size: .8em;
    margin-left: .25rem;
    vertical-align: text-top;
    opacity: .55;
}

.nav a.nav-out:hover::after { opacity: 1; }

@media (min-width: 700px) { .nav { margin-bottom: 2.5rem; } }

/* ---------- panels ---------- */

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: 1.5rem;
}

.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem 1rem;
    flex-wrap: wrap;
    padding: .9rem 1.15rem;
    border-bottom: 1px solid var(--line-soft);
    font-size: .85rem;
    font-weight: 600;
}

/* Everything after the title is pushed to the right edge. */
.panel-head > :nth-child(2) { margin-left: auto; }

/* Secondary information in a header, tagged explicitly rather than by
   position -- the trailing element changes when a panel gains an action. */
.panel-head .meta {
    font-family: var(--mono);
    font-size: .72rem;
    font-weight: 400;
    color: var(--muted);
}

.panel-body { padding: 1.35rem 1.15rem; }
.panel-body.tight { padding: .75rem; }

/* Totals sit under the data they summarise. */
.panel-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .3rem .7rem;
    padding: .6rem 1.15rem;
    border-top: 1px solid #dbe3f4;
    background: #f0f3fb;
    border-radius: 0 0 var(--r) var(--r);
}

.panel-foot > span { font-size: .8rem; color: var(--muted); }
.panel-foot b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.panel-foot b.money { color: var(--pine); }
.panel-foot .sep { color: var(--faint); }

.stat-breakdown {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .3rem .8rem;
    margin-left: auto;
}

.stat-breakdown .status { font-size: .76rem; font-weight: 500; }

@media (min-width: 700px) {
    .panel-head { padding: .95rem 1.5rem; }
    .panel-body { padding: 1.75rem 1.5rem; }
    .panel-body.tight { padding: .85rem; }
    .panel-foot { padding: .6rem 1.5rem; }
}

/* ---------- forms ---------- */

.field { margin-bottom: 1.25rem; }

.field label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .4rem;
}

.input, select.input, textarea.input {
    width: 100%;
    min-height: var(--tap);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;                 /* 16px stops iOS zooming on focus */
    padding: .7rem .85rem;
    transition: border-color .16s, box-shadow .16s;
    appearance: none;
}

textarea.input { min-height: 8rem; line-height: 1.6; }
textarea.input, .input.mono { font-family: var(--mono); font-size: .88rem; }

.input:hover { border-color: #cbd5e3; }

.input:focus {
    outline: none;
    border-color: var(--pine);
    box-shadow: 0 0 0 3px var(--pine-tint);
}

.input::placeholder { color: var(--faint); }

/* Read-only fields are output, not input: flatten them so they do not invite
   a click, and drop the focus affordances. */
.input[readonly] {
    background: var(--sunken);
    color: var(--ink-soft);
    cursor: default;
}

.input[readonly]:hover  { border-color: var(--line); }
.input[readonly]:focus  { border-color: var(--line); box-shadow: none; }

select.input {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
        linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
    background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2.25rem;
}

.row-2 { display: grid; grid-template-columns: 1fr; gap: 0; }

@media (min-width: 560px) {
    .row-2 { grid-template-columns: 1fr 1fr; gap: 1rem; }
}

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: var(--tap);
    font-family: var(--sans);
    font-size: .95rem;
    font-weight: 600;
    padding: .7rem 1.4rem;
    border-radius: var(--r);
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
    transition: background .16s, border-color .16s;
}

.btn:hover { background: var(--sunken); border-color: #cbd5e3; }

.btn-primary {
    background: var(--pine);
    border-color: var(--pine);
    color: #fff;
}

.btn-primary:hover { background: var(--pine-deep); border-color: var(--pine-deep); }

.btn-block { width: 100%; }

.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.btn-row .btn { flex: 1 1 auto; }

@media (min-width: 560px) { .btn-row .btn { flex: 0 0 auto; } }

/* ---------- status ---------- */

.status {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--tone, var(--idle));
    white-space: nowrap;
}

.status::before {
    content: '';
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.status[data-tone="success"] { --tone: var(--ok); }
.status[data-tone="warning"] { --tone: var(--pending); }
.status[data-tone="danger"]  { --tone: var(--bad); }
.status[data-tone="secondary"],
.status[data-tone="light"]   { --tone: var(--idle); }

/* ---------- verdict ---------- */

.verdict {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 1.15rem 1.15rem 1.2rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 700px) { .verdict { padding: 1.35rem 1.5rem 1.4rem; } }

.verdict[data-tone="success"] { background: #f1f8f4; border-color: #c8e2d4; }
.verdict[data-tone="danger"]  { background: #fdf5f4; border-color: #eccbc7; }
.verdict[data-tone="warning"] { background: #fdfaf3; border-color: #e8dcc2; }

.verdict-sum { font-size: .95rem; color: var(--ink-soft); }
.verdict-sum strong { font-weight: 600; color: var(--ink); }
.verdict-sum .sep { color: var(--faint); margin: 0 .4rem; }

.verdict-note {
    margin: .5rem 0 0 !important;
    font-size: .82rem !important;
    color: var(--muted) !important;
}

.verdict-note .status { font-size: .78rem; }
.verdict-note .sep { color: var(--faint); margin: 0 .3rem; }

/* Status and amount share a baseline, so the block stays two lines tall. */
.verdict-top {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .25rem .75rem;
}

.verdict h2 {
    font-family: var(--display);
    font-size: clamp(1.3rem, 4.5vw, 1.6rem);
    font-weight: 600;
    line-height: 1.15;
    margin: 0;
    letter-spacing: -.015em;
}

.verdict p {
    color: var(--ink-soft);
    margin: 0;
    font-size: .95rem;
    text-wrap: pretty;
}

.verdict a, .notice a { color: var(--pine); }

/* ---------- table ---------- */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table { width: 100%; border-collapse: collapse; font-size: .88rem; }

thead th {
    font-family: var(--mono);
    font-size: .62rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    text-align: left;
    padding: .7rem .75rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

thead th:first-child, tbody td:first-child { padding-left: 1.15rem; }
thead th:last-child,  tbody td:last-child  { padding-right: 1.15rem; }

tbody td {
    padding: .8rem .75rem;
    border-bottom: 1px solid var(--line-soft);
    color: var(--ink-soft);
    vertical-align: middle;
    white-space: nowrap;
}

@media (min-width: 700px) {
    thead th:first-child, tbody td:first-child { padding-left: 1.5rem; }
    thead th:last-child,  tbody td:last-child  { padding-right: 1.5rem; }
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfd; }

td.num {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: var(--ink);
}

td.id { font-family: var(--mono); font-size: .76rem; color: var(--muted); }

td.id a { color: var(--pine); text-decoration: none; }
td.id a:hover { text-decoration: underline; }

/* The clear action lives over the log itself, revealed on hover. Pointer-less
   devices get it permanently, since hover never fires there. */
.log-block { position: relative; }

.log-clear {
    position: absolute;
    top: .5rem;
    right: .5rem;
    margin: 0;
    opacity: 0;
    transition: opacity .16s;
}

.log-block:hover .log-clear,
.log-block:focus-within .log-clear { opacity: 1; }

@media (hover: none) {
    .log-clear { opacity: 1; }
}

.log-clear .btn {
    background: var(--card);
    box-shadow: 0 1px 3px rgba(22, 32, 61, .12);
}

/* Currency sits quieter than the figure it qualifies. */
.ccy { color: var(--muted); font-size: .78em; margin-right: .15rem; }

/* Which source delivered the payload. */
.tag {
    display: inline-block;
    font-size: .68rem;
    letter-spacing: .02em;
    padding: .12rem .45rem;
    border: 1px solid var(--line);
    border-radius: 100px;
    color: var(--muted);
    background: var(--card);
}

.tag + .tag { margin-left: .25rem; }
.tag[data-kind="callback"] { color: var(--pine); border-color: #c3cdea; background: var(--pine-tint); }
.tag[data-kind="return"]   { color: var(--ink-soft); }

.btn-small {
    min-height: 0;
    padding: .3rem .7rem;
    font-size: .78rem;
    font-weight: 500;
}


/* Detail tables (return page) stack their label above the value on phones. */
.detail td { white-space: normal; }
.detail td:first-child { color: var(--muted); width: 40%; }

/* ---------- code ---------- */

pre.code {
    margin: 0;
    padding: 1rem 1.1rem;
    background: var(--sunken);
    border: 1px solid var(--line-soft);
    border-radius: var(--r);
    font-family: var(--mono);
    font-size: .78rem;
    line-height: 1.7;
    color: var(--ink-soft);
    white-space: pre-wrap;
    word-break: break-word;

    /* Long responses scroll inside the block rather than pushing the rest of
       the page down -- the controls above stay reachable without scrolling
       back up. Short responses still collapse to their own height. */
    max-height: min(58vh, 520px);
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Slim scrollbar, so a scrolling block does not shout. */
pre.code::-webkit-scrollbar { width: 10px; height: 10px; }
pre.code::-webkit-scrollbar-track { background: transparent; }

pre.code::-webkit-scrollbar-thumb {
    background: #cfd7e4;
    border: 3px solid var(--sunken);
    border-radius: 6px;
}

pre.code::-webkit-scrollbar-thumb:hover { background: #b6c1d3; }

pre.code { scrollbar-width: thin; scrollbar-color: #cfd7e4 transparent; }

code { font-family: var(--mono); font-size: .88em; color: var(--pine); }

/* ---------- notices ---------- */

.notice {
    background: var(--sunken);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: .95rem 1.15rem;
    margin-bottom: 1.5rem;
    font-size: .9rem;
    line-height: 1.6;
    color: var(--ink-soft);

    /* Fills the box, but the breaks are evened out so the last line is never
       a lone word. Degrades to normal wrapping where unsupported. */
    text-wrap: pretty;
}



.notice strong { color: var(--ink); }
.notice[data-tone="danger"]  { background: #fdf5f4; border-color: #eccbc7; color: #7a1f19; }
.notice[data-tone="success"] { background: #f1f8f4; border-color: #c8e2d4; }
.notice[data-tone="warning"] { background: #fdfaf3; border-color: #e8dcc2; }
.notice ul { margin: .5rem 0 0; padding-left: 1.15rem; }

.empty {
    padding: 2.75rem 1.15rem;
    text-align: center;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.8;
}

/* ---------- chips ---------- */

.chips {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    padding-bottom: .25rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    font-family: var(--sans);
    font-size: .85rem;
    min-height: 38px;
    padding: .4rem .9rem;
    border: 1px solid var(--line);
    border-radius: 100px;
    background: var(--card);
    color: var(--ink-soft);
    cursor: pointer;
    transition: color .16s, border-color .16s, background .16s;
}

.chip:hover { color: var(--pine); border-color: #c3cdea; background: var(--pine-tint); }

.verb {
    font-family: var(--mono);
    font-size: .62rem;
    letter-spacing: .08em;
    color: var(--muted);
    margin-right: .45rem;
}

/* ---------- footer ---------- */

.site-foot {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.foot-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: .25rem;
}

@media (min-width: 620px) {
    .foot-links { grid-template-columns: 1fr 1fr; gap: .5rem 1.5rem; }
}

.foot-links a {
    display: block;
    padding: .7rem 0;
    text-decoration: none;
    border-bottom: 1px solid var(--line-soft);
}

@media (min-width: 620px) { .foot-links a { border-bottom: 0; padding: .45rem 0; } }

.foot-links b {
    display: block;
    font-size: .9rem;
    font-weight: 600;
    color: var(--ink);
    transition: color .16s;
}

.foot-links b::after { content: ' ↗'; color: var(--faint); font-weight: 400; }

.foot-links span {
    display: block;
    font-size: .8rem;
    color: var(--muted);
}

.foot-links a:hover b { color: var(--pine); }

.foot-meta {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line-soft);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .3rem .7rem;
    font-size: .78rem;
    color: var(--muted);

    /* Left on phones, where a centred wrapped line reads as ragged. */
    justify-content: flex-start;
    text-align: left;
}

@media (min-width: 620px) {
    .foot-meta { justify-content: center; text-align: center; }
}

.foot-meta span { white-space: nowrap; }
.foot-meta .sep { color: var(--faint); }

::selection { background: var(--pine-tint); color: var(--pine-deep); }
