/* kassidy.dev — PS2 aurora: dark, thin, quiet */

:root {
  --bg: #030309;
  --bg-raise: #0a0b16;
  --fg: #dfe3f0;
  --fg-dim: #868da6;
  --indigo: #8a9aff;
  --indigo-glow: rgba(110, 130, 255, 0.55);
  --violet: #b48aff;
  --line: #1b1e33;
  --sans: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.7;
}

/* static mist tint on interior pages — mood without motion.
   A fixed pseudo-element instead of background-attachment: fixed,
   which forces repaints on every scroll frame. */
body:not(.home)::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 40% at 20% 0%, rgba(55, 75, 210, 0.1), transparent 70%),
    radial-gradient(50% 35% at 85% 10%, rgba(110, 55, 205, 0.07), transparent 70%);
}

::selection {
  background: var(--indigo);
  color: var(--bg);
}

/* --- nav --- */

nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  letter-spacing: 0.14em;
  text-transform: lowercase;
}

nav a {
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.25s, text-shadow 0.25s;
}

nav a:hover {
  color: var(--fg);
  text-shadow: 0 0 14px var(--indigo-glow);
}

nav .brand {
  color: var(--fg);
  font-weight: 400;
  text-shadow:
    -1px 0 rgba(255, 70, 120, 0.25),
    1px 0 rgba(80, 220, 255, 0.25),
    0 0 12px rgba(110, 130, 255, 0.35);
}

nav .links {
  display: flex;
  gap: 1.75rem;
}

/* --- layout --- */

main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
}

/* --- typography --- */

h1,
h2,
h3 {
  line-height: 1.3;
  font-weight: 200;
  letter-spacing: 0.08em;
  color: #f0f2fa;
}

h1 {
  font-size: 1.7rem;
  /* composite-video chroma fringing rides along with the glow */
  text-shadow:
    -1px 0 rgba(255, 70, 120, 0.3),
    1px 0 rgba(80, 220, 255, 0.3),
    0 0 18px var(--indigo-glow);
}

h2 {
  font-size: 1.3rem;
}

a {
  color: var(--indigo);
  text-decoration: underline;
  text-decoration-color: rgba(138, 154, 255, 0.35);
  text-underline-offset: 3px;
  transition: text-shadow 0.25s;
}

a:hover {
  text-decoration-color: var(--indigo);
  text-shadow: 0 0 12px var(--indigo-glow);
}

.meta {
  color: var(--fg-dim);
  margin-top: -0.5rem;
  letter-spacing: 0.06em;
  font-size: 0.9rem;
}

.tag {
  color: var(--violet);
}

.tag::before {
  content: "#";
  opacity: 0.55;
}

/* --- post list — PS2 save-data entries --- */

.post-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
}

.post-list li {
  margin-bottom: 0.9rem;
}

.post-list a {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 0.55rem 0.75rem;
  text-decoration: none;
  border-radius: 10px;
  transition: transform 0.2s ease, background 0.2s ease;
}

/* the save icon: day number in a mini memory-card tile */
.save-icon {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 9px;
  border: 1px solid rgba(138, 154, 255, 0.22);
  border-top-color: rgba(240, 242, 250, 0.3);
  background: linear-gradient(
    165deg,
    rgba(95, 115, 240, 0.3) 0%,
    rgba(95, 115, 240, 0.3) 20%,
    rgba(50, 62, 165, 0.26) 25%,
    rgba(50, 62, 165, 0.26) 46%,
    rgba(24, 27, 62, 0.45) 51%,
    rgba(24, 27, 62, 0.45) 72%,
    rgba(8, 9, 20, 0.8) 77%
  );
  box-shadow:
    inset 0 1px 0 rgba(240, 242, 250, 0.12),
    0 4px 14px rgba(55, 75, 210, 0.15);
  transition: box-shadow 0.25s, border-color 0.25s, transform 0.25s;
}

.save-icon .day {
  font-weight: 200;
  font-size: 1.35rem;
  line-height: 1;
  color: #f0f2fa;
  text-shadow: 0 0 10px var(--indigo-glow);
}

.save-icon .mon {
  margin-top: 0.2rem;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: var(--fg-dim);
}

.save-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.save-title {
  font-weight: 400;
  color: var(--fg);
  transition: color 0.2s, text-shadow 0.2s;
}

.post-list .summary {
  margin: 0;
  color: var(--fg-dim);
  font-size: 0.88rem;
}

.save-year {
  margin-left: auto;
  flex: none;
  color: var(--fg-dim);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
}

/* selection — slide right and light up, like the browser picking a save */
.post-list a:hover {
  transform: translateX(8px);
  background: rgba(110, 130, 255, 0.05);
}

.post-list a:hover .save-icon {
  border-color: rgba(200, 210, 255, 0.55);
  transform: scale(1.05);
  box-shadow:
    inset 0 1px 0 rgba(240, 242, 250, 0.18),
    0 0 22px rgba(110, 130, 255, 0.4);
}

.post-list a:hover .save-title {
  color: #fff;
  text-shadow: 0 0 12px var(--indigo-glow);
}

@media (max-width: 480px) {
  .save-year {
    display: none;
  }
}

/* --- code --- */

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

pre {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  line-height: 1.55;
  box-shadow: 0 0 24px rgba(55, 75, 210, 0.08);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85em;
}

blockquote {
  margin: 1rem 0;
  padding: 0.1rem 1rem;
  border-left: 2px solid var(--violet);
  color: var(--fg-dim);
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.5rem auto;
  width: 60%;
}

img {
  max-width: 100%;
}

table {
  border-collapse: collapse;
}

th,
td {
  border: 1px solid var(--line);
  padding: 0.35rem 0.7rem;
}

/* --- contact — PS2 browser items: objects floating in space --- */

.browser-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3rem;
  margin: 3rem 0 2rem;
}

.browser-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  transition: transform 0.25s;
}

/* the floating card object */
.browser-item .card {
  position: relative;
  display: grid;
  place-items: center;
  width: 7.5rem;
  height: 5rem;
  border: 1px solid rgba(138, 154, 255, 0.22);
  border-top-color: rgba(240, 242, 250, 0.3);
  border-radius: 10px;
  /* banded, not smooth — PS2 gradients dithered in steps (softened) */
  background: linear-gradient(
    165deg,
    rgba(95, 115, 240, 0.3) 0%,
    rgba(95, 115, 240, 0.3) 18%,
    rgba(50, 62, 165, 0.26) 23%,
    rgba(50, 62, 165, 0.26) 43%,
    rgba(24, 27, 62, 0.45) 48%,
    rgba(24, 27, 62, 0.45) 70%,
    rgba(8, 9, 20, 0.8) 75%
  );
  box-shadow:
    inset 0 1px 0 rgba(240, 242, 250, 0.12),
    0 6px 24px rgba(55, 75, 210, 0.18);
  animation: bob 6s ease-in-out infinite alternate;
  transition: box-shadow 0.25s, border-color 0.25s;
}

/* memory-card connector slots */
.browser-item .card::after {
  content: "";
  position: absolute;
  bottom: 0.6rem;
  left: 50%;
  width: 2.4rem;
  height: 0.4rem;
  transform: translateX(-50%);
  background: repeating-linear-gradient(
    to right,
    rgba(110, 130, 255, 0.55) 0 0.25rem,
    transparent 0.25rem 0.45rem
  );
  border-radius: 2px;
  opacity: 0.7;
}

/* drift out of phase, like items in the browser grid */
.browser-item:nth-child(2) .card {
  animation-delay: -3s;
}

@keyframes bob {
  from {
    transform: translateY(-5px);
  }
  to {
    transform: translateY(5px);
  }
}

.browser-item .glyph {
  font-weight: 100;
  font-size: 1.9rem;
  color: #f0f2fa;
  letter-spacing: 0.05em;
  text-shadow:
    -1px 0 rgba(255, 70, 120, 0.35),
    1px 0 rgba(80, 220, 255, 0.35),
    0 0 16px var(--indigo-glow);
}

/* selection — brighten, like highlighting an item in the browser */
.browser-item:hover {
  transform: scale(1.06);
}

.browser-item:hover .card {
  border-color: rgba(200, 210, 255, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(240, 242, 250, 0.18),
    0 0 30px rgba(110, 130, 255, 0.45);
}

.browser-item .label {
  color: var(--fg-dim);
  font-weight: 300;
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  transition: color 0.25s, text-shadow 0.25s;
}

.browser-item:hover .label {
  color: #f0f2fa;
  text-shadow: 0 0 14px var(--indigo-glow);
}

.contact-note {
  text-align: center;
  color: var(--fg-dim);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
}

@media (prefers-reduced-motion: reduce) {
  .browser-item .card {
    animation: none;
  }
}

/* --- nostalgia goggles: the CRT between the PS2 and your face --- */

.crt {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  border-radius: 1.5rem;
  background:
    /* aperture grille: faint RGB phosphor stripes */
    repeating-linear-gradient(
      to right,
      rgba(255, 60, 110, 0.03) 0 1px,
      rgba(60, 255, 160, 0.022) 1px 2px,
      rgba(70, 140, 255, 0.03) 2px 3px,
      transparent 3px 4px
    ),
    /* scanlines: 480i */
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.13) 0 1px,
      transparent 1px 3px
    ),
    /* glass vignette — the tube curves away at the edges */
    radial-gradient(
      125% 125% at 50% 50%,
      transparent 58%,
      rgba(0, 0, 0, 0.42) 100%
    );
}

/* static — composite video never sat still */
.crt::before {
  content: "";
  position: absolute;
  inset: -10%; /* small bleed — the jitter is only ±2% */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.055;
  mix-blend-mode: overlay;
  animation: grain 0.7s steps(1, end) infinite;
}

@keyframes grain {
  0% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-1.5%, 1%);
  }
  40% {
    transform: translate(1%, -1.5%);
  }
  60% {
    transform: translate(-1%, 2%);
  }
  80% {
    transform: translate(2%, -1%);
  }
  100% {
    transform: translate(0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .crt::before {
    animation: none;
  }
}
