/* diojay.com — quiet monospace shell over a fixed full-screen wasm background */

/* the accent follows the current ascii effect; hero.js tweens it per frame
   (hue via shortest arc, desaturating mid-flight), so no CSS transition */
:root {
  --bg:     #0a0a0f;
  --fg:     #d8d4ca;  /* warm off-white, the cream end of the tunnel palette */
  --dim:    #8a8794;
  --accent: #c9824c;  /* fallback ember until JS sets the effect's color */
  --panel:  rgba(13, 13, 20, 0.72);
  --line:   rgba(216, 212, 202, 0.08);
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", Menlo, Consolas,
          "DejaVu Sans Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.7;
  /* playing with the ascii background involves a lot of clicking and
     dragging — don't let that highlight the page text */
  user-select: none;
  -webkit-user-select: none;
}

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { color: var(--fg); }
a:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

/* ---- fixed background: the ascii engine stays put, the site scrolls ---- */

#hero-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  opacity: 0.65;
}

.hero-fallback {
  position: fixed;
  inset: 0;
  z-index: -2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--dim);
  opacity: 0.5;
  font-size: 13px;
  line-height: 1.2;
  user-select: none;
}

/* soft vignette between the animation and the content for readability */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 120% 90% at 50% 20%,
              transparent 35%, rgba(10, 10, 15, 0.55) 100%);
}

/* ---- header ---- */

.site-header {
  text-align: center;
  padding: 4vh 1.25rem 3vh;
  text-shadow: 0 0 18px rgba(10, 10, 15, 0.9), 0 0 46px rgba(10, 10, 15, 0.7);
}

.site-header h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--accent); /* rides the per-effect accent like the links */
}

.site-header p {
  color: var(--fg);
  font-size: clamp(0.85rem, 2.4vw, 1rem);
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(10, 10, 15, 0.95), 0 0 10px rgba(10, 10, 15, 0.95),
               0 0 24px rgba(10, 10, 15, 0.9);
}

/* ---- content ---- */

main, footer {
  max-width: 56rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

section { padding: 1.4rem 0 0; }

section > h2 {
  color: var(--dim);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  margin-bottom: 0.7rem;
  text-shadow: 0 0 10px rgba(10, 10, 15, 0.9);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ---- site cards ---- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(21rem, 1fr));
  gap: 1rem;
}

.card {
  position: relative; /* the detail sheet anchors to the card */
  min-width: 0; /* the hidden detail's video basis must not widen the track */
  padding: 1.1rem 1.25rem;
  color: var(--dim);
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}

.card-head {
  display: flex;
  gap: 1.1rem;
  align-items: center;
}

.card img {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  flex-shrink: 0;
}

.card h3 {
  color: var(--accent);
  font-size: 1rem;
  font-weight: 700;
  transition: color 140ms ease;
}

.card p { font-size: 0.9rem; line-height: 1.55; }

/* +/- affordance so cards read as openable */
.card::after {
  content: "+";
  position: absolute;
  top: 0.65rem;
  right: 1rem;
  color: var(--dim);
  font-size: 1.05rem;
  transition: color 140ms ease;
}
.card.open::after { content: "\2212"; }
.card:hover::after { color: var(--accent); }

.card:hover, .card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--fg);
}
.card:hover h3, .card:focus-visible h3 { color: var(--fg); }

/* click to expand: the open card spans the full row (bottom-row cards rise
   to the top); hero.js FLIP-animates every card from its old spot to its
   new one, so the layout change reads as cards gliding, in any browser */
.card.open {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--fg);
}

.card-detail {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.card-detail-inner {
  overflow: hidden;
  min-height: 0;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
  padding-top: 1rem;
  opacity: 0;
  transition: opacity 140ms ease;
}

.card.open .card-detail { grid-template-rows: 1fr; }

.card.open .card-detail-inner {
  color: var(--fg);
  opacity: 1;
  transition: opacity 220ms ease 140ms;
}

@media (prefers-reduced-motion: reduce) {
  .card-detail, .card-detail-inner,
  .card.open .card-detail, .card.open .card-detail-inner { transition: none; }
}

.detail-text { flex: 1 1 16rem; }

.detail-list {
  list-style: none;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* the explicit way to the site, revealed with the detail */
.visit {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.45rem 1rem;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.9rem;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.visit:hover, .visit:focus-visible {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.detail-list li { padding: 0.15rem 0; }

.detail-list li::before {
  content: "» ";
  color: var(--accent);
}

.detail-video {
  flex: 1.6 1 22rem;
  max-width: 38rem;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #0d0d14;
  cursor: zoom-in;
}

.detail-video video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* click-to-expand: the video node is moved into a full-viewport overlay */
.video-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(5, 5, 9, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: zoom-out;
}

.video-lightbox video {
  display: block;
  width: min(94vw, calc(92vh * 16 / 9));
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0d14;
}

/* ---- code section ---- */

.code-panel { padding: 0.6rem 1.25rem; }

.row {
  display: block;
  padding: 0.3rem 0;
  color: var(--dim);
  transition: color 120ms ease;
}

.row .name { color: var(--accent); transition: color 120ms ease; }
.row .dash { padding: 0 0.5ch; }

.row:hover, .row:focus-visible { color: var(--fg); }
.row:hover .name, .row:focus-visible .name { color: var(--fg); }

.row.sub { padding-left: 4ch; }

/* ---- footer ---- */

footer { padding-top: 1.6rem; padding-bottom: 1.6rem; }

.footer-panel {
  padding: 1.1rem 1.25rem;
  color: var(--dim);
  text-align: center;
  /* the email should be copyable even though the page isn't selectable */
  user-select: text;
  -webkit-user-select: text;
}

.footer-panel p { padding: 0.15rem 0; font-size: 0.85rem; }

.todo { font-style: italic; }

/* ---- mobile: give the art a hero moment ---- */

@media (max-width: 700px) {
  /* the chip overlaps full-width content on phones: keep it small and
     fully opaque so nothing bleeds through it */
  .immerse-btn {
    background: rgb(13 13 20 / 0.94);
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
  }

  .site-header {
    min-height: 58svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* ---- immersion toggle: fade the page away, leave the animation ---- */

.immerse-btn {
  position: fixed;
  right: 0.9rem;
  bottom: 0.9rem;
  z-index: 60;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: color 140ms ease, border-color 140ms ease;
}

/* one quiet double-pulse shortly after load: "this is clickable" */
@keyframes chip-pulse {
  0%, 100% { color: var(--dim); border-color: var(--line); }
  50% {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  }
}

.immerse-btn { animation: chip-pulse 2.2s ease 2.5s 2; }

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

.immerse-btn:hover, .immerse-btn:focus-visible {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.site-header, main, footer { transition: opacity 450ms ease; }

body.immersed .site-header,
body.immersed main,
body.immersed footer {
  opacity: 0;
  pointer-events: none;
}

/* ---- 404 (full-viewport centered overlay) ---- */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
}

.hero-title {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 0 18px rgba(10, 10, 15, 0.9), 0 0 46px rgba(10, 10, 15, 0.7);
}

.hero-title h1 { font-size: clamp(4rem, 14vw, 8rem); letter-spacing: 0.08em; }

.hero-title p { color: var(--dim); }

.hero-title .back { pointer-events: auto; }
