/* ============================================================
   DeeKism — bold colour-blocked, mobile first.

   Base styles are the phone layout. Nothing here is a
   "shrink it down" override: every media query below adds
   upward at min-width, so the small screen is the default.
   ============================================================ */

:root {
  /* Blocks — identical in both themes. */
  --blk-1: #ff4d2e;  --blk-1-ink: #ffffff;
  --blk-2: #2b4fff;  --blk-2-ink: #ffffff;
  --blk-3: #c6ff3d;  --blk-3-ink: #101010;
  --blk-4: #ff3d8b;  --blk-4-ink: #ffffff;
  --blk-5: #7b3ff2;  --blk-5-ink: #ffffff;
  --blk-6: #ffb800;  --blk-6-ink: #101010;
  --blk-7: #00d4a8;  --blk-7-ink: #101010;
  --blk-8: #ff7a1a;  --blk-8-ink: #101010;
  --blk-9: #00b3ff;  --blk-9-ink: #101010;

  /* Chrome — light is the base. */
  --paper:  #f4f1ea;
  --paper-2:#ffffff;
  --ink:    #101010;
  --ink-60: #55554f;
  --rule:   #101010;
  --shadow: #101010;

  --font-display: 'Archivo Black', 'Arial Black', system-ui, sans-serif;
  --font-ui: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Phone values. Breakpoints raise these. */
  --edge: 3px;
  --pop: 5px;
  --gap: 14px;
  --pad: 18px;
  --tap: 44px;      /* minimum touch target */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:  #0e0e10;
    --paper-2:#17171b;
    --ink:    #f4f1ea;
    --ink-60: #a3a39d;
    --rule:   #f4f1ea;
    --shadow: #000000;
  }
}

:root[data-theme="dark"] {
  --paper:  #0e0e10;
  --paper-2:#17171b;
  --ink:    #f4f1ea;
  --ink-60: #a3a39d;
  --rule:   #f4f1ea;
  --shadow: #000000;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;   /* don't let iOS inflate text on rotate */
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;              /* 16px floor stops iOS zooming on focus */
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--blk-3); color: var(--blk-3-ink);
  padding: 12px 20px; font-weight: 700; text-decoration: none;
  border: var(--edge) solid var(--rule);
}
.skip:focus { left: 8px; top: 8px; }

:focus-visible { outline: 3px solid var(--blk-2); outline-offset: 3px; }

/* ---------------- top bar ---------------- */

.bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 10px var(--pad);
  background: var(--paper);
  border-bottom: var(--edge) solid var(--rule);
}

.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-display);
  font-size: 17px; letter-spacing: 0.01em;
  text-decoration: none; white-space: nowrap;
}
.wordmark__blocks { display: inline-flex; gap: 3px; flex: none; }
.wordmark__blocks i { width: 9px; height: 17px; display: block; }
.wordmark__blocks i:nth-child(1) { background: var(--blk-1); }
.wordmark__blocks i:nth-child(2) { background: var(--blk-3); }
.wordmark__blocks i:nth-child(3) { background: var(--blk-2); }

.bar__right { display: flex; align-items: center; gap: 8px; }

/* On a phone the jump button is icon-only — the label and the
   keyboard hint are desktop affordances. */
.jump {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: var(--tap); min-width: var(--tap);
  font-family: var(--font-ui); font-size: 14px; font-weight: 500;
  color: var(--ink);
  background: var(--paper-2);
  border: var(--edge) solid var(--rule);
  padding: 0 10px;
  cursor: pointer;
}
.jump__label, .jump kbd { display: none; }
.jump:hover { background: var(--blk-3); color: var(--blk-3-ink); }

kbd {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  background: var(--ink); color: var(--paper);
  padding: 2px 6px; min-width: 20px; text-align: center;
  display: inline-block;
}

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap);
  background: var(--paper-2); color: var(--ink);
  border: var(--edge) solid var(--rule);
  cursor: pointer;
  font-family: var(--font-mono); font-size: 11px;
}
.icon-btn:hover { background: var(--blk-3); color: var(--blk-3-ink); }

.moon { display: none; }
.sun  { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .moon { display: inline; }
  :root:not([data-theme="light"]) .sun  { display: none; }
}
:root[data-theme="dark"] .moon { display: inline; }
:root[data-theme="dark"] .sun  { display: none; }
:root[data-theme="light"] .moon { display: none; }
:root[data-theme="light"] .sun  { display: inline; }

/* ---------------- hero ---------------- */

.hero {
  padding: 28px var(--pad) 26px;
  border-bottom: var(--edge) solid var(--rule);
}

.hero__blocks {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 3px; max-width: 230px; margin-bottom: 20px;
}
.hero__blocks i { display: block; height: 16px; background: var(--c); }

/* "DeeKism" is one word and keeps its capital K — never
   transform the case of this heading. */
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 15vw, 4rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  margin: 0;
}
.hero__title .k { color: var(--blk-1); }

.hero__tagline {
  font-size: 1.0625rem;
  max-width: 40ch;
  margin: 18px 0 0;
}

/* ---------------- filters ---------------- */

/* Phone: chips scroll sideways in one row, search sits beneath.
   The page itself never scrolls sideways — only this strip does. */
.filters {
  position: sticky; top: 65px; z-index: 30;
  background: var(--paper);
  padding: 10px 0 12px;
  border-bottom: var(--edge) solid var(--rule);
}

.filters__chips {
  display: flex; gap: 8px;
  padding: 0 var(--pad);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filters__chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  min-height: 38px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--paper-2); color: var(--ink);
  border: var(--edge) solid var(--rule);
  padding: 0 14px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.search {
  display: flex; align-items: center; gap: 8px;
  margin: 10px var(--pad) 0;
  border: var(--edge) solid var(--rule);
  background: var(--paper-2);
  padding: 0 12px;
  min-height: var(--tap);
  color: var(--ink-60);
}
.search input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: none;
  font-family: var(--font-ui); font-size: 16px; color: var(--ink);
}
.search input::placeholder { color: var(--ink-60); }

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

/* Phone: one column, every tile the same shape. Spans are a
   wide-screen idea and are switched on at 640px. */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  padding: var(--gap) var(--pad) 36px;
}

.tile {
  --c: var(--blk-1);
  --c-ink: var(--blk-1-ink);
  position: relative;
  display: flex; flex-direction: column;
  background: var(--c); color: var(--c-ink);
  border: var(--edge) solid var(--rule);
  box-shadow: var(--pop) var(--pop) 0 var(--shadow);
  padding: 18px;
  min-width: 0;
  transition: transform .12s ease, box-shadow .12s ease;
}

/* Lift on hover only where there's a real pointer — on touch it
   just leaves the tile stuck in a hover state after a tap. */
@media (hover: hover) and (pointer: fine) {
  .tile:hover, .tile:focus-within {
    transform: translate(calc(var(--pop) * -0.5), calc(var(--pop) * -0.5));
    box-shadow: calc(var(--pop) * 1.6) calc(var(--pop) * 1.6) 0 var(--shadow);
  }
}
@media (prefers-reduced-motion: reduce) {
  .tile, .tile:hover, .tile:focus-within { transition: none; transform: none; }
}

.tile__top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; margin-bottom: auto;
  /* Match the badge's height so a tile without one still starts its
     heading on the same line as its neighbours. */
  min-height: 26px;
}

.tile__kicker {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  opacity: .8;
}

.tile__badge {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  border: 2px solid currentColor;
  padding: 3px 7px; white-space: nowrap; flex: none;
}

/* Mixed case, not caps: names read faster and keep their own
   spelling (PandaPong, DebtFreeBy). */
.tile__name {
  font-family: var(--font-display);
  font-size: 1.625rem;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 20px 0 0;
  overflow-wrap: break-word;
  hyphens: auto;
}

.tile__blurb {
  margin: 10px 0 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  max-width: 56ch;
}

.tile__foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 14px;
  border-top: 2px solid currentColor;
}

.tile__tech {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.02em; opacity: .85;
}

.tile__links { display: flex; gap: 8px; }

.tile__link {
  display: inline-flex; align-items: center;
  min-height: 38px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  border: 2px solid currentColor;
  padding: 0 11px;
  text-decoration: none;
  position: relative; z-index: 2;
}
.tile__link:hover { background: currentColor; }
.tile__link:hover span { color: var(--c); }

.tile__stretch { text-decoration: none; color: inherit; }
.tile__stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; }

.empty {
  padding: 0 var(--pad) 48px;
  font-family: var(--font-mono); color: var(--ink-60);
}

/* ---------------- archive ---------------- */

.archive {
  padding: 32px var(--pad) 40px;
  border-top: var(--edge) solid var(--rule);
}
.archive__h {
  font-family: var(--font-display);
  font-size: 1.375rem;
  margin: 0 0 16px;
}
.archive__list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--rule); }
.archive__list li { border-bottom: 2px solid var(--rule); }

.arc {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center; gap: 12px;
  padding: 14px 2px; min-height: var(--tap);
  text-decoration: none;
}
.arc__dot { width: 12px; height: 12px; background: var(--c); }
.arc__name { font-weight: 700; }
.arc__desc { display: block; font-size: 0.85rem; color: var(--ink-60); font-weight: 400; margin-top: 2px; }
.arc__meta { display: none; font-family: var(--font-mono); font-size: 11px; color: var(--ink-60); }
.arc__go { font-family: var(--font-mono); font-size: 12px; font-weight: 700; }

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

.foot { border-top: var(--edge) solid var(--rule); }
.foot__blocks { display: grid; grid-template-columns: repeat(6, 1fr); }
.foot__blocks i { display: block; height: 14px; background: var(--c); }
.foot__row {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: space-between;
  padding: 18px var(--pad) 32px;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--ink-60);
}
.foot__row p { margin: 0; }
.foot__row a { color: var(--ink); }

/* ---------------- jump palette ---------------- */

/* Phone: a full-height sheet. It becomes a floating box at 640px. */
.palette { position: fixed; inset: 0; z-index: 60; }
.palette[hidden] { display: none; }
.palette__scrim { position: absolute; inset: 0; background: rgba(0,0,0,.55); }

.palette__box {
  position: relative;
  height: 100%;
  background: var(--paper);
  border: 0;
  display: flex; flex-direction: column;
}

.palette__field {
  display: flex; align-items: center; gap: 10px;
  padding: 12px var(--pad);
  border-bottom: var(--edge) solid var(--rule);
  color: var(--ink-60);
}
.palette__field input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: none;
  font-family: var(--font-ui); font-size: 16px; color: var(--ink);
}

.palette__list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.palette__list li + li { border-top: 2px solid var(--rule); }

.presult {
  display: grid; grid-template-columns: 14px 1fr auto;
  align-items: center; gap: 12px;
  padding: 14px var(--pad); min-height: var(--tap);
  cursor: pointer;
}
.presult[aria-selected="true"] { background: var(--blk-3); color: var(--blk-3-ink); }
.presult__dot { width: 14px; height: 14px; background: var(--c); }
.presult__name { font-weight: 700; font-size: 0.9375rem; }
.presult__sub { font-size: 0.8rem; opacity: .75; }
.presult__tag { font-family: var(--font-mono); font-size: 10px; font-weight: 700; text-transform: uppercase; }

/* Keyboard hints are meaningless without a keyboard. */
.palette__hint { display: none; }
.palette__none { padding: 20px var(--pad); font-family: var(--font-mono); font-size: 13px; color: var(--ink-60); }

/* ============================================================
   640px and up — more room: multi-column grid, tile spans,
   the filter row on one line, the palette as a floating box.
   ============================================================ */

@media (min-width: 640px) {
  :root { --pad: 32px; --gap: 16px; --pop: 6px; }

  .hero { padding: 44px var(--pad) 36px; }
  .hero__blocks { max-width: 300px; gap: 4px; margin-bottom: 26px; }
  .hero__blocks i { height: 20px; }
  .hero__title { font-size: clamp(4rem, 11vw, 7rem); }
  .hero__tagline { font-size: 1.1875rem; max-width: 46ch; margin-top: 24px; }

  .bar { padding: 12px var(--pad); }
  .jump { padding: 0 10px 0 14px; }
  .jump__label, .jump kbd { display: inline-block; }

  .filters {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    padding: 12px var(--pad);
    top: 67px;
  }
  .filters__chips { padding: 0; overflow: visible; flex-wrap: wrap; }
  .chip:hover { background: var(--blk-6); color: var(--blk-6-ink); }
  .search { margin: 0; width: auto; }
  .search input { width: 160px; flex: none; }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
    grid-auto-rows: minmax(250px, auto);
    grid-auto-flow: row dense;
    padding: var(--gap) var(--pad) 56px;
  }
  .tile { padding: 22px; min-height: 250px; }
  .tile--wide { grid-column: span 2; }
  .tile--tall { grid-row: span 2; }

  .tile__name { font-size: clamp(1.35rem, 2.1vw, 1.95rem); margin-top: 26px; }
  .tile--wide .tile__name { font-size: clamp(1.7rem, 3.2vw, 2.9rem); }
  .tile--tall .tile__name { font-size: clamp(1.45rem, 2.4vw, 2.2rem); }

  /* Clamp the blurb only where the tile has a fixed shape to fill. */
  .tile__blurb {
    display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
    -webkit-line-clamp: 4;
  }
  .tile--tall .tile__blurb { -webkit-line-clamp: 10; }
  .tile--wide .tile__blurb { -webkit-line-clamp: 5; }

  .arc { grid-template-columns: 12px 1fr auto auto; gap: 16px; }
  .arc__meta { display: block; }
  .arc:hover { background: var(--paper-2); }

  .archive { padding: 48px var(--pad) 56px; }
  .archive__h { font-size: 1.75rem; }

  .palette__box {
    height: auto; max-height: 74vh;
    max-width: 620px; margin: min(12vh, 90px) auto 0;
    border: var(--edge) solid var(--rule);
    box-shadow: 10px 10px 0 var(--shadow);
  }
  .palette__field input { font-size: 17px; }
  .palette__hint {
    display: flex; gap: 18px; flex-wrap: wrap;
    padding: 10px 16px;
    border-top: var(--edge) solid var(--rule);
    font-family: var(--font-mono); font-size: 11px; color: var(--ink-60);
  }
  .palette__hint kbd { margin-right: 3px; }
  .presult { padding: 12px 16px; }
}

/* ============================================================
   1024px and up — full editorial scale.
   ============================================================ */

@media (min-width: 1024px) {
  :root { --pad: 64px; --gap: 20px; }

  .hero { padding: 72px var(--pad) 48px; }
  .hero__blocks { max-width: 340px; }
  .hero__blocks i { height: 22px; }
  .hero__title { font-size: clamp(6rem, 11vw, 10rem); }
  .hero__tagline { font-size: 1.35rem; }
  .grid { padding-bottom: 72px; }
  .tile { padding: 26px; }
}

@media print {
  .bar, .filters, .palette, .skip, .hero__blocks, .foot__blocks { display: none !important; }
  .tile { box-shadow: none; break-inside: avoid; }
  .tile__blurb { -webkit-line-clamp: none; display: block; overflow: visible; }
}
