/* Fluxwerk shared styles.
   The homepage keeps its own inline <style>; this file adds the colour-coded
   index and styles the generated detail pages. */

:root {
  --blue: #1414FF;            /* existing identity colour, unchanged */
  --bg: #FFFFFF;

  /* Content-type palette */
  --work: #263CFF;       --work-ink: #FFFFFF;
  --writing: #00E5E8;    --writing-ink: #06262C;
  --lab: #9860FF;        --lab-ink: #FFFFFF;
  --links: #171B8F;  --links-ink: #FFFFFF;

  --focus: #06262C;
  --mono: 'Space Mono', 'Courier New', Courier, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --ink: #4A4A4F;             /* subpage text: neutral grey; links stay electric blue */
}

.t-work      { --c: var(--work);      --i: var(--work-ink); }
.t-writing   { --c: var(--writing);   --i: var(--writing-ink); }
.t-lab       { --c: var(--lab);       --i: var(--lab-ink); }
.t-links { --c: var(--links); --i: var(--links-ink); }

.fx-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Colour-coded index ---------- */

.fx-index-wrap {
  max-width: 900px;
  margin: 3.5rem 0 3rem;
}

.fx-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin-bottom: 14px;
  font: 400 0.85rem/1.3 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fx-nav button,
.fx-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  background: none;
  border: 0;
  border-radius: 0;
  color: rgba(20, 20, 255, 0.7);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-decoration: none;
  cursor: pointer;
}

.fx-nav .fx-swatch {
  width: 9px;
  height: 9px;
  background: var(--c);
  flex: none;
}

.fx-nav button[aria-pressed="true"],
.fx-nav a:hover,
.fx-nav button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fx-nav button[aria-pressed="true"] { color: var(--blue); }
.fx-nav.is-filtered button[aria-pressed="false"] { opacity: 0.35; }

.fx-nav .fx-nav-sep { opacity: 0.35; }

.fx-index {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.fx-index li { display: flex; line-height: 0; }
.fx-index li[hidden] { display: none; }

.fx-block {
  display: inline-block;
  padding: 4px 7px;
  background: var(--c);
  color: var(--i);
  font: 400 0.85rem/1.35 var(--mono); /* same size as the "Previously…" text */
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 0;
  max-width: 100%;
}


/* Type icons (inline SVG masks, so they always take the block text colour) */
.fx-block.t-work, .fx-block.t-writing, .fx-block.t-lab, .fx-block.t-links {
  display: inline-flex;
  align-items: center;
  gap: 0.75em;
}
.fx-block.t-work::before, .fx-block.t-writing::before, .fx-block.t-lab::before, .fx-block.t-links::before {
  content: "";
  flex: none;
  width: 0.8em;
  height: 0.8em;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.t-work { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22square%22%20stroke-linejoin%3D%22miter%22%3E%3Crect%20x%3D%222.5%22%20y%3D%227%22%20width%3D%2219%22%20height%3D%2213.5%22%2F%3E%3Cpath%20d%3D%22M8%207V3.5h8V7M2.5%2013h19%22%2F%3E%3C%2Fsvg%3E"); }
.t-writing { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22square%22%20stroke-linejoin%3D%22miter%22%3E%3Cpath%20d%3D%22M12%2020.5h9%22%2F%3E%3Cpath%20d%3D%22M16.5%203.5l4%204L8%2020H4v-4z%22%2F%3E%3C%2Fsvg%3E"); }
.t-lab { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22square%22%20stroke-linejoin%3D%22miter%22%3E%3Cpath%20d%3D%22M9.5%202.5v7L4%2020.5h16l-5.5-11v-7M7.5%202.5h9M6.5%2015.5h11%22%2F%3E%3C%2Fsvg%3E"); }
.t-links { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22square%22%20stroke-linejoin%3D%22miter%22%3E%3Cpath%20d%3D%22M14.5%203.5h6v6M20.5%203.5l-10%2010%22%2F%3E%3Cpath%20d%3D%22M18%2013.5v7H3.5V6h7%22%2F%3E%3C%2Fsvg%3E"); }

/* Hover: the block flickers on like a neon tube warming up, then stays lit. Solid background only, no glow. */
@keyframes fx-neon {
  0%   { background-color: color-mix(in srgb, var(--c) 30%, white); }
  8%   { background-color: var(--c); }
  14%  { background-color: color-mix(in srgb, var(--c) 30%, white); }
  22%  { background-color: var(--c); }
  26%  { background-color: color-mix(in srgb, var(--c) 45%, white); }
  40%  { background-color: var(--c); }
  46%  { background-color: color-mix(in srgb, var(--c) 30%, white); }
  58%  { background-color: var(--c); }
  100% { background-color: var(--c); }
}
a.fx-block:hover, a.fx-block:focus-visible {
  animation: fx-neon 650ms steps(1, end) both;
}
@media (prefers-reduced-motion: reduce) {
  a.fx-block:hover, a.fx-block:focus-visible { animation: none; }
}
.fx-label { white-space: pre-wrap; }


.fx-block:focus-visible,
.fx-nav button:focus-visible,
.fx-nav a:focus-visible,
.fx-page a:focus-visible,
.fx-page button:focus-visible,
.fx-page input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- Detail pages ---------- */

.fx-page {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.6;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.fx-page main {
  padding: 3rem 2rem;
  max-width: 1080px;
}

.fx-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem 2rem;
  max-width: 760px;
  margin: 0 0 4.5rem;
}

.fx-name {
  color: var(--blue);
  text-decoration: none;
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  letter-spacing: 0.3em;
}

.fx-back {
  color: var(--blue);
  font: 700 10px/1.3 var(--mono);
  letter-spacing: 0.08em;
  text-decoration: none;
}
.fx-back:hover { text-decoration: underline; text-underline-offset: 3px; }

.fx-entry { max-width: 760px; }

.fx-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 0 0 1.25rem;
  font: 700 10px/1.3 var(--mono);
  letter-spacing: 0.08em;
}

.fx-meta .fx-block { font-size: 11px; padding: 3px 7px; }

.fx-status::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 6px;
  border: 1px solid currentColor;
  vertical-align: 1px;
}
.fx-page--writing .fx-status::before { background: var(--writing); border-color: var(--writing); }

.fx-title {
  margin: 0 0 2rem;
  font-size: clamp(1.35rem, 4vw, 2.1rem);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.08em;
}

.fx-sample {
  display: inline-block;
  margin: 0 0 2rem;
  padding: 4px 8px;
  border: 1px dashed currentColor;
  font: 700 10px/1.4 var(--mono);
  letter-spacing: 0.06em;
}
.fx-sample code { text-transform: none; font: inherit; }

.fx-prose {
  max-width: 64ch;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-transform: none;
  letter-spacing: 0;
}
.fx-prose > * { margin: 0; }
.fx-prose > * + * { margin-top: 1.1em; }
.fx-prose strong { font-weight: 600; }
/* Subheadings speak in the H1 voice: regular mono, uppercase, just smaller */
.fx-prose h2, .fx-prose h3, .fx-prose h4 {
  margin-top: 2.2em;
  margin-bottom: -0.3em;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.fx-prose a { color: var(--blue); }
.fx-prose img { display: block; max-width: 100%; height: auto; }
.fx-prose figure { margin-top: 2em; margin-bottom: 2em; }
.fx-prose figcaption { margin-top: 0.5em; font-size: 0.8rem; opacity: 0.65; }
.fx-prose blockquote { padding-left: 1em; border-left: 2px solid var(--blue); }
.fx-prose ul, .fx-prose ol { padding-left: 1.4em; }
.fx-prose code { font-family: var(--mono); background: rgba(20, 20, 255, 0.07); padding: 0 0.25em; }
.fx-prose pre { overflow-x: auto; padding: 1em; background: rgba(20, 20, 255, 0.05); }
.fx-prose pre code { background: none; padding: 0; }
.fx-prose hr { border: 0; border-top: 1px solid var(--blue); opacity: 0.3; }

.fx-out {
  margin: 2.5rem 0 0;
  font: 700 10px/1.3 var(--mono);
  letter-spacing: 0.08em;
}
.fx-out a { color: var(--blue); }

/* Footer reuses the homepage divider + contact styling */
.fx-page .divider-slashes {
  font-size: 1rem;
  letter-spacing: 0.05em;
  margin: 4rem 0 3rem;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0.5;
}
.fx-page section { margin-bottom: 2rem; }
.fx-page .contact-text { font-size: 1rem; line-height: 1.9; text-transform: none; margin: 0; }
.fx-page .contact-text a { color: var(--blue); }

/* ---------- Lab experiments ---------- */

.lab-box {
  margin-top: 2em;
  padding: 1.25rem;
  border: 1px solid var(--blue);
  text-transform: uppercase;
}
.lab-box input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--blue);
  border-radius: 0;
  background: var(--bg);
  color: var(--blue);
  font: 700 12px/1.4 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lab-output {
  min-height: 2.2em;
  margin-top: 1rem;
  font-size: clamp(1rem, 3vw, 1.4rem);
  letter-spacing: 0.25em;
  word-break: break-word;
}
.lab-canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; cursor: pointer; }
.lab-hint { margin-top: 0.75rem; font: 700 10px/1.3 var(--mono); letter-spacing: 0.08em; opacity: 0.6; }

/* ---------- Small screens ---------- */

@media (max-width: 520px) {
  .fx-page main { padding: 2rem 1.25rem; }
  .fx-header { margin-bottom: 3rem; }
}

/* Lab disclaimer */
.fx-lab-note {
  max-width: 62ch;
  margin: 0 0 2.25rem;
  padding: 6px 0 6px 12px;
  border-left: 3px solid var(--lab);
  font: 400 0.8rem/1.6 var(--mono);
  letter-spacing: 0.02em;
  text-transform: none;
}

/* ASCII portrait + glitch overlay (see assets/portrait.js) */
.fx-portrait-wrap { position: relative; display: inline-block; }
.fx-portrait-glitch { position: absolute; inset: 0; pointer-events: none; }
.fx-portrait-glitch > div { position: absolute; }
.fx-portrait {
  margin: 0;
  color: var(--blue);
  /* 130 columns; scales down so it never overflows on small screens */
  font: 400 min(6px, calc((100vw - 4rem) / 78))/1.1 var(--mono);
  letter-spacing: 0;
  text-transform: none;
  user-select: none;
}

/* Index entries that aren't clickable yet (see NOT_CLICKABLE_YET in build.mjs) */
.fx-block--static { cursor: default; opacity: 0.3; }
