/* ================================================================
   Guochen's Home Page — GeoCities-era look, plain CSS, no JS.
   Bright tiled background + a pale "paper" panel for the actual
   reading content, so the nostalgia is skin-deep and the text
   underneath stays easy to read.
   ================================================================ */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 1.5rem 0.75rem 3rem;
  background-color: #0a0033;
  background-image: url("./assets/bg-tile.gif");
  background-repeat: repeat;
  font-family: "Times New Roman", Times, Georgia, serif;
  color: #111;
}

.page {
  max-width: 45rem;
  margin: 0 auto;
  background: #fdf6e3;
  border: 4px ridge #fc0;
  padding: 0;
  box-shadow: 0 0 0 2px #006, 0 0 24px #000;
}

/* ---------------------------------------------------------- banner */
.banner {
  background: linear-gradient(180deg, #f0f 0%, #90c 100%);
  color: #ff0;
  text-align: center;
  padding: 0.75rem 0.5rem 1rem;
  border-bottom: 4px dashed #ff0;
}

.site-title {
  margin: 0.25rem 0 0;
  font-family: "Comic Sans MS", "Bradley Hand", cursive, sans-serif;
  font-size: 2.1rem;
  letter-spacing: 0.05em;
  text-shadow:
    2px 2px 0 #009,
    -1px -1px 0 #0ff;
}

.banner .tagline {
  margin: 0.3rem 0 0;
  font-family: "Comic Sans MS", cursive, sans-serif;
  font-size: 0.95rem;
  color: #cff;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.6rem;
}

/* -------------------------------------------------------- marquee */
.marquee {
  overflow: hidden;
  white-space: nowrap;
  background: #000;
  color: #0f0;
  font-family: "Courier New", Courier, monospace;
  font-weight: bold;
  padding: 0.35rem 0;
  border-top: 2px solid #ff0;
  border-bottom: 2px solid #ff0;
}

.marquee span {
  display: inline-block;
  padding-left: 100%;
  animation: scroll-left 16s linear infinite;
}

@keyframes scroll-left {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-100%);
  }
}

/* generic link colours, specificity zeroed with :where() so they never
   fight the .site-nav button overrides for cascade priority */
:where(main) a {
  color: #00e;
}

:where(footer) a {
  color: #9ff;
}

:where(main) a:visited {
  color: #909;
}

/* ------------------------------------------------------------- nav */
.site-nav {
  background: #036;
  padding: 0.6rem;
  border-bottom: 4px ridge #fc0;
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  background: #ccc;
  background: linear-gradient(180deg, #eee 0%, #999 100%);
  border: 2px outset #fff;
  color: #009;
  font-family: "Comic Sans MS", cursive, sans-serif;
  font-weight: bold;
  font-size: 0.85rem;
  text-decoration: none;
  text-transform: uppercase;
}

.site-nav a:hover {
  border-style: inset;
  background: linear-gradient(180deg, #fc0 0%, #f90 100%);
}

.site-nav a[aria-current="page"] {
  background: linear-gradient(180deg, #f6c 0%, #c09 100%);
  border-style: inset;
  color: #fff;
}

/* ------------------------------------------------------------ main */
main {
  padding: 1.25rem 1.5rem 1.75rem;
  line-height: 1.55;
}

main h1 {
  font-family: "Comic Sans MS", cursive, sans-serif;
  color: #c06;
  border-bottom: 3px double #c06;
  padding-bottom: 0.25rem;
}

main h2 {
  font-family: "Comic Sans MS", cursive, sans-serif;
  color: #060;
  background: #cfc;
  padding: 0.2rem 0.5rem;
  border-left: 6px solid #090;
}

.divider {
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
  margin: 1.25rem auto;
}

.blink {
  animation: blink-anim 1.1s steps(1) infinite;
  font-weight: bold;
  color: #f00;
}

@keyframes blink-anim {
  50% {
    opacity: 0;
  }
}

.rainbow {
  font-weight: bold;
  animation: rainbow-anim 4s linear infinite;
}

@keyframes rainbow-anim {
  0% {
    color: #f00;
  }

  20% {
    color: #f90;
  }

  40% {
    color: #fe0;
  }

  60% {
    color: #0c4;
  }

  80% {
    color: #06f;
  }

  100% {
    color: #c0f;
  }
}

/* --------------------------------------------------- construction */
.construction-banner {
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
  margin: 0.5rem auto 1.25rem;
}

/* -------------------------------------------------------- badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 31px;
  font-size: 0.6rem;
  line-height: 1.05;
  text-align: center;
  font-family: "MS Sans Serif", Tahoma, Geneva, sans-serif;
  border: 1px solid #000;
  padding: 2px;
}

.badge-netscape {
  background: #006;
  color: #ff0;
}

.badge-800 {
  background: #fff;
  color: #000;
}

.badge-hits {
  background: #000;
  color: #0f0;
  font-family: "Courier New", monospace;
}

/* -------------------------------------------------------- counter */
.counter {
  text-align: center;
  margin: 1.5rem 0 0.5rem;
  font-family: "Comic Sans MS", cursive, sans-serif;
}

.counter-digits {
  display: inline-flex;
  background: #000;
  border: 3px inset #666;
  padding: 0.3rem 0.5rem;
  gap: 0.15rem;
}

.counter-digits span {
  display: inline-block;
  width: 1.1rem;
  text-align: center;
  font-family: "Courier New", Courier, monospace;
  font-weight: bold;
  font-size: 1.3rem;
  color: #0f0;
  background: #001a00;
}

/* --------------------------------------------------------- tables */
table.retro {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 1rem 0;
  background: #fff;
}

table.retro caption {
  font-family: "Comic Sans MS", cursive, sans-serif;
  color: #c06;
  text-align: left;
  margin-bottom: 0.35rem;
  font-weight: bold;
}

table.retro th,
table.retro td {
  border: 2px solid #036;
  padding: 0.5rem 0.6rem;
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
}

table.retro th {
  background: #fc0;
  color: #000;
  font-family: "Comic Sans MS", cursive, sans-serif;
}

table.retro tr:nth-child(even) td {
  background: #eaf6ff;
}

.table-wrap {
  overflow-x: auto;
}

/* --------------------------------------------------------- footer */
footer {
  background: #003;
  color: #ccf;
  text-align: center;
  padding: 1rem 0.5rem;
  font-size: 0.8rem;
  border-top: 4px ridge #fc0;
}

/* ----------------------------------------------------- guestbook */
.guestbook-entry {
  border: 2px dashed #c06;
  background: #fffbe6;
  padding: 0.6rem 0.9rem;
  margin: 0 0 1rem;
}

.guestbook-entry .who {
  font-weight: bold;
  color: #036;
}

.guestbook-entry .when {
  font-size: 0.8rem;
  color: #666;
}

/* -------------------------------------------------- small screens */
@media (width <= 480px) {
  body {
    padding: 0.5rem 0.25rem 2rem;
  }

  .site-title {
    font-size: 1.5rem;
  }

  main {
    padding: 1rem 0.85rem 1.25rem;
  }

  .site-nav a {
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
  }

  table.retro th,
  table.retro td {
    padding: 0.4rem;
    font-size: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee span,
  .blink,
  .rainbow {
    animation: none;
  }
}
