/* =========================================================
   d4n.uk — dark editorial / terminal
   Design notes:
   - One accent (signal green) used sparingly.
   - Type pairing: Space Grotesk (display) + JetBrains Mono (system).
   - Everything sits on an 8px rhythm and a visible hairline grid.
   ========================================================= */

:root {
  --bg:        #0a0b0d;
  --bg-soft:   #101216;
  --ink:       #e8e6df;
  --ink-dim:   #8b8d86;
  --ink-faint: #4a4d49;
  --line:      #1d2025;
  --line-soft: #15171b;
  --accent:    #5ff39a;   /* signal green */
  --accent-2:  #6ea8ff;   /* cool blue, rare */
  --warn:      #ffcf6e;
  --radius:    2px;
  --maxw:      980px;

  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-disp: "Space Grotesk", var(--font-mono);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* light theme — kept editorial, not flat white */
[data-theme="light"] {
  --bg:        #f4f1ea;
  --bg-soft:   #ece8df;
  --ink:       #1a1c1a;
  --ink-dim:   #5d5f58;
  --ink-faint: #b3afa4;
  --line:      #dcd7cb;
  --line-soft: #e6e1d6;
  --accent:    #1f8f54;
  --accent-2:  #2f6bd6;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background .5s var(--ease), color .5s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

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

a { color: inherit; text-decoration: none; }

kbd {
  font-family: var(--font-mono);
  font-size: .78em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  padding: 1px 5px;
  color: var(--ink-dim);
  background: var(--bg-soft);
}

/* ---------- overlays ---------- */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: .035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.grid-lines {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, var(--line-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 35%, transparent 100%);
          mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 35%, transparent 100%);
  opacity: .6;
}

.skip-link {
  position: fixed; top: -100px; left: 12px; z-index: 100;
  background: var(--accent); color: var(--bg);
  padding: 8px 14px; border-radius: var(--radius); font-weight: 700;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- layout ---------- */
.wrap {
  position: relative; z-index: 2;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(20px, 5vw, 48px) 96px;
}

/* ---------- masthead ---------- */
.masthead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 8px 0 28px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 2px; font-family: var(--font-disp); }
.brand__mark { color: var(--accent); font-size: 1.1rem; transform: translateY(1px); }
.brand__name {
  font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em;
  cursor: default;
}
.brand__caret {
  width: 9px; height: 1.05rem; background: var(--accent);
  align-self: center; margin-left: 3px;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.meta-nav { display: flex; gap: 6px; }
.meta-nav__btn {
  font: inherit; font-size: .82rem; color: var(--ink-dim);
  background: none; border: 1px solid transparent; cursor: pointer;
  padding: 6px 10px; border-radius: var(--radius);
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.meta-nav__btn:hover { color: var(--ink); border-color: var(--line); background: var(--bg-soft); }
.meta-nav__key { color: var(--accent); }

/* ---------- hero ---------- */
.hero { padding: clamp(28px, 6vh, 56px) 0 clamp(28px, 5vh, 48px); }
.hero__line--prompt {
  font-size: .9rem; color: var(--ink-dim); margin-bottom: 20px;
  display: flex; gap: 10px; align-items: center;
}
.hero__sigil { color: var(--accent); }
.hero__cmd { color: var(--ink); }
.hero__cmd::after {
  content: "▏"; color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
.hero__cmd.done::after { content: ""; }

.hero__title {
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: clamp(2.4rem, 7.5vw, 5rem);
  line-height: 1.02; letter-spacing: -.03em;
  margin-bottom: 20px;
}
.hero__title em {
  font-style: normal; color: var(--accent);
  position: relative;
}
.hero__title em::after {
  content: ""; position: absolute; left: 0; bottom: .08em; width: 100%; height: 2px;
  background: var(--accent); opacity: .35;
}
.hero__sub {
  max-width: 52ch; color: var(--ink-dim);
  font-size: clamp(.95rem, 1.6vw, 1.05rem);
}

/* ---------- section label ---------- */
.section-label {
  font-family: var(--font-disp); font-weight: 500;
  font-size: .82rem; text-transform: uppercase; letter-spacing: .22em;
  color: var(--ink-dim); display: flex; align-items: center; gap: 12px;
}
.section-label__no { color: var(--accent); font-family: var(--font-mono); }

.projects__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.projects__hint { font-size: .78rem; color: var(--ink-faint); }
.projects__hint kbd { margin: 0 1px; }

/* ---------- project list ---------- */
.proj-list { list-style: none; padding: 0; }

.proj {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(14px, 3vw, 30px);
  padding: clamp(20px, 3vw, 28px) 8px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  isolation: isolate;
  transition: background .35s var(--ease), padding-left .35s var(--ease);
  opacity: 0; transform: translateY(14px);
}
.proj.reveal { animation: rise .6s var(--ease) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* sliding accent fill on hover/focus */
.proj::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, var(--bg-soft), transparent 85%);
  opacity: 0; transition: opacity .35s var(--ease);
}
.proj::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--accent); transform: scaleY(0); transform-origin: top;
  transition: transform .35s var(--ease);
}
.proj:hover, .proj.is-active { background: transparent; padding-left: 22px; }
.proj:hover::before, .proj.is-active::before { opacity: 1; }
.proj:hover::after, .proj.is-active::after { transform: scaleY(1); }

.proj__no {
  font-size: .8rem; color: var(--ink-faint); font-variant-numeric: tabular-nums;
  transition: color .35s var(--ease);
}
.proj:hover .proj__no, .proj.is-active .proj__no { color: var(--accent); }

.proj__body { min-width: 0; }
.proj__name {
  font-family: var(--font-disp); font-weight: 500;
  font-size: clamp(1.25rem, 3.2vw, 1.9rem); letter-spacing: -.02em;
  line-height: 1.1; display: inline-flex; align-items: center; gap: 10px;
}
.proj__arrow {
  color: var(--accent); font-size: .9em;
  transform: translateX(-6px); opacity: 0;
  transition: transform .35s var(--ease), opacity .35s var(--ease);
}
.proj:hover .proj__arrow, .proj.is-active .proj__arrow { transform: none; opacity: 1; }

.proj__desc { color: var(--ink-dim); font-size: .9rem; margin-top: 6px; max-width: 60ch; }
.proj__tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.proj__tag {
  font-size: .7rem; color: var(--ink-dim); letter-spacing: .04em;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2px 7px; background: var(--bg-soft);
}

.proj__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; text-align: right; }
.proj__host { font-size: .76rem; color: var(--ink-faint); }

.status {
  font-size: .7rem; letter-spacing: .08em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-dim);
}
.status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 0 0 currentColor;
}
.status--live  { color: var(--accent); }
.status--live::before { animation: pulse 2s var(--ease) infinite; }
.status--wip   { color: var(--warn); }
.status--archived { color: var(--ink-faint); }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); }
  70%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* empty state */
.proj-list--empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 40px; text-align: center; color: var(--ink-faint); font-size: .9rem;
}

/* ---------- footer ---------- */
.footer {
  margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
  font-size: .8rem; color: var(--ink-faint);
}
.footer__status { display: inline-flex; align-items: center; gap: 8px; }
.footer__dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: pulse 2s var(--ease) infinite;
}

/* ---------- statusline (vim-style) ---------- */
.statusline {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 1px;
  font-size: .72rem; height: 26px;
  background: var(--bg-soft); border-top: 1px solid var(--line);
  color: var(--ink-dim);
  backdrop-filter: blur(6px);
}
.statusline__seg { padding: 0 12px; line-height: 26px; white-space: nowrap; }
.statusline__seg--mode {
  background: var(--accent); color: var(--bg); font-weight: 700; letter-spacing: .1em;
}
.statusline__seg--clock { color: var(--ink-faint); }
.statusline__spacer { flex: 1; }
@media (max-width: 600px) { .statusline__path, #slPath { display: none; } }

body { padding-bottom: 26px; } /* clear the statusline */

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .proj { grid-template-columns: auto 1fr; }
  .proj__meta { grid-column: 2; align-items: flex-start; text-align: left; flex-direction: row; gap: 14px; }
  .proj__host { display: none; }
  .meta-nav__btn { font-size: .76rem; padding: 6px 8px; }
}

/* ---------- focus ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius); }
.proj:focus-visible { outline-offset: -2px; }
