/* ============================================================
   PRUNKT — VISUAL IDENTITY
   Concept: xeroxed fanzine held together with tape, not a "pretty app".
   Palette: raw paper + black ink + flyer-stencil orange + acid-green accent.
   ============================================================ */

:root {
  --paper: #EDE5D3;      /* raw paper, slightly yellowed */
  --paper-dark: #DCD2B8; /* paper shadow / cards */
  --ink: #171512;        /* ink black, not pure #000 */
  --riot: #FF4B1F;       /* stencil orange — the primary accent */
  --riot-dark: #C93A15;
  --acid: #C6FF3D;       /* acid-green — secondary sticker/tape accent */
  --tape: #F5F1E6;
}

* { box-sizing: border-box; }

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: 'Space Mono', monospace;
  /* overflow-x: hidden is off-limits — we use min-width/flex-wrap instead */
  background-image:
    radial-gradient(rgba(23,21,18,0.05) 1px, transparent 1px),
    repeating-linear-gradient(135deg, rgba(255,75,31,0.025) 0px, rgba(255,75,31,0.025) 2px, transparent 2px, transparent 7px);
  background-size: 3px 3px, auto;
  position: relative;
}

/* Photocopier grain — fixed noise overlay above everything, but
   pointer-events:none keeps every control fully clickable underneath. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.font-display {
  font-family: 'Anton', sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---------- Header ---------- */
.header-bar {
  border-bottom: 4px solid var(--ink);
}

.tag-stamp {
  font-family: 'Permanent Marker', cursive;
  border: 2px solid var(--ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  background: rgba(255, 255, 255, 0.35);
  transform: rotate(-3deg);
  display: inline-block;
}

/* ---------- Ransom-note hero title ---------- */
.ransom-title {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.08em;
}

.ransom-title span {
  display: inline-block;
  border: 2px solid var(--ink);
  padding: 0.02em 0.14em;
  background: var(--tape);
  box-shadow: 3px 3px 0 var(--ink);
}

.ransom-title span:nth-child(1) { transform: rotate(-6deg) translateY(2px); }
.ransom-title span:nth-child(2) {
  transform: rotate(4deg) translateY(-5px);
  background: var(--ink);
  color: var(--riot);
}
.ransom-title span:nth-child(3) {
  font-family: 'Permanent Marker', cursive;
  transform: rotate(-3deg) translateY(3px);
}
.ransom-title span:nth-child(4) {
  transform: rotate(5deg) translateY(-3px);
  background: var(--riot);
  color: var(--tape);
}
.ransom-title span:nth-child(5) {
  font-family: 'Permanent Marker', cursive;
  transform: rotate(-4deg) translateY(1px);
}
.ransom-title span:nth-child(6) {
  transform: rotate(3deg) translateY(-4px);
  background: var(--ink);
  color: var(--acid);
}

/* ---------- Cassette "Side A / Side B" divider ---------- */
.tape-side-label {
  font-family: 'Anton', sans-serif;
  letter-spacing: 0.05em;
}

.torn-edge {
  position: relative;
}

.torn-edge::after {
  content: "";
  position: absolute;
  top: 0;
  right: -18px;
  width: 0;
  height: 100%;
  border-left: 3px dashed var(--ink);
  opacity: 0.45;
  display: none;
}

@media (min-width: 1024px) {
  .torn-edge::after { display: block; }
}

/* ---------- Zine cards (Side A / Side B panels) ---------- */
.zine-card {
  position: relative;
  background: var(--paper-dark);
  border: 3px solid var(--ink);
  padding: 1.5rem;
  box-shadow: 6px 6px 0 var(--riot-dark), 12px 12px 0 var(--ink);
}

.zine-card--a { transform: rotate(-0.6deg); }
.zine-card--b { transform: rotate(0.6deg); }

.zine-card::before,
.zine-card::after {
  content: "";
  position: absolute;
  top: -14px;
  width: 70px;
  height: 26px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.55), rgba(255,255,255,0.55) 4px, rgba(255,255,255,0.3) 4px, rgba(255,255,255,0.3) 8px),
    var(--tape);
  opacity: 0.85;
  border: 1px solid rgba(23, 21, 18, 0.15);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.zine-card::before { left: 20px; transform: rotate(-8deg); }
.zine-card::after { right: 20px; transform: rotate(6deg); }

/* ---------- Inputs ---------- */
.zine-input {
  background: var(--tape);
  border: 2px solid var(--ink);
  color: var(--ink);
  font-family: 'Space Mono', monospace;
  box-shadow: 3px 3px 0 rgba(255, 75, 31, 0.35);
}

.zine-input:focus {
  outline: 3px solid var(--riot);
  outline-offset: 1px;
  box-shadow: 3px 3px 0 var(--riot);
}

/* ---------- Buttons ---------- */
.btn-stencil {
  font-family: 'Anton', sans-serif;
  letter-spacing: 0.03em;
  border: 3px solid var(--ink);
  background: var(--riot);
  color: var(--tape);
  transition: transform 0.1s ease;
}

.btn-stencil:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}

.btn-stencil:active {
  transform: translate(0, 0);
  box-shadow: none;
}

.btn-ghost {
  font-family: 'Anton', sans-serif;
  letter-spacing: 0.03em;
  border: 3px solid var(--ink);
  background: transparent;
  color: var(--ink);
  transition: transform 0.1s ease;
}

.btn-ghost:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}

/* Reset gets a dashed border — visually flags it as the "undo everything" action */
#btn-reset {
  border-style: dashed;
}

#btn-reset:hover {
  box-shadow: 4px 4px 0 var(--riot-dark);
}

.btn-copied {
  background: var(--ink) !important;
  color: var(--riot) !important;
}

/* ---------- Output-mode toggle (Editor vs Free) ---------- */
.mode-btn {
  font-family: 'Space Mono', monospace;
  background: var(--tape);
  color: var(--ink);
  transition: background-color 0.1s ease, color 0.1s ease;
}

.mode-btn + .mode-btn {
  border-left: 2px solid var(--ink);
}

.mode-btn.active {
  background: var(--riot);
  color: var(--tape);
}

/* ---------- Output box ---------- */
.result-box {
  background: var(--tape);
  border: 2px dashed var(--ink);
  font-family: 'Space Mono', monospace;
  white-space: pre-wrap;
  box-shadow: 4px 4px 0 rgba(23, 21, 18, 0.12);
  background-image: radial-gradient(rgba(23, 21, 18, 0.05) 1px, transparent 1px);
  background-size: 6px 6px;
}

.char-count {
  font-family: 'Space Mono', monospace;
}

.char-count-over {
  color: var(--riot);
  font-weight: 700;
}

/* ---------- Footer ---------- */
.footer-strip {
  border-top: 4px solid var(--ink);
  position: relative;
}

.footer-strip::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 60px;
  height: 20px;
  transform: translateX(-50%) rotate(-4deg);
  background: var(--tape);
  opacity: 0.85;
  border: 1px solid rgba(23, 21, 18, 0.15);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Respects prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .btn-stencil, .btn-ghost { transition: none; }
}
