/* ==========================================================================
   bilewi.cz — colour-block personal site
   Palette, layout and section panels. Content comes from /content.json.
   ========================================================================== */

:root {
  /* Palette */
  --ink:    #0E0E0E;
  --paper:  #F2EFE6;
  --yellow: #FFD200;
  --blue:   #2340FF;
  --pink:   #FF3D8A;
  --green:  #00D48A;
  --orange: #FF6A1A;

  /* Per-block colours, overridden by the .c-* classes */
  --block: var(--paper);
  --on-block: var(--ink);

  --gap: 10px;
  --radius: 4px;

  --font-display: 'Archivo Black', 'Arial Black', Impact, sans-serif;
  --font-body: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

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

/* Block colour scheme classes ------------------------------------------- */
.c-paper  { --block: var(--paper);  --on-block: var(--ink); }
.c-yellow { --block: var(--yellow); --on-block: var(--ink); }
.c-blue   { --block: var(--blue);   --on-block: var(--paper); }
.c-pink   { --block: var(--pink);   --on-block: var(--ink); }
.c-green  { --block: var(--green);  --on-block: var(--ink); }
.c-orange { --block: var(--orange); --on-block: var(--ink); }
.c-ink    { --block: var(--ink);    --on-block: var(--paper); }

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

/* A class with a `display` beats the UA rule for [hidden], so make it stick. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100dvh;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.is-panel-open { overflow: hidden; }

a { color: inherit; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--paper);
  color: var(--ink);
  padding: 12px 18px;
  font-weight: 700;
}
.skip:focus { left: 8px; top: 8px; }

:where(a, button, [tabindex]):focus-visible {
  outline: 4px solid var(--yellow);
  outline-offset: -4px;
}

/* ==========================================================================
   Landing grid
   ========================================================================== */

.grid {
  display: grid;
  gap: var(--gap);
  padding: var(--gap);
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  grid-auto-flow: row dense;
  height: 100dvh;
}

.tile {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--block);
  color: var(--on-block);
  border-radius: var(--radius);
  text-decoration: none;
  container-type: inline-size;
}

.tile__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: clamp(14px, 2.2cqw + 8px, 34px);
}

/* Sizing of each block in the poster grid */
.tile--name     { grid-column: span 3; grid-row: span 2; }
.tile--about    { grid-row: span 2; }
.tile--projects { grid-column: span 2; grid-row: span 2; }
.tile--writing  { grid-row: span 2; }
.tile--name     { background: var(--paper); color: var(--ink); }

/* Name block ------------------------------------------------------------ */
.name {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: -0.035em;
  line-height: 0.9;
  font-size: clamp(2.6rem, 7.5cqw, 7rem);
  margin-top: 0.14em;
  /* Hold the name to a narrow measure so a first/last name stacks into a
     block instead of running out as one thin line across a wide tile. */
  max-width: 11ch;
  overflow-wrap: anywhere;
}

.role {
  font-size: clamp(15px, 1.6cqw + 8px, 26px);
  font-weight: 600;
  margin-top: 0.7em;
  max-width: 26ch;
}

.intro {
  font-size: clamp(14px, 0.9cqw + 9px, 18px);
  margin-top: 0.8em;
  max-width: 46ch;
  opacity: 0.75;
}

.links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  /* Floor the distance from the intro — `margin-top: auto` collapses to zero
     as soon as the block is full, which used to jam these against the text. */
  padding-top: 26px;
}

.links a {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.18s var(--ease), background-color 0.18s var(--ease);
}
.links a:hover { transform: translateY(-2px); background: var(--blue); }

/* Section blocks -------------------------------------------------------- */
.tile--link .tile__inner {
  justify-content: flex-end;
  /* Descenders (the j in "projects") need more room than the shared padding
     gives, or the word looks like it is resting on the edge of the block. */
  padding-bottom: clamp(20px, 2.6cqw + 12px, 46px);
}

.tile__label {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: -0.03em;
  line-height: 0.95;
  font-size: clamp(1.5rem, 12cqw, 4.75rem);
  order: 2;
}

.tile__meta {
  order: 1;
  font-size: clamp(11px, 1cqw + 6px, 14px);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: auto;
  padding-bottom: 12px;
}

.tile__arrow {
  position: absolute;
  top: clamp(14px, 2.2cqw + 8px, 34px);
  right: clamp(14px, 2.2cqw + 8px, 34px);
  font-size: clamp(20px, 3cqw, 34px);
  line-height: 1;
  transition: transform 0.3s var(--ease);
}

.tile--link { transition: filter 0.25s var(--ease); }
.tile--link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  pointer-events: none;
}
.tile--link:hover::after,
.tile--link:focus-visible::after { opacity: 0.08; }
.tile--link:hover .tile__arrow,
.tile--link:focus-visible .tile__arrow { transform: translate(6px, -6px); }
.tile--link:active { filter: brightness(0.94); }

/* Responsive ------------------------------------------------------------ */
@media (max-width: 1000px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    height: auto;
    min-height: 100dvh;
    grid-auto-rows: minmax(clamp(120px, 22vw, 200px), auto);
  }
  .tile--name     { grid-column: span 2; grid-row: span 2; }
  .tile--about    { grid-row: span 1; }
  .tile--projects { grid-column: span 2; grid-row: span 1; }
  .tile--writing  { grid-row: span 1; }
}

@media (max-width: 560px) {
  .grid {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(112px, auto);
  }
  /* Let the name block size to its own text rather than leaving dead space. */
  .tile--name { grid-column: span 1; grid-row: span 1; }
  .tile--about, .tile--writing { grid-row: span 1; }
  .tile--projects { grid-column: span 1; }
  .tile__label { font-size: clamp(2rem, 13cqw, 3.6rem); }
}

/* ==========================================================================
   Section panels
   ========================================================================== */

.panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--block);
  color: var(--on-block);
  overflow-y: auto;
  overscroll-behavior: contain;
  visibility: hidden;
  opacity: 0;
  transform: translateY(2.5vh);
  transition: opacity 0.32s var(--ease), transform 0.32s var(--ease), visibility 0.32s;
}

.panel.is-open {
  visibility: visible;
  opacity: 1;
  transform: none;
}

.panel__bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(18px, 5vw, 72px);
  background: var(--block);
  border-bottom: 2px solid currentColor;
}

.panel__back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 6px 2px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.panel__back span { transition: transform 0.2s var(--ease); display: inline-block; }
.panel__back:hover span { transform: translateX(-4px); }

.panel__body {
  padding: clamp(28px, 6vw, 80px) clamp(18px, 5vw, 72px) clamp(80px, 12vw, 140px);
  max-width: 1180px;
}

.panel__title:focus-visible { outline-offset: 8px; }

.panel__title {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: -0.04em;
  line-height: 0.9;
  font-size: clamp(2.5rem, 8vw, 6rem);
}

.panel__intro {
  font-size: clamp(17px, 1.4vw + 12px, 24px);
  font-weight: 500;
  margin-top: 1.5rem;
  max-width: 44ch;
  opacity: 0.8;
}

.prose {
  margin-top: clamp(28px, 4vw, 48px);
  max-width: 60ch;
  font-size: clamp(16px, 0.6vw + 14px, 19px);
}
.prose p + p { margin-top: 1.1em; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose strong { font-weight: 700; }
.prose code {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.9em;
  padding: 0.12em 0.36em;
  border-radius: 3px;
  background: rgb(0 0 0 / 0.12);
}

/* Cards (projects) ------------------------------------------------------ */
.cards {
  list-style: none;
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  margin-top: clamp(28px, 4vw, 48px);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(20px, 2.4vw, 32px);
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  text-decoration: none;
  min-height: 190px;
  transition: transform 0.22s var(--ease);
}
.card[href]:hover { transform: translateY(-5px); }

.card__year {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.5;
}

.card__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.4rem, 1.4vw + 1rem, 2.1rem);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-top: 6px;
  text-transform: lowercase;
}

.card__blurb { margin-top: 12px; opacity: 0.78; font-size: 15px; }

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 18px;
}
.tags li {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  opacity: 0.7;
}

.card__go {
  position: absolute;
  top: clamp(20px, 2.4vw, 32px);
  right: clamp(20px, 2.4vw, 32px);
  font-size: 20px;
  transition: transform 0.22s var(--ease);
}
.card[href]:hover .card__go { transform: translate(4px, -4px); }

/* Notes (writing) ------------------------------------------------------- */
.notes { list-style: none; margin-top: clamp(28px, 4vw, 48px); max-width: 62ch; }

.note { border-top: 2px solid currentColor; padding: clamp(22px, 3vw, 34px) 0; }
.note:last-child { border-bottom: 2px solid currentColor; }

.note__date {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.6;
}

.note__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 2vw + 1rem, 2.4rem);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-top: 8px;
  text-transform: lowercase;
}

.note .prose { margin-top: 14px; }

/* Now ------------------------------------------------------------------- */
.nowlist { list-style: none; margin-top: clamp(28px, 4vw, 40px); max-width: 60ch; }
.nowlist li {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 2px solid currentColor;
}
.nowlist dt, .nowlist .k {
  flex: 0 0 auto;
  min-width: 9rem;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.6;
}
.nowlist .v { font-size: clamp(16px, 0.6vw + 14px, 20px); font-weight: 600; }

/* Photos ---------------------------------------------------------------- */
.gallery {
  list-style: none;
  columns: 3 260px;
  column-gap: var(--gap);
  margin-top: clamp(28px, 4vw, 48px);
}
.gallery li {
  break-inside: avoid;
  margin-bottom: var(--gap);
}
.gallery img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: rgb(0 0 0 / 0.1);
}
.gallery figcaption {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.7;
  padding-top: 8px;
}

/* Empty state ----------------------------------------------------------- */
.empty {
  margin-top: clamp(28px, 4vw, 48px);
  padding: clamp(24px, 4vw, 44px);
  border: 3px dashed currentColor;
  border-radius: var(--radius);
  font-weight: 600;
  opacity: 0.7;
  max-width: 46ch;
}

/* Live presence (Discord / Spotify) ------------------------------------- */
.presence { margin-top: clamp(28px, 4vw, 44px); max-width: 620px; }

/* Sits in its own dark pill so the status colours stay readable whatever
   colour the surrounding block happens to be. */
.presence__status {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.presence__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.presence__status--online  .presence__dot { background: #1DB954; }
.presence__status--idle    .presence__dot { background: #E8A319; }
.presence__status--dnd     .presence__dot { background: #E23B3B; }
.presence__status--offline .presence__dot { background: #6B6B6B; }

.presence__custom {
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
  opacity: 0.7;
}

.presence__cards { display: grid; gap: var(--gap); margin-top: 14px; }

.presence__card {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
}

.presence__art {
  width: 92px;
  height: 92px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 3px;
  background: rgb(255 255 255 / 0.08);
}
.presence__art--small { width: 56px; height: 56px; }

.presence__text { min-width: 0; flex: 1; }

.presence__kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.5;
}

.presence__title {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.25;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.presence__sub { font-size: 14px; opacity: 0.8; overflow-wrap: anywhere; }
.presence__album { font-size: 13px; opacity: 0.55; overflow-wrap: anywhere; }

.presence__bar {
  height: 5px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.18);
  margin-top: 12px;
  overflow: hidden;
}
.presence__fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: #1DB954;
  transition: width 1s linear;
}

.presence__clock {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
  margin-top: 5px;
}

.presence__link {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 460px) {
  .presence__card { flex-direction: column; align-items: flex-start; }
  .presence__art { width: 100%; height: auto; aspect-ratio: 1; }
}

/* Loading / error status ------------------------------------------------ */
.status {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 90;
  background: var(--paper);
  color: var(--ink);
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.35);
  max-width: min(92vw, 560px);
  text-align: center;
}

/* ==========================================================================
   DOOM (Konami code)
   ========================================================================== */

body.is-game-open { overflow: hidden; }

.doom {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  flex-direction: column;
  background: var(--ink);
  color: var(--paper);
}
.doom.is-open { display: flex; }
.doom:focus { outline: none; }

.doom__chrome {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(12px, 2vw, 22px);
  border-bottom: 2px solid #262626;
}

.doom__title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: lowercase;
  color: var(--orange);
}

.doom__close {
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 13px;
  border-radius: var(--radius);
  border: 2px solid currentColor;
  background: none;
  color: inherit;
  cursor: pointer;
}
.doom__close:hover { background: var(--paper); color: var(--ink); }

/* js-dos injects its own player in here and sizes itself to the box. */
.doom__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #000;
}

/* js-dos renders its player into the same box, so this has to sit above it —
   otherwise error messages are painted over and all you get is a blank
   rectangle with no explanation. */
.doom__status {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: var(--ink);
  display: grid;
  place-content: center;
  justify-items: start;
  gap: 4px;
  padding: clamp(20px, 5vw, 60px);
}
.doom__status > * { max-width: 62ch; }

.doom__msgTitle {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: lowercase;
  margin-bottom: 12px;
}

.doom__msgLine { font-size: 15px; opacity: 0.7; margin-top: 8px; }

.doom__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.doom__btn, .doom__pick {
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: var(--radius);
  border: 0;
  background: var(--orange);
  color: var(--ink);
  cursor: pointer;
  margin-top: 22px;
  display: inline-block;
}
.doom__btn { margin-top: 0; }
.doom__btn:hover, .doom__pick:hover { filter: brightness(1.1); }

.doom__file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.doom__hint {
  flex: 0 0 auto;
  text-align: center;
  padding: 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.4;
}
.doom__hint:empty { display: none; }

/* Motion preferences ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .tile--link, .panel { display: none; }
}
