/* Pixel Art, for /worlds/minecraft/ and /crafting-table/ (style: pixel-art).

   16×16: the world drawn in its own textures. Stepped corners, shading by
   dithering instead of blur, item slots for lists, a pixel face for the
   headings only, and the tool tiers as blocks of their own material. The
   world page is the world itself (terrain, ore and blocks); the Crafting
   Table, its interface, is already Minecraft's menu GUI, so it keeps that
   look and takes the details at the foot of this file. The spec's cards:
   docs/superpowers/specs/2026-10-11-page-styles-design.md, "Minecraft: Pixel
   Art" and section 9.

   Everything here is scoped to :root[data-style="pixel-art"], so this file
   does nothing on a page that is not wearing it. */

/* ── the tokens ──────────────────────────────────────────────────────────
   One pixel is 4px. A block is a deepslate slab: square, outlined in black
   on all four sides by hard shadows (which leaves each corner a pixel short,
   the stepped corner), lit from the upper left by a one-pixel bevel. There
   is no clip-path anywhere: it would clip the outline it is meant to draw. */
:root[data-style="pixel-art"] {
  --px: 4px;
  --pa-edge: #000;
  --pa-step:
    0 calc(-1 * var(--px)) 0 0 var(--pa-edge), 0 var(--px) 0 0 var(--pa-edge),
    calc(-1 * var(--px)) 0 0 0 var(--pa-edge), var(--px) 0 0 0 var(--pa-edge);
  --pa-bevel:
    inset var(--px) var(--px) 0 rgba(255, 255, 255, 0.09),
    inset calc(-1 * var(--px)) calc(-1 * var(--px)) 0 rgba(0, 0, 0, 0.4);
  /* the 2x2 dither that stands in for every soft shadow and hover glow */
  --pa-dither: repeating-conic-gradient(rgba(0, 0, 0, 0.2) 0 25%, transparent 0 50%);

  /* deepslate at night: dark enough that every caption in a tier's own
     colour keeps 4.5:1 on it */
  --s-surface: rgba(16, 16, 19, 0.95);
  --s-surface-hi: rgba(28, 28, 32, 0.96);
  --s-edge: var(--pa-edge);
  --s-bw: 0px;
  --s-r: 0px;
  --s-r-sm: 0px;
  --s-shadow: var(--pa-step), var(--pa-bevel);
  --s-shadow-hi: var(--pa-step), var(--pa-bevel);
  --s-lift: -4px;

  --s-display: "Pixelify Sans", var(--mono, monospace);   /* an interface defines no --mono */
  --s-display-w: 700;
  --s-display-ls: 0;

  /* Minecraft's own yellow text for the keyboard ring */
  --s-focus: #ffff55;

  /* the bars: deepslate slabs with the same outline and bevel, and no glass */
  --s-bar: #1e1e22;
  --s-bar-edge: #000;
  --s-bar-r: 0px;
  --s-bar-blur: none;
  --s-bar-shadow: var(--pa-step), inset 2px 2px 0 rgba(255, 255, 255, 0.12), inset -2px -2px 0 rgba(0, 0, 0, 0.5);

  /* dithering replaces the film grain, the circuit field goes, and the HUD
     lattice becomes block lines: 32px, two pixels' worth of world per cell */
  --s-grain: 0;
  --s-field: 0;
  --hud-cell: 32px;
  --hud-grid: rgba(255, 255, 255, 0.035);
}
/* No page-wide accent: every tile and card sets its own --a (a dimension's
   red, a boss's lavender) and the shared rules fall back to it. Only the
   tab bar, outside every item, takes the world's own green (--a on <body>). */
:root[data-style="pixel-art"] .tabbar { --s-accent: var(--a); }

/* ── blocks ──────────────────────────────────────────────────────────────── */
:root[data-style="pixel-art"] :is(.fan-card, .fan-tile, .fan-linkcard, .fan-iface, .fan-link, .wsib-i a) {
  box-shadow: var(--pa-step), var(--pa-bevel);
}
:root[data-style="pixel-art"] .fan-link { background: #36363b; }
@media (hover: hover) {
  :root[data-style="pixel-art"] :is(.fan-card, .fan-tile, .fan-linkcard, .fan-link, .wsib-i a):hover {
    background-image: var(--pa-dither); background-size: var(--px) var(--px);
  }
}

/* the enchantment glint: a violet sheen crossing a block while it is held
   under the pointer, moved by transform only, and never with reduced motion */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  :root[data-style="pixel-art"] :is(.fan-card, .fan-tile) { position: relative; overflow: hidden; }
  :root[data-style="pixel-art"] :is(.fan-card, .fan-tile)::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(115deg, transparent 35%, rgba(168, 102, 255, 0.3) 50%, transparent 65%);
    transform: translateX(-100%); opacity: 0;
  }
  :root[data-style="pixel-art"] :is(.fan-card, .fan-tile):hover::after {
    opacity: 1; animation: pa-glint 1.6s linear infinite;
  }
}
@keyframes pa-glint { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ── headings in the pixel face; reading text stays Inter ─────────────── */
:root[data-style="pixel-art"] :is(.fan-title, .fan-card :is(h2, h3, h4, h5), .fan-rankhead b, .fan-tiletext b, .fan-what b, .subsec--fan) {
  font-family: var(--s-display); font-weight: 700; letter-spacing: 0;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.7);
}
:root[data-style="pixel-art"] .subsec--fan { font-size: 0.86rem; letter-spacing: 0.06em; }

/* a tile's caption and a card's subtitle are set in that item's own colour,
   and the darker ones (coal, the Wither, the Nether's red) fall far under
   4.5:1 on a dark block. Here each is that colour lifted 40% toward white,
   at full strength: still the material, and readable on every block */
:root[data-style="pixel-art"] :is(.fan-tiletext i, .fan-card .fan-sub) { color: color-mix(in srgb, var(--a) 60%, #fff); opacity: 1; }
/* the same lift for each item's tag, Listen link and Play button. :where
   keeps it at the shared rules' weight, so hovering and playing still win */
:where(:root[data-style="pixel-art"]) :is(.fan-tag, .fan-visit, .fan-hear) { color: color-mix(in srgb, var(--a) 60%, #fff); }

/* ── lists as item slots: a recessed square, dark at the top left ─────── */
:root[data-style="pixel-art"] .fan-chips > * {
  border: 0; border-radius: 0;
  background: #2b2b2e;
  box-shadow: inset 2px 2px 0 #111, inset -2px -2px 0 #5a5a5e;
}

/* the interface peek's live light: a square pixel, not a glow */
:root[data-style="pixel-art"] .fan-peek-dot { border-radius: 0; box-shadow: none; }

/* nothing is round in a world of blocks: the interface arrow, the timeline
   ticks, key caps and the server list come square too */
:root[data-style="pixel-art"] :is(.fan-iface-a, .mcs, main kbd),
:root[data-style="pixel-art"] .fan-tick::before { border-radius: 0; }

/* ── swatches: square, no glow ────────────────────────────────────────── */
:root[data-style="pixel-art"] .fan-swatch {
  border-radius: 0;
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.4);
}

/* ── the signature: each tool tier is a block of its own material ────────
   A 4x4 texture in four tones of the tier's colour (--a, set on each tile):
   the colour itself, a highlight, and two shades, laid out in a fixed
   pattern so wood, stone, copper and the rest all read as the same kind of
   block in different materials. Drawn square, never smoothed. */
:root[data-style="pixel-art"] #tiers .fan-swatch {
  --tl: color-mix(in srgb, var(--a), #fff 24%);
  --t1: color-mix(in srgb, var(--a), #000 12%);
  --t2: color-mix(in srgb, var(--a), #000 24%);
  width: 64px; height: 64px; margin-top: 0;
  background-color: var(--a);
  background-image:
    linear-gradient(var(--tl), var(--tl)), linear-gradient(var(--t1), var(--t1)),
    linear-gradient(var(--tl), var(--tl)), linear-gradient(var(--t2), var(--t2)),
    linear-gradient(var(--t1), var(--t1)), linear-gradient(var(--tl), var(--tl)),
    linear-gradient(var(--t1), var(--t1)), linear-gradient(var(--t1), var(--t1)),
    linear-gradient(var(--t2), var(--t2));
  background-size: 25% 25%;
  background-repeat: no-repeat;
  background-position:
    0 0, 66.667% 0,
    100% 33.333%, 33.333% 33.333%,
    0 66.667%, 66.667% 66.667%, 100% 66.667%,
    33.333% 100%, 66.667% 100%;
  image-rendering: pixelated;
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.3), inset 4px 4px 0 rgba(255, 255, 255, 0.12);
}
@media (max-width: 640px) {
  :root[data-style="pixel-art"] #tiers .fan-swatch { width: 48px; height: 48px; }
}

/* ── the bars ──────────────────────────────────────────────────────────────
   The header buttons keep their tints, outlined in solid pixels (pixel art
   has no see-through edges), so they stand out from the slab at least as
   well as they did from the glass. :where keeps each at its shared rule's
   weight: hover, and the sound switch's on state, still win. */
:where(:root[data-style="pixel-art"]) .ql { border-color: #5a5a5e; }
:where(:root[data-style="pixel-art"]) .ql--resume { border-color: var(--green); }
:where(:root[data-style="pixel-art"]) .ql--linkedin { border-color: var(--blue); }
:where(:root[data-style="pixel-art"]) .ql--github { border-color: var(--gold); }

/* The current tab sits in a recessed slot, like the selected hotbar slot. */
:root[data-style="pixel-art"] .tabbar a.is-current,
:root[data-style="pixel-art"] .tabbar a.is-going {
  background: #2b2b2e;
  box-shadow: inset 2px 2px 0 #111, inset -2px -2px 0 #5a5a5e;
}

/* ── the Crafting Table ────────────────────────────────────────────────────
   Already Minecraft's own menu GUI on a daylight sky, so it keeps all of
   that and takes the world page's details. */

/* Nothing is round in a world of blocks, and the GUI windows were the one
   rounded thing here. They take the game's own corner instead, the outline
   stepped in by a pixel, cut so the drop shadow under each window stays. */
:root[data-style="pixel-art"] .ct-gui {
  border-radius: 0;
  clip-path: polygon(2px 0, calc(100% - 2px) 0, calc(100% - 2px) 2px, 100% 2px,
    100% calc(100% + 8px), calc(100% - 2px) calc(100% + 8px), calc(100% - 2px) calc(100% + 10px),
    2px calc(100% + 10px), 2px calc(100% + 8px), 0 calc(100% + 8px), 0 2px, 2px 2px);
}

/* The world button, a glassy pill on every other interface, is a block of
   the world it leads to: the world page's deepslate slab, with its black
   outline and bevel, the name in the Minecraft green this page already set
   for it, and the pixel face. Hover lights the rim, the way a button does
   in the game. */
:root[data-style="pixel-art"] .ct .iw {
  border-radius: 0; border-color: #000;
  background: #1e1e22;
  box-shadow: 0 0 0 1px #000, inset 2px 2px 0 rgba(255, 255, 255, .12), inset -2px -2px 0 rgba(0, 0, 0, .5);
  color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, .7);
  font-family: var(--px);
}
:root[data-style="pixel-art"] .ct .iw-i { border-radius: 0; background: #2b2b2e; color: var(--green); box-shadow: inset 1px 1px 0 #111; }
:root[data-style="pixel-art"] .ct .iw-k { opacity: 1; color: #d0d0d0; }
:root[data-style="pixel-art"] .ct .iw-t b { font-family: var(--px); color: var(--green); }
:root[data-style="pixel-art"] .ct .iw-a { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  :root[data-style="pixel-art"] .ct .iw:hover {
    transform: none; border-color: #fff; background: #2b2b2e;
    box-shadow: 0 0 0 1px #fff, inset 2px 2px 0 rgba(255, 255, 255, .12), inset -2px -2px 0 rgba(0, 0, 0, .5);
  }
  :root[data-style="pixel-art"] .ct .iw:hover .iw-t b { color: var(--splash); }
}

/* the enchantment glint, on the world page's cards, crosses an inventory
   slot here while you point at it */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  :root[data-style="pixel-art"] .ct-item .ct-slot { overflow: hidden; }
  :root[data-style="pixel-art"] .ct-item .ct-slot::before {
    content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: linear-gradient(115deg, transparent 35%, rgba(168, 102, 255, .45) 50%, transparent 65%);
    transform: translateX(-100%); opacity: 0;
  }
  :root[data-style="pixel-art"] .ct-item:hover .ct-slot::before { opacity: 1; animation: pa-glint 1.6s linear infinite; }
}

/* The keyboard ring, as on the world page, is the game's yellow text, and
   this page's ground runs from a day sky to a night one, so a ring is drawn
   where its own ground is known. A control with its own fill (a stone
   button, the Esc button, the world button) carries the ring inside its
   black rim, on its fill, whatever the sky is doing. Inside the light gray
   windows the token turns black: the block-selection outline, the thin
   black frame the game draws round the block you look at. The hotbar and
   the game menu keep their own white rings, which sit on dark. */
:root[data-style="pixel-art"] .ct-gui { --s-focus: #000; }
:root[data-style="pixel-art"] .ct :is(.ct-main, .ct-top) :focus-visible {
  outline: 2px solid var(--s-focus); outline-offset: 2px;
}
:root[data-style="pixel-art"] .ct :is(.ct-btn, .ct-escbtn):focus-visible { outline-offset: -4px; }
:root[data-style="pixel-art"] .ct .iw:focus-visible { outline-offset: -3px; }
