:root {
  --light-main: #F4F3EF;
  --light-secondary: #E8E1D6;
  --surface: #D5CCAD;
  --text-main: #2F3E3C;
  --text-alt: #5F6F6B;
  --accent: #78A19C;
  --line: #96B2A0;
  --warm: #C4956B;
  --bg-main: #0A1929;
  --highlight: #8685C0;
  --bg-panel: var(--light-main);
  --bg-panel-2: var(--light-secondary);
  --page-bg-color: var(--light-main);
  --page-bg-image: linear-gradient(to bottom, var(--light-main) 0%, var(--light-secondary) 100%);
  --page-bg-size: 100% 100%;
  --page-bg-attachment: fixed;
}

html[data-theme="dark"] {
  --page-bg-color: #0a1929;
  --page-bg-image: linear-gradient(to bottom, #0a1929 0%, #0f2239 100%);
  --page-bg-size: 100% 100%;
  /* palette overrides */
  --bg-panel: #0f2239;
  --bg-panel-2: #0a1929;
  --surface: #152d45;
  --light-main: #0f2239;
  --light-secondary: #152d45;
  --text-main: #e1cfd5;
  --text-alt: #bbabbf;
  --accent: #8685c0;
  --line: #2a3f56;
}

#stars-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
  z-index: 0;
  display: none;
}

html[data-theme="dark"] #stars-layer {
  display: block;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text-main);
  font-family: "VT323", monospace;
  font-size: 27px;
  line-height: 1.2;
  background-color: var(--page-bg-color);
  background-image: var(--page-bg-image);
  background-size: var(--page-bg-size);
  background-attachment: var(--page-bg-attachment);
}

a {
  color: var(--accent);
  text-decoration: underline;
}

a:hover {
  color: var(--bg-main);
  background: var(--light-secondary);
}

.wrap {
  width: min(980px, 96vw);
  margin: 18px auto;
  border: 4px ridge var(--line);
  background: var(--bg-panel);
  box-shadow: 0 0 25px rgba(134, 133, 192, 0.35);
}

.top-banner {
  border-bottom: 3px double var(--line);
  background: linear-gradient(135deg, var(--light-main), var(--light-secondary));
  padding: 16px;
}

.header-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 12px;
  align-items: stretch;
}

.header-brand,
.header-meta {
  border: 2px outset var(--line);
  background: var(--surface);
  padding: 10px;
}

.header-meta {
  position: relative;
  overflow: hidden;
}

.header-meta > * {
  position: relative;
  z-index: 1;
}

.header-corner-deco {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 108px;
  height: auto;
  display: block;
  image-rendering: pixelated;
  pointer-events: none;
  opacity: 0.95;
  z-index: 0;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.35));
}

.site-kicker {
  margin: 0 0 6px;
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  letter-spacing: 0.7px;
  color: var(--highlight);
}

.header-brand h1 {
  margin: 0;
  font-family: "Jacquarda Bastarda 9", "Press Start 2P", monospace;
  font-size: clamp(28px, 5.5vw, 56px);
  line-height: 1.1;
  text-shadow: 2px 2px 0 var(--light-main);
  letter-spacing: 2px;
}

.site-title-link {
  color: inherit;
  text-decoration: none;
}

.site-title-link:hover {
  color: inherit;
  background: transparent;
}

.site-tagline {
  margin: 8px 0 0;
  color: var(--text-alt);
  max-width: 48ch;
}

.header-meta p {
  margin: 0 0 8px;
  line-height: 1.15;
}

.header-meta p:last-child {
  margin-bottom: 0;
}

.theme-toggle {
  width: 100%;
  margin-top: 8px;
  border: 2px outset var(--line);
  background: var(--light-main);
  color: var(--text-main);
  padding: 7px 8px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--accent);
  color: var(--light-main);
}

.theme-toggle:active {
  border-style: inset;
}

.header-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.header-pill {
  border: 2px solid var(--line);
  background: var(--light-main);
  color: var(--text-main);
  padding: 3px 8px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
}

h1,
h2,
h3 {
  font-family: "Press Start 2P", monospace;
  line-height: 1.4;
  margin: 0.6em 0;
  color: var(--text-main);
  text-shadow: 1px 1px 0 var(--light-main);
}

h1 {
  font-size: clamp(16px, 3vw, 25px);
}

h2 {
  font-size: clamp(14px, 2.2vw, 18px);
  border-bottom: 2px dotted var(--line);
  padding-bottom: 10px;
}

.main-col > section {
  margin-bottom: 18px;
  border: 2px solid var(--line);
  background: linear-gradient(180deg, rgba(244, 243, 239, 0.96), rgba(232, 225, 214, 0.95));
  box-shadow: 5px 5px 0 rgba(150, 178, 160, 0.35);
  padding: 0 12px 12px;
}

.main-col > section > h2 {
  margin: 0 -12px 12px;
  padding: 10px 12px;
  background: var(--accent);
  color: var(--light-main);
  border-bottom: 2px solid var(--line);
  text-shadow: none;
  font-family: "Jacquarda Bastarda 9", "Press Start 2P", monospace;
  font-size: clamp(20px, 3vw, 32px);
  letter-spacing: 1px;
}

.blink {
  color: var(--highlight);
  animation: blink 0.95s step-start infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

table.layout {
  width: 100%;
  border-collapse: collapse;
}

table.layout td {
  vertical-align: top;
  border: 1px solid rgba(120, 161, 156, 0.45);
}

.left-col {
  width: 220px;
  background: var(--bg-panel-2);
  padding: 12px;
}

.main-col {
  padding: 16px;
  background: rgba(244, 243, 239, 0.92);
}

.nav-box,
.stamp-box,
.status-box,
.link-box {
  margin-bottom: 14px;
  border: 2px outset var(--accent);
  background: var(--surface);
  padding: 10px;
}

.nav-box h3,
.stamp-box h3,
.status-box h3,
.link-box h3 {
  font-family: "Jacquarda Bastarda 9", "Press Start 2P", monospace;
  font-size: 22px;
  margin: 0 0 8px;
  letter-spacing: 1px;
}

.nav-box a {
  display: block;
  margin-bottom: 6px;
  font-weight: 400;
}

.nav-box a[aria-current="page"] {
  background: var(--light-secondary);
  border: 1px solid var(--line);
  color: var(--text-main);
  padding: 1px 4px;
}

.desktop-nav-links {
  display: block;
}

.mobile-nav-list {
  display: none;
  margin: 0;
}

.mobile-nav-list summary {
  cursor: pointer;
  border: 2px outset var(--line);
  background: var(--light-main);
  color: var(--text-main);
  padding: 7px 8px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
}

.mobile-nav-list ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--light-main);
}

.mobile-nav-list li {
  margin-bottom: 4px;
}

.mobile-nav-list li:last-child {
  margin-bottom: 0;
}

.hero {
  text-align: center;
  border: 2px dashed var(--line);
  padding: 14px;
  background: linear-gradient(180deg, var(--light-main), var(--light-secondary));
}

.hero-welcome {
  display: inline-block;
  margin: 0 0 4px;
  color: var(--warm);
}

.hero-welcome + p {
  margin-top: 0;
  margin-bottom: 4px;
}

.hero-welcome + p + p {
  margin-top: 4px;
  margin-bottom: 0;
}


.role {
  color: var(--light-main);
  background: var(--accent);
  border: 1px solid var(--line);
  display: inline-block;
  margin: 6px 3px;
  padding: 4px 8px;
}

.marquee {
  border: 1px solid var(--line);
  background: var(--surface);
  margin: 10px 0 16px;
  padding: 8px;
  color: var(--text-main);
}

.about-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

.avatar {
  width: 100%;
  border: 3px groove var(--accent);
  background: var(--light-secondary);
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--text-main);
  text-align: center;
  padding: 10px;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  overflow: hidden;
}

.avatar-image {
  width: 100%;
  height: auto;
  display: block;
  border: 2px solid var(--line);
  image-rendering: pixelated;
}

.contact-box {
  border: 0;
  padding: 0;
  background: transparent;
  margin-bottom: 0;
}

.contact-box label {
  display: block;
  margin-top: 8px;
  margin-bottom: 2px;
  color: var(--text-main);
}

.contact-box input,
.contact-box textarea {
  width: 100%;
  border: 2px inset var(--line);
  background: var(--light-main);
  color: var(--text-main);
  font-family: "VT323", monospace;
  font-size: 26px;
  padding: 4px 6px;
}

.contact-box button {
  margin-top: 10px;
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  border: 3px outset var(--warm);
  background: var(--accent);
  color: var(--light-main);
  padding: 8px 12px;
  cursor: pointer;
}

.contact-box button:active {
  border-style: inset;
}

.status {
  margin-top: 8px;
  color: var(--highlight);
}

.button-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.button-showcase {
  display: flex;
  justify-content: center;
  margin: 10px 0 8px;
}

.site-button-preview {
  position: relative;
  display: flex;
  width: 88px;
  height: 31px;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  border: 2px outset var(--line);
  background: var(--accent);
  color: var(--light-main);
  text-decoration: none;
}

.site-button-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.38;
  image-rendering: pixelated;
}

.site-button-preview span {
  position: relative;
  z-index: 1;
  padding: 0 3px;
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  line-height: 1.2;
  text-align: center;
  text-shadow: 1px 1px 0 rgba(10, 25, 41, 0.8);
}

.button-code-label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-alt);
}

.button-code {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  border: 2px inset var(--line);
  background: var(--light-main);
  color: var(--text-main);
  font-family: "VT323", monospace;
  font-size: 21px;
  line-height: 1.1;
  padding: 6px;
}

.copy-code-btn {
  width: 100%;
  margin-top: 8px;
  border: 2px outset var(--line);
  background: var(--accent);
  color: var(--light-main);
  padding: 7px 8px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  cursor: pointer;
}

.copy-code-btn:active {
  border-style: inset;
}

.copy-code-status {
  min-height: 1.2em;
  margin: 6px 0 0;
  color: var(--highlight);
}

.mini-btn {
  border: 2px outset var(--line);
  text-align: center;
  padding: 6px 4px;
  background: var(--accent);
  color: var(--light-main);
  text-decoration: none;
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
}

.footer {
  border-top: 3px double var(--line);
  text-align: center;
  padding: 12px;
  color: var(--text-main);
  background: var(--light-secondary);
  font-family: "Jacquarda Bastarda 9", "VT323", monospace;
  font-size: 28px;
  letter-spacing: 1px;
}

.panel-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
}

.panel-table th,
.panel-table td {
  border: 1px solid var(--accent);
  padding: 8px;
  background: var(--light-main);
  vertical-align: top;
}

.panel-table th {
  width: 170px;
  color: var(--light-main);
  background: var(--accent);
  text-align: left;
}

.journal-entry {
  border: 2px groove var(--line);
  background: var(--light-main);
  padding: 10px;
  margin-bottom: 10px;
}

.journal-entry h3 {
  font-family: "Jacquarda Bastarda 9", "Press Start 2P", monospace;
  font-size: 20px;
  margin: 0 0 8px;
  color: var(--warm);
  text-shadow: none;
  letter-spacing: 0.5px;
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.portal-card {
  display: block;
  position: relative;
  border: 2px outset var(--line);
  background: var(--light-secondary);
  padding: 10px 90px 12px 10px;
  min-height: 170px;
  text-decoration: none;
  color: var(--text-main);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 3px 3px 0 rgba(120, 161, 156, 0.35);
}

.portal-card:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 rgba(134, 133, 192, 0.35);
  background: var(--surface);
  color: var(--text-main);
}

.portal-card h3 {
  margin: 0 0 8px;
  font-family: "Jacquarda Bastarda 9", "Press Start 2P", monospace;
  font-size: 22px;
  color: var(--warm);
  text-shadow: none;
  letter-spacing: 0.5px;
}

.portal-card p {
  margin: 0 0 10px;
  color: var(--text-alt);
}

.portal-status {
  display: inline-block;
  border: 1px solid var(--accent);
  background: var(--light-main);
  color: var(--text-main);
  padding: 2px 6px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  letter-spacing: 0.4px;
}

.portal-icon {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 80px;
  height: 80px;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}



.retro-card {
  border: 2px inset var(--line);
  background: var(--light-secondary);
  padding: 10px;
}

.retro-card h3 {
  font-family: "Jacquarda Bastarda 9", "Press Start 2P", monospace;
  font-size: 22px;
  margin-top: 0;
  color: var(--warm);
  text-shadow: none;
  letter-spacing: 0.5px;
}

.retro-card ul {
  margin: 0;
  padding-left: 20px;
}

.guestbook-list {
  margin: 10px 0 14px;
  padding-left: 20px;
}

.guestbook-list li {
  margin-bottom: 8px;
  color: var(--text-main);
}

.tiny-note {
  font-size: 22px;
  color: var(--text-alt);
}

.small {
  font-size: 23px;
}

/* Light-mode manuscript accents */
html[data-theme="light"] .main-col > section {
  position: relative;
  border-color: rgba(120, 96, 60, 0.7);
  box-shadow:
    5px 5px 0 rgba(150, 178, 160, 0.35),
    inset 0 0 0 1px rgba(120, 96, 60, 0.35);
}

html[data-theme="light"] .main-col > section::before,
html[data-theme="light"] .main-col > section::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  border-color: rgba(120, 96, 60, 0.7);
  border-style: solid;
}

html[data-theme="light"] .main-col > section::before {
  top: 6px;
  left: 6px;
  border-width: 2px 0 0 2px;
}

html[data-theme="light"] .main-col > section::after {
  right: 6px;
  bottom: 6px;
  border-width: 0 2px 2px 0;
}

html[data-theme="light"] .main-col > section > h2 {
  position: relative;
  padding-bottom: 16px;
}

html[data-theme="light"] .main-col > section > h2::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 5px;
  height: 3px;
  background:
    linear-gradient(to right, transparent 0%, rgba(244, 243, 239, 0.95) 15%, rgba(244, 243, 239, 0.95) 85%, transparent 100%),
    repeating-linear-gradient(to right, transparent 0 8px, rgba(244, 243, 239, 0.9) 8px 12px);
}

html[data-theme="light"] #about p:first-of-type::first-letter {
  float: left;
  margin: 2px 8px 0 0;
  font-family: "Jacquarda Bastarda 9", "Press Start 2P", monospace;
  font-size: 3.1em;
  line-height: 0.78;
  color: var(--warm);
  text-shadow: 1px 1px 0 var(--light-main);
}

@media (max-width: 800px) {
  .desktop-nav-links {
    display: none;
  }

  .mobile-nav-list {
    display: block;
  }

  .stamp-box,
  .status-box,
  .link-box {
    display: none;
  }

  .left-col,
  .main-col,
  table.layout,
  table.layout tbody,
  table.layout tr,
  table.layout td {
    display: block;
    width: 100%;
  }

  .left-col {
    border-bottom: 2px solid var(--accent);
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .header-grid {
    grid-template-columns: 1fr;
  }

  .header-corner-deco {
    width: 84px;
    top: 0;
    right: 0;
  }

  .favorites-grid {
    grid-template-columns: 1fr;
  }

  .portal-grid {
    grid-template-columns: 1fr;
  }

  .button-strip {
    grid-template-columns: 1fr;
  }

  body {
    font-size: 25px;
  }

  html[data-theme="light"] #about p:first-of-type::first-letter {
    font-size: 2.4em;
    margin-top: 0;
  }
}

/* ── Dark mode explicit overrides (hardcoded rgba/gradients) ── */
html[data-theme="dark"] .main-col {
  background: #0f2239;
}

html[data-theme="dark"] .main-col > section {
  background: #152d45;
  border-color: #2a3f56;
  box-shadow: 5px 5px 0 rgba(42, 63, 86, 0.6);
}

html[data-theme="dark"] a:hover {
  color: #e1cfd5;
  background: #152d45;
}
