@charset "UTF-8";
@import "variables.css";

/* ============================================================
   Retro 8-Bit Theme — DDAL Character Log (RPG Status & Quest Sheet)
   Inspired by Final Fantasy & The Legend of Zelda (NES)
   ============================================================ */

/* 2. Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

/* 3. Global Page Layout: Tiled NES Overworld */
html {
  box-sizing: border-box;
  background-color: var(--color-nes-bg);
  background-image: url("bg_retro.png");
  background-repeat: repeat;
  background-size: 64px 64px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  font-family: var(--font-body);
  color: var(--color-nes-white);
  -webkit-font-smoothing: none;
  font-smooth: never;
  text-rendering: geometricPrecision;
}

body {
  margin: 0 auto;
  padding: 1.5rem 1rem 3.5rem;
  max-width: 64rem;
  min-height: 100vh;
}

/* 4. Navigation Bar */
.nav {
  width: 100%;
  margin: 0 0 1.25rem auto;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  position: relative;
  z-index: 100;
}

.nav a {
  width: 52px;
  height: 52px;
  display: inline-block;
  cursor: pointer;
  background: center/contain no-repeat;
  background-color: var(--nav-btn-bg);
  border: 3px solid var(--nav-btn-border);
  outline: none;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.6));
  border-radius: 50%;
  position: relative;
  z-index: 101;
  transition: transform 0.12s ease, border-color 0.12s ease, filter 0.12s ease;
}

.nav a:hover,
.nav a:focus {
  transform: translateY(-2px);
  border-color: var(--nav-btn-border-hover);
  filter: drop-shadow(0 0 6px rgba(248, 184, 0, 0.8)) drop-shadow(0 4px 4px rgba(0, 0, 0, 0.7));
  z-index: 102;
}

.nav .home {
  background-image: url("homebutton.png");
}

.nav .up {
  background-image: url("upbutton.png");
}
.nav a:hover::before,
.nav a:focus::before {
  content: "";
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 6px 7px 6px;
  border-style: solid;
  border-color: transparent transparent var(--nav-btn-border-hover) transparent;
  pointer-events: none;
  z-index: 1001;
}

.nav a:hover::after,
.nav a:focus::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--color-nes-gold);
  background-color: var(--color-nes-blue-dark);
  border: 2px solid var(--nav-btn-border-hover);
  outline: 2px solid var(--color-nes-black);
  padding: 5px 9px;
  border-radius: 0;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
  text-shadow: 1px 1px 0 #000;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.7);
}

/* 5. Main Character Window Frame */
section.level1 {
  background: linear-gradient(
    180deg,
    var(--color-nes-blue-top) 0%,
    var(--color-nes-blue-mid) 35%,
    var(--color-nes-blue-dark) 100%
  );
  border: 4px solid var(--color-nes-white);
  outline: 4px solid var(--color-nes-black);
  box-shadow:
    inset 0 0 0 4px var(--color-nes-black),
    0 8px 0 rgba(0, 0, 0, 0.6);
  padding: 2.25rem 2rem;
  margin: 0 auto;
  position: relative;
}

/* Character Heading & Log Badge */
section.level1 > h1 {
  font-family: var(--font-pixel);
  font-size: clamp(1.1rem, 3.5vw, 1.8rem);
  color: var(--color-nes-gold);
  text-shadow: 3px 3px 0 var(--color-nes-black);
  margin: 0 0 1.75rem 0;
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 3px solid var(--color-nes-white);
  padding-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

section.level1 > h1 .char-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: break-word;
}

/* Log Button / Badge */
section.level1 > h1 > a,
section.level1 > h1 .log-badge {
  flex: 0 0 auto;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  color: var(--color-nes-cyan);
  background: var(--color-nes-blue-dark);
  border: 2px solid var(--color-nes-white);
  outline: 2px solid var(--color-nes-black);
  box-shadow:
    inset 0 0 0 1px var(--color-nes-black),
    0 3px 0 rgba(0, 0, 0, 0.6);
  padding: 0.4rem 0.8rem;
  text-decoration: none;
  text-shadow: 1px 1px 0 #000;
  transition: all 0.1s ease;
  letter-spacing: 1px;
}

section.level1 > h1 > a:hover,
section.level1 > h1 .log-badge:hover {
  color: var(--color-nes-gold);
  border-color: var(--color-nes-gold);
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 1px var(--color-nes-black),
    0 5px 0 rgba(0, 0, 0, 0.7);
}

section.level1 > h1 > a::before,
section.level1 > h1 .log-badge::before {
  content: var(--content-log-icon);
  font-size: 0.75rem;
  margin-right: 0.35rem;
}

/* 6. Character Status Card (RPG Status Box) */
div.character {
  background: var(--color-nes-blue-dark);
  border: 3px solid var(--color-nes-cyan);
  outline: 3px solid var(--color-nes-black);
  box-shadow:
    inset 0 0 0 2px var(--color-nes-black),
    0 5px 0 rgba(0, 0, 0, 0.55);
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0 2.25rem;
}

div.character::before {
  content: var(--content-character-status);
  display: block;
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  color: var(--color-nes-cyan);
  letter-spacing: 2px;
  margin-bottom: 1rem;
  text-shadow: 1px 1px 0 #000;
  border-bottom: 2px dashed rgba(92, 224, 232, 0.35);
  padding-bottom: 0.5rem;
}

div.character table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  border: none;
  box-shadow: none;
  outline: none;
}

div.character table td {
  padding: 0.4rem 0.6rem;
  vertical-align: middle;
  font-family: var(--font-body);
  font-size: 1.35rem;
  line-height: 1.3;
  border-bottom: 1px solid rgba(92, 224, 232, 0.2);
}

div.character table tr:last-child td {
  border-bottom: none;
}

div.character table td:first-child {
  color: var(--color-nes-gold);
  text-transform: uppercase;
  width: 42%;
  overflow-wrap: break-word;
  font-family: var(--font-body);
  font-size: 1.45rem;
  line-height: 1.3;
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 #000;
}

div.character table td:last-child {
  color: var(--color-nes-white);
  width: 58%;
  font-family: var(--font-body);
  font-size: 1.4rem;
}
div.character table td a {
  color: var(--color-nes-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.1s ease;
}

div.character table td a:hover {
  color: var(--color-nes-gold);
}

/* 7. Section Headings */
h2 {
  font-family: var(--font-pixel);
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--color-nes-gold);
  text-shadow: 2px 2px 0 var(--color-nes-black);
  margin: 2.5rem 0 1.25rem;
  text-transform: uppercase;
  border-bottom: 3px solid var(--color-nes-white);
  padding-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 1px;
}

h2::before {
  content: var(--content-cursor);
  color: var(--color-nes-gold);
  font-size: 0.8rem;
}

h3 {
  font-family: var(--font-pixel);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--color-nes-cyan);
  text-shadow: 2px 2px 0 var(--color-nes-black);
  margin: 2.25rem 0 1rem;
  border-left: 4px solid var(--color-nes-gold);
  padding-left: 0.75rem;
  letter-spacing: 0.5px;
}

h4, h5, h6 {
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--color-nes-gold);
  text-shadow: 1px 1px 0 #000;
  margin: 1.5rem 0 0.75rem;
}

/* 8. 8-Bit Data Tables (Magic Items, Events, Adventure Stats) */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-body);
  font-size: 1.35rem;
  line-height: 1.25;
  border: 3px solid var(--color-nes-white);
  outline: 3px solid var(--color-nes-black);
  box-shadow:
    inset 0 0 0 2px var(--color-nes-black),
    0 4px 0 rgba(0, 0, 0, 0.5);
  margin: 1rem 0 1.5rem;
  background-color: var(--color-nes-blue-dark);
}

table thead th {
  background-color: var(--color-nes-blue-dark);
  color: var(--color-nes-gold);
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--color-nes-white);
  text-align: left;
  text-transform: uppercase;
  font-family: var(--font-body);
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: 1.5px;
  text-shadow: 1px 1px 0 #000;
}

table tbody tr:nth-child(even) {
  background-color: rgba(8, 20, 120, 0.65);
}

table tbody tr:nth-child(odd) {
  background-color: rgba(0, 12, 80, 0.85);
}

table tbody tr:hover {
  background-color: rgba(24, 48, 168, 0.95);
}

table tbody td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--color-nes-white);
  vertical-align: top;
  font-family: var(--font-body);
  font-size: 1.35rem;
  line-height: 1.25;
}

table tbody tr:last-child td {
  border-bottom: none;
}

table a {
  color: var(--color-nes-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

table a:hover {
  color: var(--color-nes-gold);
}

/* Disable any artificial column widths from colgroup/col */
table colgroup {
  display: none;
}

table col {
  width: auto !important;
}

/* Table containers: scroll horizontally if content exceeds viewport */
div.events,
div.magic-items,
div.supernatural-gifts,
div.story-awards,
div.adventure {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Column sizing for Event tables: DATE, GP, DT shrink-wrap to content; ACTIVITY takes remaining width */
div.events table {
  width: 100%;
}

div.events th:nth-child(1),
div.events td:nth-child(1) {
  width: 1%;
  white-space: nowrap;
}

div.events th:nth-child(2),
div.events td:nth-child(2) {
  width: 100%;
}

div.events th:nth-child(3),
div.events td:nth-child(3),
div.events th:nth-child(4),
div.events td:nth-child(4) {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Magic items column sizing: Rarity, #, and Count shrink-wrap; Item takes remaining width */
div.magic-items th:nth-child(1),
div.magic-items td:nth-child(1),
div.magic-items th:nth-child(2),
div.magic-items td:nth-child(2),
div.magic-items th:nth-child(4),
div.magic-items td:nth-child(4) {
  width: 1%;
  white-space: nowrap;
}

div.magic-items th:nth-child(3),
div.magic-items td:nth-child(3) {
  width: 100%;
}

/* Numeric columns in magic items and adventure tables: right align */
div.magic-items th:nth-child(2),
div.magic-items td:nth-child(2),
div.magic-items th:nth-child(4),
div.magic-items td:nth-child(4),
div.adventure table:nth-of-type(2) th:nth-child(n + 2),
div.adventure table:nth-of-type(2) td:nth-child(n + 2) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
div.adventure table:nth-of-type(2) td:first-child {
  color: var(--color-nes-gold);
}


/* 9. Adventure Card Sub-Panel */
div.adventure {
  background: rgba(0, 8, 68, 0.75);
  border: 2px solid var(--color-nes-cyan);
  outline: 2px solid var(--color-nes-black);
  box-shadow:
    inset 0 0 0 2px var(--color-nes-black),
    0 4px 0 rgba(0, 0, 0, 0.5);
  padding: 1.25rem;
  margin: 1rem 0 1.5rem;
}

div.adventure table {
  margin: 0.5rem 0;
}

div.adventure table + table {
  margin-top: 1rem;
}

/* 10. Narrative & Text Elements */
p {
  font-family: var(--font-body);
  font-size: 1.4rem;
  line-height: 1.45;
  color: #d8e0f0;
  margin-bottom: 1.15rem;
  text-shadow: 1px 1px 0 #000;
}

p a {
  color: var(--color-nes-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

p a:hover {
  color: var(--color-nes-gold);
}

ul, ol {
  font-family: var(--font-body);
  font-size: 1.35rem;
  line-height: 1.45;
  color: #d8e0f0;
  padding-left: 1.5rem;
  margin-bottom: 1.15rem;
}
li {
  margin-bottom: 0.5rem;
}

strong {
  color: var(--color-nes-gold);
  font-weight: normal;
  text-shadow: 1px 1px 0 #000;
}

blockquote {
  background: var(--color-nes-blue-dark);
  border-left: 4px solid var(--color-nes-gold);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  color: var(--color-nes-cyan);
  font-family: var(--font-body);
  font-size: 1.35rem;
  line-height: 1.45;
}

/* 11. Figures & Illustrations */
figure {
  background: var(--color-nes-blue-dark);
  border: 3px solid var(--color-nes-white);
  outline: 3px solid var(--color-nes-black);
  box-shadow:
    inset 0 0 0 2px var(--color-nes-black),
    0 5px 0 rgba(0, 0, 0, 0.6);
  padding: 0.75rem;
  margin: 1.75rem auto;
  max-width: 90%;
  text-align: center;
}

figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 2px solid var(--color-nes-black);
}

figcaption {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  color: var(--color-nes-gold);
  margin-top: 0.75rem;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
  letter-spacing: 0.5px;
}

/* 12. 8-Bit Dotted Dividers */
hr {
  border: none;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--color-nes-gold) 0,
    var(--color-nes-gold) 8px,
    transparent 8px,
    transparent 16px
  );
  margin: 2.25rem auto;
  width: 90%;
}

/* 13. Details & Summary */
details.summary,
details.details {
  background: var(--color-nes-blue-dark);
  border: 2px solid var(--color-nes-white);
  outline: 2px solid var(--color-nes-black);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}
details.summary > *:not(summary),
details.details > *:not(summary) {
  font-family: var(--font-body);
  font-size: 1.35rem;
  line-height: 1.4;
}


details.summary > summary,
details.details > summary {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--color-nes-gold);
  cursor: pointer;
  user-select: none;
  list-style-position: inside;
  text-shadow: 1px 1px 0 #000;
}

/* 14. Footer Indicator */
section.level1::after {
  content: var(--tagline);
  display: block;
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  color: var(--color-nes-cyan);
  letter-spacing: 2px;
  margin: 2.75rem auto 0;
  text-shadow: 1px 1px 0 var(--color-nes-black);
}

/* 15. Mobile Responsiveness */
@media (max-width: 768px) {
  body {
    padding: 0.75rem 0.5rem 2rem;
  }

  .nav {
    margin: 0 0 1rem auto;
    gap: 0.5rem;
  }

  .nav a {
    width: 44px;
    height: 44px;
  }

  section.level1 {
    padding: 1.25rem 0.85rem;
  }

  section.level1 > h1 {
    font-size: clamp(0.95rem, 4vw, 1.25rem);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0 0 1.25rem 0;
    padding-bottom: 1rem;
  }

  section.level1 > h1 .char-title {
    flex: 1 1 auto;
    min-width: 0;
  }

  section.level1 > h1 > a,
  section.level1 > h1 .log-badge {
    flex: 0 0 auto;
    font-size: 0.6rem;
    padding: 0.35rem 0.6rem;
  }

  div.character {
    padding: 0.85rem 0.65rem;
    margin: 1.25rem 0 1.5rem;
  }

  div.character::before {
    font-size: 0.65rem;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 0.75rem;
  }

  div.character table td {
    padding: 0.3rem 0.35rem;
    font-size: 1.2rem;
    line-height: 1.25;
  }

  div.character table td:first-child {
    width: 44%;
    white-space: normal;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
  }

  div.character table td:last-child {
    width: 56%;
    white-space: normal;
    font-size: 1.2rem;
  }

  h2 {
    font-size: 0.95rem;
    margin: 2rem 0 1rem;
    gap: 0.4rem;
  }

  h3 {
    font-size: 0.75rem;
    margin: 1.75rem 0 0.75rem;
    padding-left: 0.5rem;
  }

  table {
    margin: 0.75rem 0;
  }

  table thead th {
    padding: 0.35rem 0.35rem;
    font-size: 0.6rem;
    letter-spacing: 0.5px;
  }

  table tbody td {
    padding: 0.35rem 0.35rem;
    font-size: 1.15rem;
    line-height: 1.2;
  }

  div.events th:nth-child(1),
  div.events td:nth-child(1) {
    font-size: 1.05rem;
  }

  div.adventure {
    padding: 0.75rem 0.5rem;
    margin: 0.75rem 0 1.25rem;
  }

  section.level1::after {
    font-size: 0.55rem;
    letter-spacing: 1px;
    margin: 2rem auto 0;
  }
}

