/* ==========================================================
   Retro Web Revival Theme (early‑2000s vibe, modern semantics)
   ========================================================== */

/* --- Palette tokens (see report table) --- */
:root {
  --bg: #050014;
  --panel: #0b1a33;
  --panel2: #081024;
  --text: #e7f2ff;
  --muted: #b9c7dd;

  --link: #00a2ff;
  --visited: #d16bff;
  --accent: #44ff88;
  --warn: #ffcc00;
  --hot: #ff4d6d;

  --bevel-light: #c9d6ff;
  --bevel-mid: #7f93c8;
  --bevel-dark: #0b0b18;

  --maxw: 980px;
}

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

html {
  /* Font-size left default to respect user preferences */
  color-scheme: dark;
}

body {
  margin: 0;
  color: var(--text);

  /* Retro font stack: pixel/terminal feel first, then safe fallbacks */
  font-family: "VT323", "Courier New", Courier, monospace;
  letter-spacing: 0.2px;

  /* Tiled background vibe (CSS-generated “pattern”) */
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(68, 255, 136, 0.08) 0px,
      rgba(68, 255, 136, 0.08) 1px,
      transparent 1px,
      transparent 5px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(0, 162, 255, 0.06) 0px,
      rgba(0, 162, 255, 0.06) 1px,
      transparent 1px,
      transparent 7px
    );
}

a {
  color: var(--link);
}

a:visited {
  color: var(--visited);
}

/* Strong focus cue “fits the era” (chunky + high contrast) */
:focus-visible {
  outline: 3px dashed var(--accent);
  outline-offset: 3px;
}

/* Skip link: hidden until focus */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  padding: 0.75rem 1rem;
  background: var(--warn);
  color: #000;
  font-family: "Silkscreen", system-ui, sans-serif;
  z-index: 9999;
}

.skip-link:focus {
  left: 0.75rem;
  top: 0.75rem;
}

/* Layout container */
.site-header,
.site-main,
.site-footer {
  width: min(var(--maxw), calc(100% - 2rem));
  margin-inline: auto;
}

/* Header */
.site-header {
  padding: 1rem 0 0.75rem;
}

.masthead {
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0.12));
  border: 3px solid var(--bevel-mid);
  box-shadow:
    0 0 0 2px var(--bevel-dark),
    0 0 0 4px rgba(255, 255, 255, 0.08);
}

.kicker {
  margin: 0 0 0.5rem;
  color: var(--muted);
}

.site-title {
  margin: 0;
  font-family: "Silkscreen", system-ui, sans-serif;
  font-size: clamp(1.25rem, 2.5vw, 1.9rem);
  letter-spacing: 1px;
}

/* Nav bar */
.site-nav {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  padding: 0.75rem 0;

  border-top: 2px solid rgba(255,255,255,0.18);
}

.site-nav a {
  text-decoration: none;
  padding: 0.35rem 0.75rem;

  background: var(--panel);
  border: 2px solid var(--bevel-mid);

  /* Faux bevel */
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,0.18),
    inset -2px -2px 0 rgba(0,0,0,0.45);
}

.site-nav a[aria-current="page"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* Marquee (decorative) */
.marquee {
  margin-top: 0.75rem;
  border: 2px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
  padding: 0.25rem 0.5rem;
}

.marquee__sr {
  /* Screen-reader-only text */
  position: absolute;
  left: -9999px;
}

.marquee__viewport {
  overflow: hidden;
  white-space: nowrap;
}

.marquee__track {
  display: inline-flex;
  gap: 2rem;
  will-change: transform;
  animation: marquee 14s linear infinite;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Window / panel */
.window {
  margin: 1.25rem 0;
  background: var(--panel);
  border: 3px solid var(--bevel-mid);
  box-shadow:
    0 0 0 2px var(--bevel-dark),
    inset 2px 2px 0 rgba(255,255,255,0.16),
    inset -2px -2px 0 rgba(0,0,0,0.45);
}

.window__titlebar {
  padding: 0.5rem 0.75rem;
  background: linear-gradient(90deg, rgba(0,162,255,0.35), rgba(255,77,109,0.20));
  border-bottom: 2px solid rgba(255,255,255,0.2);
}

.window__titlebar h2 {
  margin: 0;
  font-family: "Silkscreen", system-ui, sans-serif;
  font-size: 1rem;
}

.window__body {
  padding: 0.85rem 0.9rem 1rem;
  background: var(--panel2);
}

.note {
  margin: 0.75rem 0;
  padding: 0.6rem 0.75rem;
  border-left: 5px solid var(--warn);
  background: rgba(255, 204, 0, 0.12);
  color: var(--muted);
}

.warning {
  margin: 0.75rem 0;
  padding: 0.6rem 0.75rem;
  border-left: 5px solid var(--hot);
  background: rgba(255, 77, 109, 0.12);
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.8rem;
  align-items: center;
  margin: 0.75rem 0 0.5rem;
}

.controls button {
  font-family: "Silkscreen", system-ui, sans-serif;
  padding: 0.45rem 0.75rem;
  background: rgba(0,0,0,0.35);
  color: var(--text);
  border: 2px solid var(--bevel-mid);
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,0.16),
    inset -2px -2px 0 rgba(0,0,0,0.45);
  cursor: pointer;
}

.controls button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.file-label,
.small-field,
.toggle {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  color: var(--muted);
}

.file-label input[type="file"] {
  max-width: 16rem;
}

/* Drop zone */
.drop-zone {
  margin: 0.75rem 0;
  padding: 0.85rem;
  border: 2px dashed rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.25);
}

.drop-zone.is-dragover {
  border-color: var(--accent);
  background: rgba(68, 255, 136, 0.10);
}

/* Status text */
.status {
  margin: 0.5rem 0 0.25rem;
  color: var(--muted);
}

/* Image grid */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  padding: 0.75rem 0 0.25rem;
}

.image-tile {
  margin: 0;
  background: rgba(0,0,0,0.25);
  border: 2px solid rgba(255,255,255,0.18);
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,0.12),
    inset -2px -2px 0 rgba(0,0,0,0.35);
  overflow: hidden;
}

.image-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  image-rendering: pixelated;
  background: rgba(0,0,0,0.35);
}

.image-tile figcaption {
  padding: 0.35rem 0.5rem;
  font-size: 0.95rem;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,0.12);
}

/* Projects grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
}

.project-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  padding: 0.75rem;
  border: 2px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.18);
}

.project-figure {
  margin: 0;
}

.project-figure img {
  width: 100%;
  height: auto;
  display: block;
  border: 2px solid rgba(255,255,255,0.14);
}

.project-body h3 {
  margin: 0.25rem 0 0.35rem;
  font-family: "Silkscreen", system-ui, sans-serif;
  font-size: 1rem;
}

.small {
  font-size: 0.95rem;
  color: var(--muted);
}

.tag {
  padding: 0.1rem 0.35rem;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(0,0,0,0.25);
}

.tag--hot { color: var(--hot); border-color: rgba(255, 77, 109, 0.35); }
.tag--ok  { color: var(--accent); border-color: rgba(68, 255, 136, 0.35); }
.tag--warn { color: var(--warn); border-color: rgba(255, 204, 0, 0.35); }

/* Blinkie */
.blink {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  margin-right: 0.35rem;
  color: #000;
  background: var(--hot);
  font-family: "Silkscreen", system-ui, sans-serif;
  animation: blink 1s steps(2, end) infinite;
}

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

/* Motion controls: honour user preference + manual toggle */
@media (prefers-reduced-motion: reduce) {
  .marquee__track,
  .blink {
    animation: none !important;
  }
}

body.motion-off .marquee__track,
body.motion-off .blink {
  animation: none !important;
}

/* Footer */
.site-footer {
  padding: 1.25rem 0 2rem;
  border-top: 2px solid rgba(255,255,255,0.18);
  margin-top: 1.5rem;
}

/* ==========================================================
   GIFs page additions (retro directory listing + dialog skin)
   Append this to the end of style.css
   ========================================================== */

.gif-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.8rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.table-scroller {
  overflow-x: auto;
  border: 2px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.18);
}

/* Directory listing look */
.gif-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px; /* allows horizontal scroll on small screens */
}

.gif-table th,
.gif-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  vertical-align: middle;
}

.gif-table thead th {
  position: sticky;
  top: 0;
  background: rgba(0,0,0,0.45);
  border-bottom: 2px solid rgba(255,255,255,0.18);
  font-family: "Silkscreen", system-ui, sans-serif;
  font-size: 0.9rem;
}

.gif-thumb {
  width: 80px;
  height: 60px;
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
  border: 2px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.35);
}

.gif-cell-name code {
  display: inline-block;
  max-width: 24ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gif-input {
  width: 18ch;
  max-width: 100%;
  font-family: "VT323", "Courier New", monospace;
  padding: 0.15rem 0.3rem;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--text);
}

.gif-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* Preview area (used by dialog and inline fallback) */
.gif-preview {
  display: grid;
  gap: 0.75rem;
  align-items: start;
}

.gif-preview canvas,
.gif-preview img {
  width: 100%;
  max-width: 520px;
  height: auto;
  border: 2px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.22);
}

/* Hide the animated image until it has a src set */
.gif-preview img {
  width: auto;
  max-width: min(100%, 256px);
  height: auto;
  image-rendering: pixelated;
  border: 2px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.22);
}

.code-block {
  background: rgba(0,0,0,0.4);
  border: 2px solid var(--bevel-mid);
  padding: 0.5rem;
  font-family: monospace;
  font-size: 0.85rem;
  overflow-x: auto;
}

/* Retro dialog skin */
.retro-dialog {
  padding: 0;
  border: 3px solid var(--bevel-mid);
  background: var(--panel);
  box-shadow: 0 0 0 2px var(--bevel-dark);
}

.retro-dialog::backdrop {
  background: rgba(0,0,0,0.65);
}

.retro-dialog__frame {
  margin: 0;
  padding: 0;
}

.retro-dialog__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(90deg, rgba(0,162,255,0.35), rgba(255,77,109,0.20));
  border-bottom: 2px solid rgba(255,255,255,0.2);
}

.retro-dialog__title {
  margin: 0;
  font-family: "Silkscreen", system-ui, sans-serif;
  font-size: 1rem;
}

.retro-dialog__close {
  font-family: "Silkscreen", system-ui, sans-serif;
  padding: 0.25rem 0.5rem;
  background: rgba(0,0,0,0.35);
  color: var(--text);
  border: 2px solid var(--bevel-mid);
  cursor: pointer;
}

.retro-dialog__body {
  padding: 0.85rem 0.9rem 1rem;
  background: var(--panel2);
}