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

:root {
  --color-heading: rgb(51, 51, 156);
  --color-accent: #bb99df;
  --color-content-bg: #eceffa;
  --color-muted: #888;
}

/* --- Scrolling marquee bar --- */
.marquee-bar {
  max-width: 880px;
  margin: 0 auto;
  overflow: hidden;
  background-color: var(--color-accent);
  padding: 4px 0;
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee-scroll 45s linear infinite;
}
.marquee-text {
  flex-shrink: 0;
  white-space: nowrap;
  padding-right: 60px;
  font-size: 0.85em;
  color: #ffffff;
  font-family: "Heisei Mincho", Verdana, Arial, sans-serif;
}
@keyframes marquee-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .marquee-track {
    animation: none;
  }
}

/* --- Custom fonts --- */
@font-face {
  font-family: "Heisei Mincho";
  src: url("fonts/NIS-Heisei-Mincho-W3-Condensed.woff") format("woff"),
       url("fonts/NIS-Heisei-Mincho-W3-Condensed.ttf") format("truetype");
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: "Heisei Mincho";
  src: url("fonts/NIS-Heisei-Mincho-W9-Condensed.woff") format("woff"),
       url("fonts/NIS-Heisei-Mincho-W9-Condensed.ttf") format("truetype");
  font-display: swap;
  font-weight: bold;
  font-style: normal;
}
@font-face {
  font-family: "Seibi Block Script";
  src: url("fonts/Seibi-Block-Script.woff") format("woff"),
       url("fonts/Seibi-Block-Script.ttf") format("truetype");
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}
/* Loaded and ready to use, but not yet applied anywhere */

html, body {
  margin: 0;
  padding: 0;
}
body {
  background-image: url("../images/wallpaper.jpg");
  background-repeat: repeat;
  background-position: top center;
  background-attachment: fixed;
  background-color: #4a3751; /* fallback while image loads */
  font-family: Verdana, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #000000;
  cursor: url("../images/cursor.cur"), auto;
}
h1 {
  margin: 0 0 10px 0;
  font-size: 1.6em;
  letter-spacing: 0.01em;
  color: var(--color-heading);
}
#view-magazines h1 {
  text-align: center;
}
#view-magazines h1::after {
  content: "\002500\002500\002500\002500\000B68\0009CE\002500\002500\002500\002500";
  display: block;
  margin-top: 4px;
  color: var(--color-accent);
  font-weight: normal;
  letter-spacing: 0;
  font-size: 0.7em;
}

#page-wrap {
  max-width: 880px;
  margin: 0 auto;
  min-height: 100vh;
  background-color: var(--color-content-bg);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

/* --- Header / banner / nav --- */
.site-header {
  position: relative;
  text-align: center;
}
.social-icons {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  z-index: 3;
}
.social-icons img {
  display: block;
  border-radius: 4px;
}
.social-icons a:hover img {
  opacity: 0.8;
}
.site-header a {
  display: inline-block;
  border: none;
  text-decoration: none;
}
.site-header .banner {
  display: inline-block;
  max-width: 100%;
  height: auto;
}
.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  padding: 6px 0;
  margin-top: -34px;
  position: relative;
  z-index: 2;
}
.main-nav a {
  display: block;
  line-height: 0;
  margin: 4px 9px;
}
.main-nav img {
  display: block;
  width: auto;
  height: auto;
}
.main-nav img:hover {
  filter: brightness(1.15);
}

/* --- Content row: aside + main content --- */
.content-row {
  display: flex;
  align-items: stretch;
  flex: 1;
}
.nav-aside {
  width: 230px;
  flex-shrink: 0;
  background-color: var(--color-accent);
  color: #ffffff;
  padding: 18px 20px;
  font-size: 14px;
}
.nav-aside[hidden] {
  display: none;
}
.nav-aside h2 {
  margin: 0 0 14px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 1.2em;
  letter-spacing: 0.02em;
  color: #ffffff;
  font-family: "Heisei Mincho", Verdana, Arial, sans-serif;
}
.nav-aside ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: "Seibi Block Script", Verdana, Arial, sans-serif;
}
.nav-aside li {
  margin-bottom: 8px;
}
.nav-aside a {
  color: #ffffff;
  text-decoration: none;
  font-weight: bold;
}
.nav-aside a:hover {
  text-decoration: underline;
}

/* --- Expandable categories (used in every aside) --- */
.category-list {
  font-family: "Seibi Block Script", Verdana, Arial, sans-serif;
}
.category-toggle {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 3px 0;
  margin: 0;
  color: #ffffff;
  font-family: "Heisei Mincho", Verdana, Arial, sans-serif;
  font-size: 0.95em;
  line-height: 1.3;
  font-weight: bold;
  cursor: pointer;
}
.category-toggle::before {
  content: "\25B8"; /* ▸ */
  display: inline-block;
  width: 1.1em;
}
.category-toggle[aria-expanded="true"]::before {
  content: "\25BE"; /* ▾ */
}
.category-toggle:hover {
  text-decoration: underline;
}
.issue-list {
  list-style: none;
  margin: 5px 0 4px 1.5em;
  padding: 0;
  font-size: 0.85em;
}
.issue-list[hidden] {
  display: none;
}
.issue-list li {
  margin-bottom: 5px;
}
.issue-list a {
  font-weight: normal;
}

/* --- Page content --- */
#page-container {
  flex: 1;
  min-width: 0;
  padding: 20px;
}
.page-view[hidden] {
  display: none;
}
.scan-viewer {
  border: 2px dashed var(--color-accent);
  border-radius: 6px;
  padding: 24px;
  text-align: center;
}

.back-link {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--color-heading);
  text-decoration: none;
  font-weight: bold;
}
.back-link:hover {
  text-decoration: underline;
}

/* --- Interviews and Articles table --- */

.table-filters {
  margin: 20px 0;
  padding: 14px;
  background-color: #ffffff;
  border-radius: 6px;
}
.filter-group {
  margin-bottom: 12px;
}
.filter-group:last-of-type {
  margin-bottom: 0;
}
.filter-group h3 {
  margin: 0 0 6px 0;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}
.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-btn {
  background-color: var(--color-content-bg);
  border: 1px solid var(--color-accent);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.8em;
  color: var(--color-heading);
  cursor: pointer;
}
.filter-btn:hover {
  background-color: var(--color-accent);
  color: #ffffff;
}
.filter-btn.active {
  background-color: var(--color-accent);
  color: #ffffff;
  font-weight: bold;
}
.filters-clear {
  margin-top: 14px;
  background: none;
  border: none;
  color: var(--color-heading);
  font-weight: bold;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85em;
  padding: 0;
}
.table-results-count {
  font-size: 0.85em;
  color: var(--color-muted);
  margin: 12px 0;
}
.table-scroll {
  overflow-x: auto;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
}
.interviews-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
  table-layout: fixed;
}
/* Description carries the most text, so give it the most room and keep
   the other columns from collapsing to one word per line. */
.interviews-table th:nth-child(1), .interviews-table td:nth-child(1) { width: 21%; }
.interviews-table th:nth-child(2), .interviews-table td:nth-child(2) { width: 15%; }
.interviews-table th:nth-child(3), .interviews-table td:nth-child(3) { width: 30%; }
.interviews-table th:nth-child(4), .interviews-table td:nth-child(4) { width: 19%; }
.interviews-table th:nth-child(5), .interviews-table td:nth-child(5) { width: 15%; }
.interviews-table th {
  background-color: var(--color-accent);
  color: #ffffff;
  text-align: left;
  padding: 8px 10px;
  position: sticky;
  top: 0;
}
.interviews-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  vertical-align: top;
}
.interviews-table tr:nth-child(even) {
  background-color: var(--color-content-bg);
}
a.link-badge {
  color: #1a3fd0;
  text-decoration: underline;
}
a.link-badge:visited {
  color: #6b3fa0;
}
a.link-badge:hover,
a.link-badge:focus-visible {
  color: #0b2ea8;
  text-decoration: underline;
}
.link-badge-pending {
  color: var(--color-muted);
  font-style: italic;
}
.link-badge {
  display: inline-block;
  margin: 0 10px 2px 0;
  font-size: 0.9em;
  line-height: 1.6;
  white-space: nowrap;
}
.directory-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}
.directory-entry {
  display: flex;
  gap: 16px;
  padding: 16px;
  border: 2px dashed var(--color-accent);
  border-radius: 6px;
}
.directory-thumb {
  flex-shrink: 0;
  width: 120px;
  height: 90px;
  object-fit: contain;
  background-color: var(--color-content-bg);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}
.directory-info {
  min-width: 0;
}
.directory-info h2 {
  margin: 0 0 6px 0;
  font-size: 1.1em;
  color: var(--color-heading);
  font-family: "Heisei Mincho", Verdana, Arial, sans-serif;
}
.directory-info h2 a {
  color: inherit;
  text-decoration: none;
}
.directory-info h2 a:hover {
  text-decoration: underline;
}
.directory-desc {
  margin: 0;
  font-size: 0.9em;
  color: var(--color-muted);
}
.scan-viewer img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
.scan-pdf {
  width: 100%;
  height: 80vh;
  min-height: 500px;
  border: none;
  display: block;
  background-color: #ffffff;
}
.pdf-open-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--color-heading);
  font-weight: bold;
  text-decoration: none;
}
.pdf-open-link:hover {
  text-decoration: underline;
}
.scan-viewer p {
  color: var(--color-muted);
  font-style: italic;
  margin: 0;
}
.welcome-hero {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}
.welcome-notes {
  max-width: 640px;
  margin: 20px auto 0 auto;
}
.welcome-notes p {
  margin: 0 0 10px 0;
}
.welcome-notes p.indent {
  text-indent: 2em;
}
.construction-notice {
  text-align: center;
  margin-bottom: 12px;
}
.construction-notice img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 6px auto;
}
.construction-notice p {
  margin: 0;
  color: var(--color-muted);
}
.heart-list {
  list-style: none;
  margin: 0 0 10px 0;
  padding: 0;
  text-align: center;
}
.heart-list li {
  margin-bottom: 2px;
}
.resource-list {
  list-style: none;
  margin: 0 0 20px 0;
  padding: 0;
  text-align: center;
}
.resource-list li {
  margin-bottom: 8px;
}
.resource-list a,
.welcome-notes p a {
  color: var(--color-heading);
  font-weight: bold;
  text-decoration: none;
}
.resource-list a:hover,
.welcome-notes p a:hover {
  text-decoration: underline;
}
.welcome-rei {
  text-align: center;
  margin-bottom: 20px;
}
.welcome-rei img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}
.site-disclaimer {
  flex: 1;
  margin: 0;
  font-size: 0.8em;
  color: #ffffff;
  text-align: center;
}
footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: left;
  font-size: 0.75em;
  margin-top: 20px;
  padding: 10px 16px;
  background-color: #9b6b9e;
  color: #ffffff;
}
footer a {
  display: block;
  line-height: 0;
  flex-shrink: 0;
}
footer img {
  display: block;
}

/* --- About Me panel (persistent, opposite the nav aside) --- */
.about-me {
  width: 220px;
  flex-shrink: 0;
  padding: 4px 20px 20px 20px;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}
.about-me h2 {
  margin: 0 0 6px 0;
  font-size: 1.2em;
  letter-spacing: 0.02em;
  color: var(--color-heading);
  font-family: "Heisei Mincho", Verdana, Arial, sans-serif;
}
.about-me h2::after {
  content: "\002500\002500\002500\002500\000B68\0009CE\002500\002500\002500\002500";
  display: block;
  margin-top: 4px;
  color: var(--color-accent);
  font-weight: normal;
  letter-spacing: 0;
}
.about-me-photo-wrap {
  position: relative;
  margin: 0 0 8px 0;
}
.about-me-photo {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}
.about-me-bubble {
  position: absolute;
  top: -18px;
  right: -35px;
  width: 75px;
  height: auto;
  z-index: 4;
}
.about-me p {
  margin: 0 0 16px 0;
  font-size: 0.85em;
  line-height: 1.5;
}
.about-me a {
  color: var(--color-heading);
  font-weight: bold;
  text-decoration: none;
}
.about-me a:hover {
  text-decoration: underline;
}
.about-me-gifs {
  display: flex;
  justify-content: center;
}
.about-me-gifs img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.button-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.button-widget img {
  display: block;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.button-code {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  background-color: #ffffff;
  color: #333333;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 0.75em;
  line-height: 1.3;
  resize: none;
}
.button-code:focus {
  outline: 2px solid var(--color-accent);
}
.about-me h3,
.section-divider {
  margin: 20px 0 10px 0;
  border-bottom: 1px solid var(--color-accent);
}
.about-me h3 {
  padding-bottom: 8px;
  font-size: 1em;
  letter-spacing: 0.02em;
  color: var(--color-heading);
  font-family: "Heisei Mincho", Verdana, Arial, sans-serif;
}
.site-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.site-links img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.site-links img:hover {
  filter: brightness(1.08);
}
.mini-calendar {
  font-size: 0.8em;
}
.mini-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-family: "Heisei Mincho", Verdana, Arial, sans-serif;
  font-weight: bold;
}
.mini-calendar-header button {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  color: #ffffff;
  width: 22px;
  height: 22px;
  line-height: 1;
  cursor: pointer;
  font-size: 1em;
}
.mini-calendar-header button:hover {
  background-color: rgba(255, 255, 255, 0.15);
}
.mini-calendar-weekdays,
.mini-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}
.mini-calendar-weekdays {
  margin-bottom: 4px;
  font-weight: bold;
  opacity: 0.85;
}
.mini-calendar-grid span {
  padding: 4px 0;
  border-radius: 3px;
}
.mini-calendar-grid span.today {
  background-color: #ffffff;
  color: var(--color-heading);
  font-weight: bold;
}
.mini-calendar-grid span.empty {
  opacity: 0;
}

/* --- Small screens --- */
@media (max-width: 700px) {
  #page-wrap {
    max-width: 100%;
  }
  footer {
    flex-direction: column;
    text-align: center;
  }
  .site-disclaimer {
    text-align: center;
  }
  .content-row {
    flex-direction: column;
  }
  .nav-aside {
    width: 100%;
  }
  .about-me {
    width: 100%;
    border-left: none;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }
  /* The bubble hangs 35px past the photo, which pushes the page
     sideways once the sidebar is full width. Tuck it back inside. */
  .about-me-bubble {
    right: 0;
  }
  .marquee-bar {
    max-width: 100%;
  }
}

/* --- Keyboard focus --- */
:focus-visible {
  outline: 2px solid var(--color-heading);
  outline-offset: 2px;
}
.nav-link[aria-current="page"] img {
  filter: brightness(1.2) saturate(1.2);
}

/* --- Interviews table on small screens ---
   Five columns don't fit a phone, so each row becomes a stacked card
   and the data-label attributes render as inline headings. */
@media (max-width: 700px) {
  .table-scroll {
    overflow-x: visible;
    border: none;
  }
  .interviews-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .interviews-table,
  .interviews-table tbody,
  .interviews-table tr,
  .interviews-table td {
    display: block;
    width: 100%;
  }
  .interviews-table tr {
    margin-bottom: 12px;
    border: 1px solid var(--color-accent);
    border-radius: 6px;
    background-color: #ffffff;
    overflow: hidden;
  }
  .interviews-table tr:nth-child(even) {
    background-color: #ffffff;
  }
  .interviews-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 6px 10px;
  }
  .interviews-table td:last-child {
    border-bottom: none;
  }
  .interviews-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.8em;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted);
  }
  .interviews-table td[data-label="Name"] {
    background-color: var(--color-content-bg);
    font-weight: bold;
  }
  .interviews-table td:empty,
  .interviews-table td.is-empty {
    display: none;
  }
  /* The name is the card heading; the label above it is noise. */
  .interviews-table td[data-label="Name"]::before {
    display: none;
  }
  .interviews-table th:nth-child(n), .interviews-table td:nth-child(n) {
    width: auto;
  }
}
