/* KLKBAT receipt system — shared by links.klkbat.com, reg.klkbat.com and commission.marketing.klkbat.com.
 * Concept: every page is a till receipt that prints out of a slot on a tomato-orange field.
 * Keep this file identical in the three repos. */

:root {
    --tomato: #e93c06;
    --tomato-hot: #ff6a2b;
    --tomato-deep: #b52a00;
    --paper: #fffcf5;
    --paper-shade: #f3ecdd;
    --ink: #231913;
    --ink-soft: #6a5b4f;
    --rule: #d8cbb4;
    --mark: #ffd23f;
    --f-display: "Reem Kufi", "Cairo", system-ui, sans-serif;
    --f-body: "IBM Plex Sans Arabic", "Cairo", system-ui, sans-serif;
    --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    --tooth: 9px;
    --paper-w: 440px;
}

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

html { background: var(--tomato-deep); -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--f-body);
    font-size: 16px;
    line-height: 1.7;
    color: var(--ink);
    background:
        radial-gradient(120% 70% at 50% -8%, var(--tomato-hot) 0%, transparent 62%),
        linear-gradient(180deg, var(--tomato) 0%, var(--tomato-deep) 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
body[lang="en"], html[lang="en"] body { font-family: var(--f-body); }

/* ---------- the field behind the receipt ---------- */
.field { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.field::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.13) 1px, transparent 1.3px);
    background-size: 15px 15px;
    -webkit-mask-image: linear-gradient(180deg, #000, transparent 72%);
    mask-image: linear-gradient(180deg, #000, transparent 72%);
}
.field img {
    position: absolute;
    width: min(110vw, 980px);
    height: auto;
    inset-inline-end: -26vw;
    bottom: -18vw;
    opacity: 0.1;
    transform: rotate(-9deg);
    user-select: none;
}

/* ---------- the printer slot ---------- */
.slot {
    position: fixed;
    top: 0;
    left: 50%;
    z-index: 6;
    width: min(calc(var(--paper-w) + 36px), 100vw);
    height: 16px;
    transform: translateX(-50%);
    border-radius: 0 0 14px 14px;
    background: linear-gradient(180deg, #120b07 0%, #2d1d13 70%, #3a271a 100%);
    box-shadow: 0 8px 22px rgba(60, 10, 0, 0.5), inset 0 -2px 0 rgba(255, 255, 255, 0.08);
    pointer-events: none;
}
.slot::after {
    content: "";
    position: absolute;
    inset: auto 14px 3px;
    height: 3px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.7);
}

/* ---------- the receipt ---------- */
.sheet {
    position: relative;
    z-index: 2;
    width: min(var(--paper-w), calc(100% - 28px));
    margin: 14px auto 72px;
    filter: drop-shadow(0 26px 28px rgba(70, 12, 0, 0.42));
}
.paper {
    position: relative;
    padding: 34px 26px 40px;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.035), transparent 90px),
        var(--paper);
    color: var(--ink);
}
/* torn bottom edge: a thin strip of teeth (cheap to paint, unlike masking the whole sheet) */
.paper::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 100%;
    height: var(--tooth);
    margin-top: -1px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='9' viewBox='0 0 18 9'%3E%3Cpath d='M0 0h18L9 9z' fill='%23fffcf5'/%3E%3C/svg%3E") repeat-x 50% 0 / 18px 9px;
    pointer-events: none;
}

/* the one orchestrated moment: the receipt prints, line by line */
@keyframes feed {
    from { clip-path: inset(0 0 100% 0); }
    to { clip-path: inset(0 0 -14px 0); } /* negative: lets the torn-edge teeth show */
}
.paper { animation: feed 1.5s steps(22, end) 0.25s both; }

/* ---------- parts ---------- */
.dash { border: 0; border-top: 2px dashed var(--rule); margin: 22px 0; }
.dots { flex: 1 1 auto; min-width: 14px; align-self: end; margin: 0 8px 7px; border-bottom: 2px dotted var(--rule); }

.stub {
    height: 48px;
    margin: 26px auto 8px;
    width: min(260px, 80%);
    background: repeating-linear-gradient(90deg,
        var(--ink) 0 2px, transparent 2px 4px,
        var(--ink) 4px 5px, transparent 5px 8px,
        var(--ink) 8px 11px, transparent 11px 13px,
        var(--ink) 13px 14px, transparent 14px 18px);
    opacity: 0.88;
}

.thanks { text-align: center; font-size: 0.86rem; color: var(--ink-soft); margin: 12px 0 0; }

.brand-h {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: clamp(2rem, 7.2vw, 2.7rem);
    line-height: 1.12;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--ink);
}

.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

/* ---------- language switch ---------- */
.lang-btn {
    position: fixed;
    top: 26px;
    inset-inline-start: 14px;
    z-index: 8;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 12px;
    border-radius: 999px;
    border: 0;
    background: var(--paper);
    color: var(--ink);
    font: 600 0.88rem/1 var(--f-body);
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(70, 12, 0, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.lang-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(70, 12, 0, 0.4); }
.lang-btn:active { transform: translateY(1px); }
.lang-btn svg { width: 30px; height: auto; display: block; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
.field ~ .lang-btn:focus-visible { outline-color: var(--mark); }

@media (min-width: 900px) {
    .sheet { margin-top: 18px; }
    .paper { padding-inline: 34px; }
}

@media (prefers-reduced-motion: reduce) {
    .paper { animation: none; }
    * { transition-duration: 0.01ms !important; }
}

@media print {
    .paper::after { display: none; }
    body { background: #fff; }
    .field, .slot, .lang-btn { display: none; }
    .sheet { filter: none; margin: 0 auto; }
    .paper { animation: none; -webkit-mask: none; mask: none; }
}
