/* ═══════════════════════════════════════════════════════
   TorchButt — Unrolled
   Comic site stylesheet
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

/* ─── Custom font (Zine) — replace with local .otf in production ─── */
@font-face {
  font-family: 'Zine';
  src: url('assets/headline.otf') format('opentype');
  font-display: swap;
}

/* ─── Variables ─── */
:root {
  --paper:  #eeeade;
  --ink:    #191a16;
  --green:  #77ef43;
  --line:   2px solid var(--ink);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 85px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  /* subtle paper grain */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23000' opacity='.055' filter='url(%23n)' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
}

button, a { touch-action: manipulation; }
a { color: inherit; }
button { font: inherit; }

a:focus-visible,
button:focus-visible {
  outline: 3px solid #399719;
  outline-offset: 5px;
}

/* ─── Header ─── */
header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 19px 5%;
  gap: 20px;
}

.logo {
  font-family: 'Zine', Impact, 'Arial Black', sans-serif;
  font-size: 29px;
  text-decoration: none;
  letter-spacing: -1.3px;
}

.logo span { color: #459d23; }

nav {
  display: flex;
  gap: 28px;
  align-items: center;
}

nav a {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-decoration: none;
}

nav a:last-child {
  background: var(--green);
  border: var(--line);
  padding: 11px 15px;
  box-shadow: 3px 3px 0 var(--ink);
}

/* ─── Layout helpers ─── */
.wrap {
  max-width: 1240px;
  margin: auto;
  padding: 0 5%;
}

.eyebrow {
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1.5px;
  display: block;
}

/* ─── CA Strip ─── */
.ca-strip {
  background: var(--ink);
  color: var(--paper);
  text-align: center;
  padding: 10px 5%;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--green);
}

.ca-label {
  background: var(--green);
  color: var(--ink);
  padding: 2px 8px;
  font-weight: 900;
  font-size: 10px;
  letter-spacing: 2px;
}

.ca-value {
  word-break: break-all;
  color: var(--green);
  background: none;
  font: inherit;
  padding: 0;
}

@media (max-width: 700px) {
  .ca-strip { font-size: 10px; gap: 8px; padding: 8px 4%; }
  .ca-value { font-size: 9px; }
}

/* ─── Hero ─── */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  min-height: 620px;
  padding-top: 55px;
  padding-bottom: 60px;
  gap: 25px;
}

.hero-copy .edition {
  display: inline-block;
  border: var(--line);
  padding: 8px 12px;
  transform: rotate(-2deg);
  font-size: 11px;
  letter-spacing: 1.2px;
  background: var(--green);
  font-family: 'Share Tech Mono', monospace;
  font-weight: bold;
}

h1 {
  font-family: 'Zine', Impact, 'Arial Black', sans-serif;
  text-transform: uppercase;
  font-size: clamp(70px, 9vw, 124px);
  line-height: 0.88;
  letter-spacing: -3px;
  margin: 29px 0 22px;
  font-weight: 900;
}

h1 span {
  display: block;
  -webkit-text-stroke: 2px var(--ink);
  color: transparent;
}

.intro {
  max-width: 360px;
  font-size: 16px;
  line-height: 1.6;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  background: var(--ink);
  color: var(--paper);
  border: var(--line);
  padding: 16px 21px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 4px 4px 0 #77786d;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.btn:hover {
  transform: translate(-1px, -2px);
  box-shadow: 5px 6px 0 #77786d;
}

.btn:active {
  transform: translate(1px, 1px);
  box-shadow: 3px 3px 0 #77786d;
}

.btn.green {
  background: var(--green);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}

.btn.green:hover {
  box-shadow: 5px 6px 0 var(--ink);
}

/* ─── Hero Art ─── */
.hero-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 430px;
  background: repeating-conic-gradient(
    from 0deg at 50% 55%,
    transparent 0deg 12deg,
    rgba(25,26,22,0.06) 12deg 13deg,
    transparent 13deg 25deg
  );
  border-radius: 50%;
}

.hero-art img {
  width: 90%;
  max-height: 455px;
  object-fit: contain;
  filter: drop-shadow(7px 8px 0 rgba(25,26,22,0.15));
  transform: rotate(8deg);
}

.bubble {
  position: absolute;
  right: 0;
  top: 0;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 50%;
  padding: 18px 23px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  font-weight: 900;
  transform: rotate(8deg);
  z-index: 1;
  line-height: 1.4;
}

.scribble {
  position: absolute;
  bottom: 0;
  right: 12px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  transform: rotate(-8deg);
  border-bottom: 2px solid var(--ink);
  padding-bottom: 4px;
  white-space: nowrap;
}

/* ─── Ticker ─── */
.ticker {
  background: var(--ink);
  color: var(--paper);
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  padding: 17px 0;
  overflow: hidden;
  font-family: 'Zine', Impact, sans-serif;
  font-size: 22px;
  letter-spacing: 1.5px;
  white-space: nowrap;
  text-align: center;
}

.ticker span { color: var(--green); margin: 0 27px; }

/* ─── Sections ─── */
.section {
  padding-top: 85px;
  padding-bottom: 85px;
}

.section-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 20px;
  gap: 25px;
  margin-bottom: 32px;
}

.section-top h2 {
  font-family: 'Zine', Impact, 'Arial Black', sans-serif;
  font-size: clamp(38px, 5vw, 64px);
  letter-spacing: -1px;
  margin: 8px 0 0;
  text-transform: uppercase;
  line-height: 1;
}

h3 { font-size: 22px; margin: 8px 0 15px; }

.note {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: #5d5e54;
  line-height: 1.5;
  text-align: right;
}

/* ─── Comic strips ─── */
.issue-meta {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  text-transform: uppercase;
  margin: 20px 0;
}

.comic {
  display: block;
  width: 100%;
  border: 3px solid var(--ink);
  background: #fff;
  cursor: zoom-in;
  padding: 0;
  box-shadow: 7px 7px 0 var(--ink);
  border-radius: 0;
}

.comic img {
  width: 100%;
  display: block;
}

.issue-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 27px;
  gap: 20px;
}

.text-link {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  text-underline-offset: 5px;
  font-weight: bold;
  text-decoration: underline;
}

/* ─── Archive ─── */
.archive {
  border-top: var(--line);
  background: #e1ddcf;
}

.archive-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 45px;
  align-items: center;
}

.archive-row .comic {
  transform: rotate(-1deg);
}

.tag {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  padding: 7px 10px;
}

.archive-copy p { max-width: 350px; line-height: 1.6; }

/* ─── Downloads ─── */
.downloads {
  background: var(--ink);
  color: var(--paper);
}

.downloads .section-top { border-color: rgba(238,234,222,0.38); }

.downloads .eyebrow { color: var(--green); }

.download-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.download-card {
  border: 2px solid rgba(238,234,222,0.4);
  padding: 25px;
  display: flex;
  flex-direction: column;
}

.asset-preview {
  height: 300px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  background-color: #dcd9ce;
  background-image: conic-gradient(#c8c5bb 25%, transparent 0 50%, #c8c5bb 0 75%, transparent 0);
  background-size: 28px 28px;
  overflow: hidden;
  border: 2px solid #000;
}

.asset-preview img {
  height: 90%;
  max-width: 90%;
  object-fit: contain;
}

.template-preview {
  background: var(--paper);
  background-image: none;
  position: relative;
}

.template-preview img {
  position: absolute;
  right: 10%;
  bottom: 10px;
  height: 76%;
}

.template-preview b {
  position: absolute;
  left: 7%;
  top: 25px;
  color: var(--ink);
  font-family: 'Zine', Impact, sans-serif;
  font-size: 35px;
  line-height: 1;
  transform: rotate(-3deg);
  border: 3px solid var(--ink);
  padding: 12px;
  background: white;
  max-width: 68%;
  z-index: 1;
  white-space: pre-line;
  overflow-wrap: break-word;
  transition: font-size 0.1s ease;
}

/* Slightly smaller type once the user starts typing real content */
.template-preview b.is-filled {
  font-size: 28px;
  line-height: 1.05;
}

/* ─── Punchline editor ─── */
.punchline-card .asset-preview {
  margin-bottom: 20px;
}

.punchline-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.punchline-form label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--green);
  font-weight: bold;
}

.punchline-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 56px;
  max-height: 130px;
  padding: 12px 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
  color: var(--paper);
  background: #0d0e0b;
  border: 2px solid rgba(238,234,222,0.35);
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.punchline-form textarea::placeholder {
  color: #6b6c62;
  text-transform: uppercase;
}

.punchline-form textarea:focus {
  outline: 3px solid var(--green);
  outline-offset: 2px;
  border-color: var(--green);
}

.punchline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.punchline-count {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: #aaa99e;
}

.punchline-form .btn {
  min-width: 210px;
}

.punchline-form .btn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.download-card h3 {
  font-family: 'Zine', Impact, 'Arial Black', sans-serif;
  font-size: 31px;
  text-transform: uppercase;
  font-weight: 400;
  margin-top: 0;
}

.download-card p {
  color: #c3c2b7;
  margin: 0 0 25px;
  font-size: 14px;
  line-height: 1.6;
}

.download-card .btn {
  margin-top: auto;
  align-self: start;
}

.asset-info {
  display: flex;
  justify-content: space-between;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: #aaa99e;
  margin-top: 19px;
}

/* ─── Endcap ─── */
.endcap {
  padding: 65px 5%;
  text-align: center;
  border-bottom: 3px solid var(--ink);
  background: var(--green);
}

.endcap .eyebrow {
  display: block;
  margin-bottom: 10px;
}

.endcap h2 {
  font-family: 'Zine', Impact, 'Arial Black', sans-serif;
  font-size: clamp(35px, 6vw, 75px);
  text-transform: uppercase;
  margin: 0 0 20px;
  line-height: 1;
}

/* ─── Footer ─── */
footer {
  padding: 30px 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 25px;
}

footer .logo { font-size: 22px; }

footer .note {
  color: #5d5e54;
  text-align: center;
}

/* ─── Modal ─── */
.modal {
  border: 0;
  padding: 0;
  max-width: 96vw;
  max-height: 95vh;
  background: var(--paper);
  border-radius: 0;
}

.modal::backdrop {
  background: rgba(0,0,0,0.85);
}

.modal img {
  display: block;
  max-width: 94vw;
  max-height: 83vh;
  object-fit: contain;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  font: 12px 'Share Tech Mono', monospace;
  border-bottom: 2px solid var(--ink);
}

.modal-head button {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 8px;
  cursor: pointer;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
}

/* ─── Toast ─── */
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--green);
  border: 3px solid var(--ink);
  padding: 15px 25px;
  font: bold 13px 'Share Tech Mono', monospace;
  box-shadow: 4px 4px 0 #000;
  z-index: 20;
  display: none;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ─── Mobile ─── */
@media (max-width: 700px) {
  header { padding: 15px 5%; }
  .logo { font-size: 24px; }
  nav { gap: 15px; }
  nav a { font-size: 10px; letter-spacing: .3px; }
  nav a:last-child { padding: 8px; }
  nav a:nth-child(2) { display: none; }

  .hero {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 40px;
    min-height: 0;
  }

  .hero h1 { font-size: 88px; }

  .hero-art {
    min-height: 330px;
    margin-top: 25px;
  }

  .hero-art img {
    max-height: 330px;
    width: 80%;
  }

  .hero .intro { max-width: 100%; }

  .bubble { right: 10px; }

  .section { padding-top: 55px; padding-bottom: 55px; }

  .section-top { align-items: flex-start; }
  .section-top .note { max-width: 115px; }

  .archive-row,
  .download-grid { grid-template-columns: 1fr; gap: 30px; }

  .archive-row .comic { transform: none; }

  .issue-actions { flex-wrap: wrap; }

  .asset-preview { height: 270px; }

  .comic { box-shadow: 4px 4px 0 var(--ink); }

  footer { flex-wrap: wrap; }

  .ticker { font-size: 18px; }
  .ticker span { margin: 0 12px; }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
