/* ==========================================================
   izwansalim.com fun pack
   Day mode = clean daylight. Night mode = Night City.
   ========================================================== */

:root {
  --fun-bg: #f7f6fb;
  --fun-surface: #ffffff;
  --fun-ink: #1a1530;
  --fun-muted: #5e5778;
  --fun-line: #dcd8ea;
  --fun-hot: #c8004c;      /* magenta, darkened for contrast on light */
  --fun-cool: #006a8a;     /* cyan, darkened */
  --fun-signal: #8a7d00;   /* yellow, darkened */
  --fun-ok: #127a3e;
  --fun-display: "Chakra Petch", "Arial Narrow", system-ui, sans-serif;
  --fun-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fun-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

html.dark {
  --fun-bg: #140b24;
  --fun-surface: #1f1236;
  --fun-ink: #ede9f7;
  --fun-muted: #a99cc7;
  --fun-line: #3a2a5c;
  --fun-hot: #ff2a6d;
  --fun-cool: #05d9e8;
  --fun-signal: #f3e600;
  --fun-ok: #39ff88;
  color-scheme: dark;
}

/* ---------- Theme toggle ---------- */
.fun-toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .75rem;
  border: 1px solid var(--fun-line);
  border-radius: 999px;
  background: var(--fun-surface);
  color: var(--fun-ink);
  font: 600 .85rem/1 var(--fun-display);
  letter-spacing: .02em;
  cursor: pointer;
}
.fun-toggle:hover { border-color: var(--fun-hot); }
.fun-toggle:focus-visible,
.fun-badge:focus-visible,
.fun-btn:focus-visible,
.fun-term input:focus-visible {
  outline: 2px solid var(--fun-cool);
  outline-offset: 3px;
}
.fun-toggle__icon {
  width: 1rem; height: 1rem;
  border-radius: 50%;
  background: var(--fun-signal);
  box-shadow: inset -.3rem -.15rem 0 0 var(--fun-surface);
  transition: box-shadow .3s ease, background .3s ease;
}
html:not(.dark) .fun-toggle__icon { box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--fun-signal) 30%, transparent); }

/* ---------- Deploy badge ---------- */
.fun-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font: .8rem/1.4 var(--fun-body);
  color: var(--fun-muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: default;
}
.fun-badge__dot {
  width: .55rem; height: .55rem;
  border-radius: 50%;
  background: var(--fun-ok);
  box-shadow: 0 0 0 0 var(--fun-ok);
  animation: fun-pulse 2.4s ease-out infinite;
  flex: none;
}
.fun-badge code { font-family: var(--fun-mono); color: var(--fun-ink); }
.fun-badge__friday { color: var(--fun-hot); }
@keyframes fun-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--fun-ok) 60%, transparent); }
  70%, 100% { box-shadow: 0 0 0 .5rem transparent; }
}

/* ---------- Konami hint (footer controller icon) ---------- */
.fun-hint {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 1.15rem; height: 1.15rem;
  color: var(--fun-muted);
  opacity: .45;
  cursor: help;
  transition: opacity .2s ease, color .2s ease;
}
.fun-hint svg { width: 100%; height: 100%; }
.fun-hint:hover,
.fun-hint:focus-visible { opacity: 1; color: var(--fun-hot); outline: none; }
.fun-hint__tip {
  position: absolute;
  bottom: calc(100% + .5rem);
  left: 50%;
  transform: translate(-50%, .25rem);
  padding: .35rem .6rem;
  border-radius: .4rem;
  background: var(--fun-ink);
  color: var(--fun-bg);
  font: 600 .75rem/1.2 var(--fun-mono);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.fun-hint:hover .fun-hint__tip,
.fun-hint:focus-visible .fun-hint__tip { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Konami glitch overlay ---------- */
.fun-glitch {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: #140b24;
  color: #ede9f7;
  font: 700 clamp(1.6rem, 6vw, 4rem)/1.1 var(--fun-display);
  text-align: center;
  padding: 2rem;
  animation: fun-flicker .9s steps(2) 2;
}
.fun-glitch span { display: block; font: 400 1rem/1.5 var(--fun-mono); color: #05d9e8; margin-top: 1rem; }
.fun-glitch::before,
.fun-glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 2rem;
  pointer-events: none;
}
.fun-glitch::before { color: #ff2a6d; transform: translate(3px, -2px); mix-blend-mode: screen; clip-path: inset(10% 0 55% 0); }
.fun-glitch::after  { color: #f3e600; transform: translate(-3px, 2px); mix-blend-mode: screen; clip-path: inset(60% 0 10% 0); }
@keyframes fun-flicker { 50% { filter: hue-rotate(90deg) contrast(1.4); } }

/* ---------- Shared page shell (now, terminal, 404) ---------- */
.fun-page {
  margin: 0;
  min-height: 100vh;
  background: var(--fun-bg);
  color: var(--fun-ink);
  font: 1rem/1.65 var(--fun-body);
}
.fun-shell { max-width: 44rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.fun-topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; margin-bottom: 3rem;
}
.fun-home { font: 700 1.05rem/1 var(--fun-display); color: var(--fun-ink); text-decoration: none; }
.fun-home:hover { color: var(--fun-hot); }
.fun-page a { color: var(--fun-cool); }
.fun-footer { margin-top: 4rem; padding-top: 1.25rem; border-top: 1px solid var(--fun-line); }
.fun-btn {
  display: inline-block;
  padding: .7rem 1.2rem;
  background: var(--fun-hot);
  color: #fff !important;
  font: 600 .95rem/1 var(--fun-display);
  text-decoration: none;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 92% 100%, 0 100%);
}
.fun-btn:hover { background: var(--fun-ink); color: var(--fun-bg) !important; }

/* ---------- 404 ---------- */
.fun-404 { padding-top: 8vh; }
.fun-404__code {
  font: 700 clamp(6rem, 28vw, 14rem)/.85 var(--fun-display);
  margin: 0;
  color: var(--fun-ink);
  text-shadow: .04em 0 0 var(--fun-hot), -.04em 0 0 var(--fun-cool);
}
.fun-404__title { font: 700 clamp(1.5rem, 4vw, 2.2rem)/1.2 var(--fun-display); margin: 1.5rem 0 .75rem; max-width: 22ch; }
.fun-404 p { color: var(--fun-muted); max-width: 46ch; }
.fun-404__actions { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; margin-top: 2rem; }

/* ---------- Now page ---------- */
.fun-now h1 { font: 700 clamp(2.4rem, 7vw, 3.6rem)/1 var(--fun-display); margin: 0 0 .5rem; }
.fun-now__updated { color: var(--fun-muted); margin: 0 0 3rem; }
.fun-now section { margin-bottom: 2.5rem; }
.fun-now h2 {
  font: 700 1.25rem/1.3 var(--fun-display);
  margin: 0 0 .75rem;
  padding-left: .75rem;
  border-left: 3px solid var(--fun-hot);
}
.fun-now ul { margin: 0; padding-left: 1.75rem; }
.fun-now li { margin-bottom: .4rem; }
.fun-now li::marker { color: var(--fun-cool); }
.fun-now__note { color: var(--fun-muted); font-size: .9rem; }

/* ---------- Terminal ---------- */
.fun-term-page { background: #0d0618; color: #d9d2ee; }
html:not(.dark) .fun-term-page { background: #1a1530; }
.fun-term {
  max-width: 52rem; margin: 0 auto;
  padding: 1.25rem;
  min-height: 100vh;
  font: .95rem/1.6 var(--fun-mono);
  box-sizing: border-box;
}
.fun-term__out { white-space: pre-wrap; word-break: break-word; }
.fun-term__line { margin: 0; }
.fun-term__prompt { color: #05d9e8; }
.fun-term__hot { color: #ff2a6d; }
.fun-term__sig { color: #f3e600; }
.fun-term__ok { color: #39ff88; }
.fun-term__dim { color: #8b7fae; }
.fun-term form { display: flex; gap: .6rem; align-items: baseline; }
.fun-term input {
  flex: 1;
  background: transparent; border: 0;
  color: inherit; font: inherit;
  caret-color: #f3e600;
  padding: 0;
}
.fun-term a { color: #05d9e8; }

@media (prefers-reduced-motion: reduce) {
  .fun-badge__dot, .fun-glitch { animation: none; }
  .fun-toggle__icon, .fun-hint, .fun-hint__tip { transition: none; }
}
