/* chika.trade — tilted trading-post ledger */

:root {
    --paper:           #f1e7d3; /* cream paper */
    --paper-aged:      #e8d9bd; /* lot card surface */
    --paper-white:     #fdfbf5; /* polaroid frame */
    --ink-walnut:      #3a2a18; /* body text */
    --ink-stamp:       #8b3a1a; /* terracotta stamp ink */
    --ink-ochre:       #c47a3a; /* accent / tape */
    --ink-leather:     #6b4423; /* secondary / spine / dates */
    --ink-pencil-blue: #2c5282; /* handwritten */
    --ink-pencil-red:  #a8341e; /* strikethrough */
    --ink-coffee:      #8b6f47; /* coffee rings */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background: var(--paper);
    color: var(--ink-walnut);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.96rem;
    line-height: 1.75;
    min-height: 100vh;
    padding: 4vw 0 8vw;
    position: relative;
    overflow-x: hidden;
}

.svg-defs { position: absolute; }

/* paper texture field over whole page */
.paper-field {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.08;
    mix-blend-mode: multiply;
    filter: url(#paperNoise);
    background: #fff;
}

/* ---- the tilted single column ---- */
.ledger {
    position: relative;
    z-index: 1;
    width: clamp(580px, 62vw, 720px);
    max-width: 92vw;
    margin: 0 auto;
    transform: rotate(-0.4deg);
    transform-origin: 50% 0;
    padding-left: 2.4rem;
}

/* manifest spine: dotted left perforation + date stamps */
.ledger::before {
    content: "";
    position: absolute;
    left: 0.6rem;
    top: 0;
    bottom: 0;
    border-left: 1.5px dotted var(--ink-leather);
    pointer-events: none;
}

.spine-date {
    position: absolute;
    left: -0.2rem;
    font-family: 'Special Elite', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    color: var(--ink-leather);
    background: var(--paper);
    padding: 2px 4px;
    transform: rotate(-2deg);
    mix-blend-mode: multiply;
    opacity: 0.78;
    white-space: nowrap;
    z-index: 2;
}

/* ---- shared text bits ---- */
.ledger-body { margin: 0.6rem 0; }

.dbl-underline {
    text-decoration: underline double;
    text-decoration-color: var(--ink-stamp);
    text-underline-offset: 3px;
}

.scrawl {
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    line-height: 1.3;
    color: var(--ink-stamp);
    transform: rotate(-1.4deg);
    margin: 0.4rem 0 1rem;
}
.scrawl-blue { color: var(--ink-pencil-blue); transform: rotate(1deg); margin-top: 1.2rem; }

/* ---- rubber-stamp circles ---- */
.stamp-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 50%;
    border: 3px solid var(--ink-stamp);
    color: var(--ink-stamp);
    font-family: 'Special Elite', monospace;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.15;
    filter: contrast(0.92) blur(0.15px);
    opacity: 0.85;
    mix-blend-mode: multiply;
    box-shadow: inset 0 0 0 1px var(--ink-stamp);
}
.stamp-circle .sc-top,
.stamp-circle .sc-bot { font-size: 0.42em; opacity: 0.8; }
.stamp-circle .sc-mid { font-size: 0.92em; letter-spacing: 0.14em; font-weight: 400; }
.stamp-circle .sc-top { transform: translateY(-0.1em); }

.stamp-traded { border-color: var(--ink-pencil-red); color: var(--ink-pencil-red); box-shadow: inset 0 0 0 1px var(--ink-pencil-red); }

/* ---- masking-tape strips ---- */
.tape-strip {
    position: absolute;
    width: 96px;
    height: 26px;
    background: rgba(196, 122, 58, 0.55);
    transform: rotate(-12deg);
    pointer-events: none;
    filter: url(#tornEdge);
    box-shadow: 0 1px 2px rgba(74,49,24,0.15);
}
.tape-strip::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(90deg, rgba(255,255,255,0.12) 0 6px, transparent 6px 12px);
}

/* ---- masthead ---- */
.masthead {
    position: relative;
    text-align: center;
    padding: 2rem 0 2.6rem;
    margin-bottom: 1.4rem;
}
.masthead-stamp {
    width: 130px; height: 130px;
    margin: 0 auto 1rem;
    transform: rotate(-7deg);
}
.masthead-stamp .sc-top { padding: 0 1.4em; }
.masthead-title {
    font-family: 'Special Elite', monospace;
    font-size: clamp(2.6rem, 6vw, 4.2rem);
    color: var(--ink-stamp);
    letter-spacing: 0.04em;
    text-shadow: 0.5px 0 0 currentColor;
    filter: contrast(0.92) blur(0.15px);
    mix-blend-mode: multiply;
    line-height: 1;
}
.masthead-sub {
    font-family: 'Caveat', cursive;
    font-size: 1.3rem;
    color: var(--ink-pencil-blue);
    max-width: 30ch;
    margin: 0.6rem auto 0;
    line-height: 1.35;
}
.tape-masthead { top: 12px; right: 4%; }

/* ---- intro ---- */
.intro { position: relative; padding-bottom: 1.6rem; margin-bottom: 1rem; }

/* ---- coffee rings ---- */
.coffee-ring { position: absolute; pointer-events: none; z-index: 3; }
.coffee-ring svg { width: 100%; height: 100%; display: block; }
.coffee-ring path {
    fill: none;
    stroke: var(--ink-coffee);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.22;
}
.ring-intro { width: 130px; height: 130px; right: -2%; top: 30%; transform: rotate(8deg); }
.ring-lot { width: 110px; height: 110px; right: 6%; bottom: -10%; transform: rotate(-14deg); }
.ring-footer { width: 150px; height: 150px; left: -4%; top: 10%; transform: rotate(6deg); }

/* ---- ledger sections ---- */
.ledger-section { position: relative; padding: 1.4rem 0 2.4rem; }

.stamp-heading {
    font-family: 'Special Elite', monospace;
    font-size: clamp(1.7rem, 4.4vw, 2.6rem);
    text-transform: uppercase;
    color: var(--ink-stamp);
    letter-spacing: 0.06em;
    transform: rotate(-1.2deg);
    text-shadow: 0.5px 0 0 currentColor;
    filter: contrast(0.92) blur(0.15px);
    mix-blend-mode: multiply;
    line-height: 1.1;
    margin-bottom: 0.2rem;
}
.ink-smudge {
    width: 60%;
    height: 10px;
    margin: 0 0 1.2rem 0.4rem;
    background: var(--ink-stamp);
    opacity: 0.16;
    border-radius: 50%;
    filter: blur(3px);
    transform: rotate(-1deg) scaleY(0.5);
}

/* halftone polka-dot bg on traded section */
.traded-section {
    background-image: radial-gradient(var(--ink-ochre) 1.3px, transparent 1.4px);
    background-size: 11px 11px;
    background-position: 0 0;
    /* blend onto paper */
    background-blend-mode: multiply;
}
.traded-section::before {
    content: "";
    position: absolute; inset: 0;
    background: var(--paper);
    opacity: 0.86;
    pointer-events: none;
    z-index: 0;
}
.traded-section > * { position: relative; z-index: 1; }
.ghost-note { color: var(--ink-leather); font-style: italic; opacity: 0.85; }

/* ---- lot cards ---- */
.lot {
    position: relative;
    background: var(--paper-aged);
    border: 1px solid #d8c8a8;
    padding: 1.6rem 1.4rem 1.5rem;
    margin: 2.4rem 0;
    box-shadow: 0 6px 12px rgba(74, 49, 24, 0.18);
    transform-origin: 50% 30%;
    transform: rotate(var(--lot-rotate, 0deg));
    transition: transform 360ms cubic-bezier(0.2, 0.9, 0.3, 1), box-shadow 360ms cubic-bezier(0.2, 0.9, 0.3, 1);
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1.2rem 1.4rem;
    align-items: start;
}
.lot::after { /* faint paper texture per card */
    content: "";
    position: absolute; inset: 0;
    pointer-events: none;
    opacity: 0.06;
    mix-blend-mode: multiply;
    filter: url(#paperNoise);
    background: #fff;
}

@media (hover: hover) {
    .lot:hover {
        transform: rotate(var(--lot-rotate, 0deg)) perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
        box-shadow: 0 14px 26px rgba(74, 49, 24, 0.28);
        z-index: 5;
    }
}

.lot-stamp {
    position: absolute;
    top: -22px;
    right: 18px;
    width: 76px; height: 76px;
    transform: rotate(11deg);
    background: var(--paper-aged);
    z-index: 4;
}
.lot-stamp .sc-mid { font-size: 0.68em; }
.lot-stamp .sc-bot { font-size: 0.36em; }

.tape-lot { top: -10px; left: 22px; }

.lot-text { grid-column: 2; }
.lot-tag {
    font-family: 'Special Elite', monospace;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-stamp);
    margin-bottom: 0.2rem;
}
.lot-title {
    font-family: 'Special Elite', monospace;
    font-size: 1.32rem;
    line-height: 1.25;
    color: var(--ink-walnut);
    margin-bottom: 0.3rem;
    letter-spacing: 0.02em;
}

/* polaroid placeholder */
.polaroid {
    grid-column: 1;
    grid-row: 1 / span 2;
    background: var(--paper-white);
    border: 1px solid #d8c8a8;
    padding: 10px 10px 36px;
    box-shadow: 0 3px 7px rgba(74,49,24,0.16);
    transform: rotate(-2.2deg);
    align-self: start;
}
.polaroid-img {
    aspect-ratio: 4 / 5;
    background: var(--tone, #c8b896);
    background-image: linear-gradient(160deg, rgba(255,255,255,0.18), rgba(58,42,24,0.12));
}
.polaroid-cap {
    font-family: 'Caveat', cursive;
    font-size: 1.05rem;
    line-height: 1.15;
    color: var(--ink-pencil-blue);
    margin-top: 8px;
    text-align: center;
}
.polaroid-faded { filter: grayscale(0.4) brightness(1.04); opacity: 0.78; }

/* stained lot 003 */
.lot-stained { background-color: #e6d4b4; }

/* traded lot: ghostly */
.lot-traded { opacity: 0.62; box-shadow: 0 4px 9px rgba(74,49,24,0.12); }
.lot-traded .lot-title { color: var(--ink-leather); }

/* cherry-red strikethrough svg */
.strike-wrap { position: relative; display: inline-block; }
.strike-svg {
    position: absolute;
    left: -4px; right: -4px;
    top: 50%;
    width: calc(100% + 8px);
    height: 0.9em;
    transform: translateY(-50%);
    overflow: visible;
    pointer-events: none;
}
.strike-svg path {
    fill: none;
    stroke: var(--ink-pencil-red);
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: var(--strike-len, 600);
    stroke-dashoffset: var(--strike-off, 600);
    transition: stroke-dashoffset 760ms cubic-bezier(0.4, 0.1, 0.2, 1);
}
.lot-traded.struck .strike-svg path { stroke-dashoffset: 0; }

/* ---- wanted list ---- */
.wanted-list, .rules-list { list-style: none; margin: 0.8rem 0 0; }
.wanted-list li, .rules-list li {
    position: relative;
    padding: 0.3rem 0 0.3rem 1.8rem;
    border-bottom: 1px dotted rgba(107,68,35,0.4);
}
.bullet-stamp {
    position: absolute;
    left: 0;
    font-family: 'Special Elite', monospace;
    color: var(--ink-pencil-red);
    font-size: 1.1rem;
    transform: rotate(-8deg);
}
.rules-list { counter-reset: rule; }
.rules-list li { counter-increment: rule; padding-left: 2.4rem; }
.rules-list li::before {
    content: counter(rule, decimal-leading-zero);
    position: absolute;
    left: 0;
    font-family: 'Special Elite', monospace;
    color: var(--ink-stamp);
    letter-spacing: 0.06em;
}

/* ---- footer receipt ---- */
.receipt-wrap {
    position: relative;
    padding: 2.4rem 0 1rem;
    display: flex;
    justify-content: center;
}
.receipt {
    position: relative;
    width: 280px;
    background: var(--paper-white);
    border: 1px solid #d8c8a8;
    border-bottom: none;
    padding: 1.6rem 1.2rem 2.4rem;
    box-shadow: 0 6px 14px rgba(74,49,24,0.2);
    transform: rotate(1.3deg);
    font-size: 0.82rem;
    text-align: center;
    z-index: 1;
    /* sawtooth torn bottom edge */
    -webkit-mask-image:
        linear-gradient(#000 0 0),
        repeating-linear-gradient(135deg, transparent 0 5.65px, #000 5.65px 11.3px);
    -webkit-mask-size: 100% calc(100% - 14px), 100% 28px;
    -webkit-mask-position: top, bottom;
    -webkit-mask-repeat: no-repeat;
    mask-image:
        linear-gradient(#000 0 0),
        repeating-linear-gradient(135deg, transparent 0 5.65px, #000 5.65px 11.3px);
    mask-size: 100% calc(100% - 14px), 100% 28px;
    mask-position: top, bottom;
    mask-repeat: no-repeat;
}
.receipt-head {
    font-family: 'Special Elite', monospace;
    font-size: 1rem;
    letter-spacing: 0.16em;
    color: var(--ink-stamp);
}
.receipt-sub { font-family: 'Caveat', cursive; font-size: 1.1rem; color: var(--ink-leather); margin-bottom: 0.8rem; }
.receipt-line {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dotted rgba(58,42,24,0.3);
    padding: 0.15rem 0;
    letter-spacing: 0.04em;
}
.receipt-rule { color: var(--ink-leather); letter-spacing: 0.05em; margin: 0.5rem 0; }
.receipt-thanks {
    font-family: 'Special Elite', monospace;
    color: var(--ink-stamp);
    letter-spacing: 0.1em;
    margin: 0.4rem 0 0.9rem;
}
.receipt-stamp {
    width: 78px; height: 78px;
    margin: 0.4rem auto 0.8rem;
    transform: rotate(-9deg);
    background: var(--paper-white);
}
.receipt-stamp .sc-mid { font-size: 0.84em; }
.receipt-stamp .sc-bot { font-size: 0.38em; }
.receipt-foot { font-family: 'Caveat', cursive; font-size: 1rem; color: var(--ink-pencil-blue); }

/* ---- responsive ---- */
@media (max-width: 640px) {
    .ledger { width: 92vw; padding-left: 1.6rem; transform: rotate(-0.3deg); }
    .lot { grid-template-columns: 1fr; }
    .polaroid { grid-row: auto; grid-column: 1; max-width: 200px; margin: 0 auto; }
    .lot-text { grid-column: 1; }
    .spine-date { font-size: 0.55rem; }
}
