/* ============================================================
   TOMSJOKES.COM -- lovingly period-accurate 1997 stylesheet
   (except it's responsive and accessible, don't tell anyone)
   ============================================================ */

:root {
  --navy: #000033;
  --lime: #00ff00;
  --yellow: #ffff00;
  --magenta: #ff00ff;
  --cyan: #00ffff;
  --red: #ff0000;
  --panel-bg: #000066;
  --bevel-light: #9999ff;
  --bevel-dark: #000022;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--navy);
  /* tiled starfield, drawn in CSS so we ship zero image files */
  background-image:
    radial-gradient(1px 1px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 90px 70px, #ccf, transparent),
    radial-gradient(2px 2px at 160px 20px, #fff, transparent),
    radial-gradient(1px 1px at 50px 120px, #ffd, transparent),
    radial-gradient(1px 1px at 130px 140px, #fff, transparent),
    radial-gradient(2px 2px at 190px 100px, #cff, transparent);
  background-size: 220px 170px;
  color: #ffffff;
  font-family: "Times New Roman", Times, serif;
  font-size: 16px;
  line-height: 1.45;
}

#page {
  max-width: 820px;
  margin: 0 auto;
  padding: 8px;
}

a { color: var(--cyan); }
a:visited { color: var(--magenta); }
a:hover { color: var(--yellow); }
a:focus-visible { outline: 2px dashed var(--yellow); outline-offset: 2px; }

.small { font-size: 12px; }
.center { text-align: center; }
.dim { color: #8888bb; }

/* ---------- header ---------- */

#masthead { text-align: center; }

.rainbow-bar {
  height: 8px;
  margin: 6px 0;
  background: linear-gradient(90deg,
    #ff0000, #ff9900, #ffff00, #00ff00, #00ffff, #0066ff, #ff00ff, #ff0000);
  background-size: 200% 100%;
  animation: rainbowslide 6s linear infinite;
  border: 1px solid #000;
}
@keyframes rainbowslide {
  from { background-position: 0% 0; }
  to   { background-position: 200% 0; }
}

.site-title {
  font-family: "Comic Sans MS", "Comic Sans", cursive;
  font-size: clamp(28px, 6vw, 46px);
  margin: 10px 0 0;
  color: var(--yellow);
  text-shadow: 3px 3px 0 var(--red), 6px 6px 0 #660000;
  letter-spacing: 1px;
}

.spin {
  display: inline-block;
  animation: spin 4s linear infinite;
  font-size: 0.8em;
}
.spin.rev { animation-direction: reverse; }
@keyframes spin {
  from { transform: rotateY(0deg); }
  to   { transform: rotateY(360deg); }
}

.tagline {
  font-family: "Comic Sans MS", "Comic Sans", cursive;
  color: var(--lime);
  font-size: 14px;
  margin: 4px 0 8px;
}

.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.marquee {
  overflow: hidden;
  white-space: nowrap;
  background: #000;
  border-top: 2px solid var(--lime);
  border-bottom: 2px solid var(--lime);
  padding: 3px 0;
  font-family: "Courier New", monospace;
  color: var(--lime);
  font-size: 13px;
  font-weight: bold;
}
.marquee span {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 22s linear infinite;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* ---------- laff-o-matic ---------- */

#laffomatic {
  margin: 14px 0;
  border: 4px outset #888;
  background: #333;
  padding: 6px;
}

.lom-titlebar {
  background: linear-gradient(180deg, #dd0000, #880000);
  color: var(--yellow);
  font-family: "Comic Sans MS", cursive;
  font-weight: bold;
  font-size: 18px;
  text-align: center;
  padding: 4px;
  border: 2px outset #ff6666;
  letter-spacing: 2px;
}
.lom-lights { color: var(--lime); animation: blink 0.8s steps(1) infinite; }

.lom-screen {
  background: #001100;
  border: 4px inset #555;
  margin: 8px 0;
  min-height: 90px;
  padding: 12px 14px;
  font-family: "Courier New", monospace;
  color: var(--lime);
  font-size: 15px;
  font-weight: bold;
  text-shadow: 0 0 6px rgba(0, 255, 0, 0.55);
  position: relative;
}
#lom-joke { animation: crt-on 0.25s ease-out; }
@keyframes crt-on {
  from { opacity: 0; transform: scaleY(0.2); }
  to   { opacity: 1; transform: scaleY(1); }
}
.lom-cursor {
  display: inline-block;
  animation: blink 1s steps(1) infinite;
}

.lom-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

#lom-button {
  font-family: "Comic Sans MS", cursive;
  font-size: 22px;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(180deg, #ff4444, #aa0000);
  border: 5px outset #ff5555;
  padding: 8px 30px;
  cursor: pointer;
  text-shadow: 1px 1px 0 #000;
}
#lom-button:hover { background: linear-gradient(180deg, #ff6666, #cc0000); }
#lom-button:active { border-style: inset; transform: translateY(2px); }
#lom-button:focus-visible { outline: 3px dashed var(--yellow); outline-offset: 3px; }

.lom-meter {
  font-family: "Courier New", monospace;
  background: #000;
  color: var(--red);
  border: 3px inset #555;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: bold;
}
#lom-count { color: var(--yellow); letter-spacing: 2px; }

/* ---------- layout ---------- */

#layout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0;
}

#sidebar { flex: 0 0 200px; }
#content { flex: 1; min-width: 0; }

.panel {
  border: 3px ridge var(--bevel-light);
  background: var(--panel-bg);
  margin-bottom: 10px;
  padding-bottom: 6px;
}

.panel-title {
  background: linear-gradient(180deg, #4444cc, #000088);
  color: var(--yellow);
  font-family: "Comic Sans MS", cursive;
  font-weight: bold;
  font-size: 13px;
  text-align: center;
  padding: 4px 2px;
  border-bottom: 2px solid var(--bevel-light);
  margin-bottom: 6px;
}

#cat-list, .link-list {
  list-style: none;
  margin: 0;
  padding: 0 8px;
}
#cat-list li, .link-list li { margin: 3px 0; font-size: 14px; }
#cat-list a {
  text-decoration: none;
  display: block;
  padding: 2px 4px;
}
#cat-list a:hover { background: #0000aa; color: var(--yellow); }
#cat-list a.active { background: var(--yellow); color: #000088; font-weight: bold; }
#cat-list .cat-n { color: #8888ff; font-size: 11px; }

.hit-counter { text-align: center; padding: 4px; }
.hc-label { font-size: 12px; color: var(--cyan); }
.hc-digits {
  display: inline-block;
  background: #000;
  color: var(--lime);
  font-family: "Courier New", monospace;
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 4px;
  border: 3px inset #555;
  padding: 2px 8px;
  margin-top: 4px;
}

.award {
  text-align: center;
  font-size: 13px;
  margin: 8px 4px;
  color: var(--yellow);
  line-height: 1.2;
}
.award .small { color: #aaaaee; }

/* ---------- content views ---------- */

.content-box {
  border: 3px ridge var(--bevel-light);
  background: rgba(0, 0, 60, 0.85);
  padding: 12px 16px;
}

.content-box h2 {
  font-family: "Comic Sans MS", cursive;
  color: var(--magenta);
  text-shadow: 2px 2px 0 #550055;
  margin: 4px 0 2px;
  font-size: 26px;
}

.cat-blurb {
  color: var(--cyan);
  font-style: italic;
  margin: 0 0 8px;
  font-size: 14px;
}

hr.groovy {
  border: none;
  height: 3px;
  background: repeating-linear-gradient(90deg,
    var(--magenta) 0 10px, var(--cyan) 10px 20px, var(--yellow) 20px 30px);
  margin: 8px 0 14px;
}

ol.joke-list {
  margin: 0;
  padding-left: 34px;
}
ol.joke-list li {
  margin: 0 0 13px;
  padding-left: 4px;
}
ol.joke-list li::marker {
  color: var(--lime);
  font-family: "Courier New", monospace;
  font-weight: bold;
}

.new-flag {
  color: var(--red);
  font-weight: bold;
  font-size: 11px;
  font-family: "Comic Sans MS", cursive;
  vertical-align: super;
}

/* home page bits */
.home-welcome { font-size: 17px; }
.home-welcome .drop {
  float: left;
  font-family: "Comic Sans MS", cursive;
  font-size: 52px;
  line-height: 0.85;
  color: var(--yellow);
  padding-right: 6px;
  text-shadow: 2px 2px 0 var(--red);
}
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.cat-card {
  display: block;
  border: 2px outset #6666cc;
  background: #000055;
  text-decoration: none;
  padding: 8px;
  text-align: center;
  color: var(--cyan);
  font-family: "Comic Sans MS", cursive;
  font-size: 13px;
}
.cat-card:hover { background: #0000aa; color: var(--yellow); border-style: inset; }
.cat-card .icon { font-size: 26px; display: block; }
.cat-card .count { display: block; color: #8888ff; font-size: 11px; font-family: "Courier New", monospace; }

/* ---------- joke of the day ---------- */

#jotd {
  border: 4px double var(--yellow);
  background: #220033;
  text-align: center;
  padding: 10px 16px;
  margin: 14px 0;
}
#jotd h2 {
  font-family: "Comic Sans MS", cursive;
  color: var(--yellow);
  font-size: 20px;
  margin: 0 0 6px;
}
#jotd-text {
  font-size: 17px;
  color: #ffddff;
  margin: 4px 0 8px;
}

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

#basement { text-align: center; margin-top: 18px; }

.under-construction {
  font-family: "Comic Sans MS", cursive;
  font-weight: bold;
  color: #000;
  background: repeating-linear-gradient(45deg,
    var(--yellow) 0 14px, #000 14px 28px);
  padding: 2px;
  margin-bottom: 12px;
}
.under-construction { -webkit-text-stroke: 0; }
.under-construction {
  text-shadow: 0 0 4px var(--yellow), 0 0 4px var(--yellow), 0 0 4px var(--yellow);
}

.webring {
  border: 2px groove var(--bevel-light);
  background: var(--panel-bg);
  display: inline-block;
  padding: 6px 20px;
  margin-bottom: 12px;
  font-family: "Courier New", monospace;
  font-size: 13px;
}
.webring-title { color: var(--lime); font-weight: bold; margin-bottom: 3px; }

.badges { margin: 8px 0; }
.badge88 {
  display: inline-block;
  width: 88px;
  height: 31px;
  font-size: 9px;
  font-family: Verdana, sans-serif;
  font-weight: bold;
  line-height: 1.2;
  padding-top: 4px;
  margin: 2px;
  background: #000;
  color: var(--lime);
  border: 1px solid var(--lime);
  vertical-align: middle;
}
.badge88.b2 { color: var(--cyan); border-color: var(--cyan); }
.badge88.b3 { color: var(--yellow); border-color: var(--yellow); }
.badge88.b4 { color: var(--magenta); border-color: var(--magenta); }
.badge88.b5 { color: #6699ff; border-color: #6699ff; background: #001; }

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  #layout { flex-direction: column; }
  #sidebar { flex: none; width: 100%; }
  .lom-controls { justify-content: center; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .rainbow-bar, .spin, .blink, .marquee span, .lom-lights, .lom-cursor {
    animation: none !important;
  }
  #lom-joke { animation: none; }
}
