/* Clean blue page with green highlights */

@font-face {
  font-family: "Pixelated MS Sans Serif";
  src:
    url("/fonts/ms_sans_serif.woff2") format("woff2"),
    url("/fonts/ms_sans_serif.woff") format("woff");
  font-weight: normal;
}

:root {
  color-scheme: dark;
  --bg: #0f2947;
  --surface: rgba(17, 82, 146, 0.14);
  --surface-strong: rgba(17, 82, 146, 0.22);
  --text: #000000;
  --muted: #000;
  --accent: --AliceBlue;
  --accent-strong: #3c9c56;
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
}

:root {
  --teal: #1fb8a6;
  --blue: #2b6fd6;
  --purple: #7b3fd4;
  --black: #000000;
  --dark_gray: #231a36;
  --gray_blue: #65548a;
  --cycle: 9s; /* one full teal->blue->purple->blue->teal loop */
}

/* The grid sits fixed behind all page content */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: grid;
  grid-template-columns: repeat(17, 1fr);
  grid-template-rows: repeat(8, 1fr);
}

.bg-grid .cell {
  /* borderless: no border, no gap, cells butt up against each other */
  animation: colorLoop var(--cycle) ease-in-out infinite;
  /* Negative delay = start mid-animation. Sum of prime-cycle offsets
       below makes every cell begin at a different point in the loop. */
  animation-delay: calc(
    var(--d2, 0s) + var(--d3, 0s) + var(--d5, 0s) + var(--d7, 0s) +
      var(--d11, 0s) + var(--d13, 0s)
  );
}

/* -------- pseudo-random desync via overlapping prime cycles --------
     Each rule assigns a different offset on a different prime period.
     Because the periods are coprime, the summed delays don't repeat
     within the 136 cells, so neighbors are never in sync. */
.bg-grid .cell:nth-child(2n) {
  --d2: -3.1s;
}
.bg-grid .cell:nth-child(3n) {
  --d3: -6.7s;
}
.bg-grid .cell:nth-child(3n + 1) {
  --d3: -11.4s;
}
.bg-grid .cell:nth-child(5n) {
  --d5: -8.9s;
}
.bg-grid .cell:nth-child(5n + 2) {
  --d5: -2.3s;
}
.bg-grid .cell:nth-child(5n + 3) {
  --d5: -15.8s;
}
.bg-grid .cell:nth-child(7n) {
  --d7: -4.6s;
}
.bg-grid .cell:nth-child(7n + 3) {
  --d7: -12.2s;
}
.bg-grid .cell:nth-child(7n + 5) {
  --d7: -7.7s;
}
.bg-grid .cell:nth-child(11n) {
  --d11: -9.3s;
}
.bg-grid .cell:nth-child(11n + 4) {
  --d11: -5.1s;
}
.bg-grid .cell:nth-child(13n) {
  --d13: -1.9s;
}
.bg-grid .cell:nth-child(13n + 6) {
  --d13: -10.6s;
}

/* -------- the color loop --------
     teal -> blue -> purple -> blue -> teal
     ease-in-out between each keyframe keeps transitions smooth. */
@keyframes colorLoop {
  0% {
    background-color: #091db3;
  }
  25% {
    background-color: #081682;
  }
  50% {
    background-color: #020830;
  }
  75% {
    background-color: #081682;
  }
  100% {
    background-color: #091db3;
  }
}

html,
body {
  min-height: 100%;
  margin: 0;
  font-family: "Pixelated MS Sans Serif";
  color: var(--text);
}

body {
  line-height: 1.7;
  padding: 2rem;
  background-attachment: fixed;
}

body > * {
  margin-left: auto;
  margin-right: auto;
}

h1,
h2,
h3,
h4 {
  margin: 1.4rem 0 0.6rem;
  color: #000;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(6.4rem, 4vw, 3.6rem);
  text-align: center;
}

h2 {
  text-align: center;
}

p {
  font-family: sans-serif;
}

#floated {
  float: left;
  width: 250px;
}

p,
em,
footer,
li,
span {
  color: var(--muted);
}

/* One size for all body text: paragraphs, lists, and table cells */
p,
li,
td,
th {
  font-size: 1.2rem;
}

p {
  margin: 0 0 1.4rem;
}

em {
  display: inline-block;
  margin-bottom: 1.6rem;
  color: var(--accent);
  font-style: normal;
}

body a {
  color: #081682;
  text-decoration: none;
  font-weight: 600;
}

body a:hover {
  color: #b3ffd8;
}

a,
button {
  transition:
    transform 0.2s ease,
    color 0.2s ease,
    background-color 0.2s ease;
}

a:hover,
button:hover {
  transform: translateY(-1px);
}

.container {
  max-width: 840px;

  background: teal;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(15px);
}

body > .container {
  padding-top: 2.4rem;
  padding-bottom: 2.4rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2rem 0 1rem;
}

.tab-button {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
}

.tab-button.active {
  background: var(--accent);
  color: #062213;
  border-color: var(--accent);
}

.tab-panel {
  display: none;
  animation: fadeIn 0.2s ease;
}

.tab-panel.active {
  display: block;
}

.profile-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 1rem 1.2rem;
  margin: 1rem 0 1.6rem;
  border: 1px dashed var(--accent);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(85, 197, 122, 0.08);
}

section {
  margin-top: 1rem;
}

h1 + em,
section em {
  color: var(--accent);
}

blockquote,
code,
pre {
  color: var(--text);
}

::selection {
  background: rgba(85, 197, 122, 0.27);
  color: #fff;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  body {
    padding: 1.4rem;
  }

  .container {
    padding: 1.6rem;
    border-radius: 22px;
  }

  .tabs {
    flex-direction: column;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6rem 0;
}

th,
td {
  padding: 0.8rem 1.2rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface-strong);
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.02em;
}

td {
  color: var(--muted);
}

tr:hover {
  background: var(--surface);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.2rem;
}

td img {
  max-width: 200px;
  max-height: 200px;
  margin: 0;
}

ul {
  /* font-family: "Pixelated MS Sans Serif"; */
  font-size: 1.2rem;
}

/* -------- Bigger fonts everywhere except <p> --------
   These need to out-rank xp.css (loaded after this file), hence
   the `body` prefix / attribute selectors for extra specificity.
   <p> keeps its own explicit sizes and is unaffected. */
body .window {
  font-size: 1.2rem; /* xp.css: 11px — inherited by tables, cells, etc. */
}

body .title-bar {
  font-size: 1.1rem; /* xp.css: 13px */
}

body h2 {
  font-size: 3rem; /* xp.css: 2.5rem */
}

menu[role="tablist"] button {
  font-size: 1.1rem; /* xp.css button: 11px */
}

/* The intro image is floated left; without clearing, the tablist
   can slide up beside it when the intro text is short. */
menu[role="tablist"] {
  clear: both;
}

.links {
  font-size: 2rem; /* was inline xx-large; rem so it scales on mobile */
}

/* Rainbow flash — standalone class, apply to any element */
.rainbow-flash {
  font-size: 3rem;
  animation: rainbowFlash 2.5s linear infinite;
}

@keyframes rainbowFlash {
  0% {
    color: #e00000;
  }
  14% {
    color: #e07000;
  }
  28% {
    color: #c8a800;
  }
  42% {
    color: #00a000;
  }
  57% {
    color: #0040e0;
  }
  71% {
    color: #4b0082;
  }
  85% {
    color: #8f00ff;
  }
  100% {
    color: #e00000;
  }
}

/* Mobile responsiveness */
.mobile-name {
  display: none;
}

/* Mobile-only project list in the Software section */
.software-list {
  display: none;
}

.ascii-name {
  display: block;
}

@media (max-width: 768px) {
  /* Scale all rem-based text to 70% of its desktop size */
  html {
    font-size: 70%;
  }

  .mobile-name {
    display: block;
    margin: 0 0 1rem;
  }

  /* Photo on its own line, text always below it (no wrapping) */
  #floated {
    float: none;
    width: 160px;
    margin: 0 auto 1.2rem;
  }

  .ascii-name {
    display: none;
  }

  body > .window {
    max-width: 100% !important;
    width: 100%;
    margin: 0;
  }

  .window-body {
    min-height: 100vh;
  }

  .title-bar {
    display: none;
  }

  /* No tabs on mobile: hide the tab bar and show every
     panel stacked one after the other (overrides [hidden]).
     !important needed because xp.css loads after this file
     and sets display: flex at equal specificity. */
  menu[role="tablist"] {
    display: none !important;
  }

  article[role="tabpanel"][hidden] {
    display: block;
  }

  th,
  td {
    padding: 0.5rem 0.8rem;
  }

  /* Software section: swap the table for the plain bulleted list */
  .software-list {
    display: block;
  }

  #software table {
    display: none;
  }
}
