/* ==========================================================================
   bouksi.com — base design system
   Vintage, block-color, content-first. No animation on shell/decorative
   elements — motion is reserved for content media (video/gifs).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Space+Mono:wght@400;700&family=Work+Sans:wght@400;500;600&display=swap');

/* ---- indent scale ------------------------------------------------------ */
/* Site chrome and page content share the same left edge on purpose — a
   page's title lines up with the logo above it. Only content nested a
   level deeper (e.g. inside a featured card) steps in further.
     --indent-0 : site chrome (header logo, footer) and page content
                  (hero text, section wrapper, titles)
     --indent-2 : content nested a level deeper */
:root {
  --indent-0: 1.5rem;
  --indent-1: 1.5rem;
  --indent-2: 3rem;
}

/* ---- palettes -------------------------------------------------------- */
/* Each palette defines: bg, fg (text), accent (links/highlights),
   accent-2 (secondary highlight/tags). Swapped at runtime via
   [data-palette] on <html>, controlled by the palette-switcher buttons. */

:root,
[data-palette="cream"] {
  --bg: #f2ede4;
  --fg: #1b1b1b;
  --accent: #d94f2b;
  --accent-2: #2c5f4f;
}

[data-palette="mustard"] {
  --bg: #f2c14e;
  --fg: #1b1b1b;
  --accent: #c1440e;
  --accent-2: #1b1b1b;
}

[data-palette="teal"] {
  --bg: #00a878;
  --fg: #0f2a20;
  --accent: #16324a;
  --accent-2: #2b1b12;
}

[data-palette="rose"] {
  --bg: #e4c9c0;
  --fg: #2b1b12;
  --accent: #6b4226;
  --accent-2: #00a878;
}

[data-palette="sky"] {
  --bg: #add8e6;
  --fg: #3a2418;
  --accent: #000080;
  --accent-2: #5c4033;
}

[data-palette="ink"] {
  --bg: #16324a;
  --fg: #f2e8d5;
  --accent: #d9a441;
  --accent-2: #a9bfd1;
}

[data-palette="plum"] {
  --bg: #6b2d5c;
  --fg: #f2ede4;
  --accent: #f2c14e;
  --accent-2: #add8e6;
}

/* Palette swaps (theme switcher, or a category preview on Works) crossfade
   rather than snap — every element using --bg/--fg/--accent/--accent-2
   picks it up for free since the transition just watches the resolved
   colour. Not gated behind prefers-reduced-motion: a colour fade isn't the
   kind of movement that setting exists to guard against (unlike the
   scrolling waveform trace, which does respect it). */
*, *::before, *::after {
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

/* ---- reset ------------------------------------------------------------ */

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

html, body { margin: 0; padding: 0; }

img, video { max-width: 100%; display: block; }

a {
  color: #0000ee;
  text-decoration: underline;
}

a:visited { color: #551a8b; }

a:hover { color: #d92626; }

button { font: inherit; }

/* ---- base -------------------------------------------------------------- */

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Work Sans', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: 'Archivo Black', Impact, sans-serif;
  font-weight: 400;
  text-transform: uppercase;
  line-height: 1.05;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2.5rem, 6vw, 5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 3rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }

p { margin: 0 0 1.25em; max-width: 60ch; }

.mono {
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

.site-header {
  border-bottom: 2px solid var(--fg);
  padding: 0.85rem var(--indent-0);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  font-family: 'Space Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #d92626;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.site-nav a {
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.site-nav a[aria-current="page"] {
  font-weight: 700;
}

/* ---- palette switcher ---------------------------------------------------- */

.palette-switcher-row {
  border-bottom: 2px solid var(--fg);
  padding: 0.75rem 1.5rem 0.75rem var(--indent-1);
}

.palette-switcher {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.palette-switcher button {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--fg);
  border-radius: 0;
  cursor: pointer;
  padding: 0;
}

.palette-switcher button[aria-pressed="true"] {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.palette-swatch-cream   { background: #f2ede4; }
.palette-swatch-sky     { background: #add8e6; }
.palette-swatch-mustard { background: #f2c14e; }
.palette-swatch-teal    { background: #00a878; }
.palette-swatch-rose    { background: #e4c9c0; }
.palette-swatch-ink     { background: #16324a; }
.palette-swatch-plum    { background: #6b2d5c; }

/* ---- buttons / links as blocks ------------------------------------------- */

.btn {
  display: inline-block;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  background: var(--fg);
  color: var(--bg);
  padding: 0.75em 1.25em;
  border: 2px solid var(--fg);
}

.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.btn-outline {
  background: transparent;
  color: var(--fg);
}

/* ---- tags ---------------------------------------------------------------- */

.tag {
  display: inline-block;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 0.3em 0.6em;
  border: 2px solid var(--fg);
}

.project-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.4em;
}

/* ---- main / sections ------------------------------------------------------ */

main { display: block; }

.section {
  padding: 1.5rem 1.5rem 1.5rem var(--indent-1);
}

/* ---- hero (home) ----------------------------------------------------------- */

.hero {
  padding: 1.5rem 1.5rem 0.75rem var(--indent-1);
}

.hero-top,
.page-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25em;
}

.hero-top p {
  margin-bottom: 0;
}

.hero-emphasis {
  font-family: 'Archivo Black', Impact, sans-serif;
  text-transform: uppercase;
  font-size: clamp(1.75rem, 4vw, 3rem);
  line-height: 1;
  display: inline-block;
  vertical-align: -0.1em;
}

.page-top h1 {
  margin-bottom: 0;
}

/* ---- page settings (Works: mute, room for more later) ---------------------- */

.page-settings {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.page-settings button {
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  background: transparent;
  border: 2px solid var(--fg);
  color: var(--fg);
  padding: 0.5em 0.9em;
  cursor: pointer;
}

.page-settings button[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}

/* ---- featured project block ------------------------------------------------ */

.featured-card {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.featured-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 2px solid var(--fg);
}

.featured-top {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
}

.featured-top .featured-next-btn {
  flex-shrink: 0;
}

/* a continuous box-drawing line with a small ╱╲ peak travelling through it
   — doubles as the auto-advance timer for the random project below: each
   full pass swaps in a new one (see main.js) */
.featured-rule {
  position: relative;
  height: 1rem;
  line-height: 1rem;
  margin-bottom: 0.5rem;
  overflow: hidden;
  white-space: nowrap;
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
  color: var(--fg);
}

.featured-rule-dashes {
  display: block;
}

.featured-rule-wave {
  position: absolute;
  top: 0;
  left: -10%;
  background: var(--bg);
}

@media (prefers-reduced-motion: no-preference) {
  .featured-rule-wave {
    animation: featured-rule-travel 8s linear infinite;
  }
}

@keyframes featured-rule-travel {
  from { left: -10%; }
  to { left: 110%; }
}

.featured-label {
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.featured-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.featured-info h3 {
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.featured-info p {
  color: var(--accent-2);
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  min-height: 3em;
}

.featured-next-btn {
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 0.4em 0.8em;
  cursor: pointer;
}

.featured-next-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- project grid ----------------------------------------------------------- */

.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 600px) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1000px) {
  .project-grid { grid-template-columns: repeat(3, 1fr); }
}

.project-card {
  border: 2px solid var(--fg);
  text-decoration: none;
  color: var(--fg);
  display: flex;
  flex-direction: column;
}

.project-card-media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 2px solid var(--fg);
  background: var(--fg);
}

.project-card-media img,
.project-card-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.project-card-body h3 {
  margin-bottom: 0.4em;
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  text-align: left;
}

/* card body filled with its primary category's colour, same mapping as
   the category-filter buttons above */
.project-card[data-category^="immersive"]    .project-card-body { background: #add8e6; color: #16324a; }
.project-card[data-category^="animation"]     .project-card-body { background: #f2c14e; color: #16324a; }
.project-card[data-category^="games"]         .project-card-body { background: #e4c9c0; color: #16324a; }
.project-card[data-category^="installations"] .project-card-body { background: #00a878; color: #0f2a20; }
.project-card[data-category^="music"]         .project-card-body { background: #16324a; color: #f2ede4; }
.project-card[data-category^="various"]       .project-card-body { background: #a39a8a; color: #1b1b1b; }

/* ---- category filter (projects page) ---------------------------------------- */

.category-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.category-filter button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  background: transparent;
  border: 2px solid var(--fg);
  color: var(--fg);
  padding: 0.5em 0.9em;
  cursor: pointer;
}

/* each button is filled with its category colour by default; selecting it
   drops the fill to transparent, so the highlighted one reads as "open" */
.category-filter button[data-category="immersive"]    { background: #add8e6; color: #16324a; border-color: #16324a; }
.category-filter button[data-category="animation"]     { background: #f2c14e; color: #16324a; border-color: #16324a; }
.category-filter button[data-category="games"]         { background: #e4c9c0; color: #16324a; border-color: #16324a; }
.category-filter button[data-category="installations"] { background: #00a878; color: #0f2a20; border-color: #0f2a20; }
.category-filter button[data-category="music"]         { background: #16324a; color: #f2ede4; border-color: #f2ede4; }
.category-filter button[data-category="various"]       { background: #a39a8a; color: #1b1b1b; border-color: #1b1b1b; }

.category-filter button[aria-pressed="true"] {
  background: transparent;
  color: var(--fg);
  border-color: var(--fg);
}

.wave-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 1.05rem;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--fg);
  background: #1b1b1b;
}

/* the Music/ink trace is too dark to read against the default dark
   screen, so it gets a light one instead */
.wave-screen--light { background: #f2ede4; }

.wave {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.wave-track {
  transform-box: fill-box;
}

/* active state: the fill drops to transparent (see [aria-pressed="true"]
   above) and the trace starts scrolling, like a live oscilloscope signal */
@media (prefers-reduced-motion: no-preference) {
  .category-filter button[aria-pressed="true"] .wave-track {
    animation: wave-scroll 1.6s linear infinite;
  }
}

@keyframes wave-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* reduced-motion fallback: no scroll, so the border carries the cue instead */
@media (prefers-reduced-motion: reduce) {
  .category-filter button[aria-pressed="true"] {
    border-width: 4px;
  }
}

.keyword-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 2rem;
}

.keyword-filter button {
  white-space: nowrap;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  background: transparent;
  border: 1px solid var(--fg);
  color: var(--fg);
  padding: 0.3em 0.7em;
  cursor: pointer;
}

.keyword-filter button[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}

/* ---- gallery grid ------------------------------------------------------------- */

.gallery-grid {
  column-count: 2;
  column-gap: 0.75rem;
}

@media (min-width: 700px) {
  .gallery-grid { column-count: 3; }
}

.gallery-grid a,
.gallery-grid .gallery-video {
  display: block;
  border: 2px solid var(--fg);
  margin-bottom: 0.75rem;
  break-inside: avoid;
  overflow: hidden;
}

/* grid-stacked instead of position:absolute — Chrome mis-hit-tests
   absolutely positioned children of multicol items (the button would
   paint in the right spot but not receive clicks); Safari doesn't have
   the bug, but grid stacking sidesteps it in both */
.gallery-grid .gallery-video {
  display: grid;
}

.gallery-grid .gallery-video video,
.gallery-grid .gallery-video .mute-btn {
  grid-area: 1 / 1;
}

.gallery-grid img,
.gallery-grid video {
  display: block;
  width: 100%;
  height: auto;
}

.gallery-grid .mute-btn {
  align-self: end;
  justify-self: end;
  margin: 0.5rem;
  border: 2px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  width: 2rem;
  height: 2rem;
  line-height: 1;
  font-size: 1rem;
  cursor: pointer;
}

/* ---- project page template ----------------------------------------------------- */

.project-hero {
  padding: 2rem 1.5rem 1.5rem;
  border-bottom: 1px solid var(--fg);
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.project-meta-item .mono { display: block; opacity: 0.7; margin-bottom: 0.2em; }

.project-block {
  padding: 2rem 1.5rem;
  border-bottom: 1px solid var(--fg);
}

.project-block:last-of-type { border-bottom: none; }

.project-block-text p:last-child { margin-bottom: 0; }

.project-block-text .mono {
  display: block;
  color: var(--accent);
  margin-bottom: 0.6em;
}

.project-media-sm {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.project-block-split {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.project-block-split .project-block-text { flex: 1 1 50%; }

.project-block-split .project-media-sm {
  flex: 1 1 50%;
  margin: 0;
}

@media (max-width: 700px) {
  .project-block-split { flex-direction: column; }
}

.project-media-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
  max-width: 60ch;
}

.project-media-row .project-media { margin: 0; }

.project-media img,
.project-media video {
  width: 100%;
  border: 2px solid var(--fg);
}

.project-video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 2px solid var(--fg);
}

.project-video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.project-media figcaption {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.7;
  margin-top: 0.6rem;
}

.project-nav {
  display: flex;
  justify-content: space-between;
  padding: 2rem 1.5rem;
}

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

.site-footer {
  border-top: 2px solid var(--fg);
  padding: var(--indent-0);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1.5rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.site-footer a { color: var(--fg); text-decoration: none; border-bottom: 2px solid var(--accent); }
