/* ==========================================================================
   mikec.design — cleaned stylesheet
   Every rule below is the FINAL value after resolving the old file's layered
   "round" overrides into a single declaration. Nothing here is overridden
   later in the file. Dead rules (.sub, .scene, .mq, .offr/.offl/.wide/.narrow,
   .hl) were removed because no page uses them.
   Renamed: --mono -> --ui (it holds the Inter UI stack, not monospace).
   ========================================================================== */

/* ---------- Fonts ---------- */

@font-face {
  font-family: Pennypacker;
  src: url("fonts/Pennypacker-Compressed-Bold.woff2") format("woff2"),
       url("fonts/Pennypacker-Compressed-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  --bg: #f2e8d5;
  --ink: #111;
  --body: #2d2a25;
  --mute: #6f675b;
  --line: #d3c5ab;
  --accent: #ff3201;
  --at: color-mix(in srgb, #ff3201 78%, #000);
  --ui: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --dot: color-mix(in srgb, var(--ink) 15%, transparent);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #2a1512;
  --ink: #f3e8d8;
  --body: #e6d8c6;
  --mute: #b8a08f;
  --line: #4d2d27;
  --at: color-mix(in srgb, var(--accent) 72%, #fff);
  color-scheme: dark;
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
html, body { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.4px);
  background-size: 6px 6px;
  color: var(--ink);
  font: 18px/1.6 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.home { background-image: none; }

a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--at); }
img { max-width: 100%; }
li { margin: 6px 0; }

::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- Layout ---------- */

.w {
  width: 100%;
  max-width: 832px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 24px);
}

main.w > * { max-width: 720px; }

header {
  position: static;
  background: var(--bg);
  border-bottom: 1px solid var(--ink);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

header .w {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.logo { display: block; line-height: 0; }
.logo img { height: 30px; width: auto; }

nav { display: flex; align-items: center; }
nav a { margin-left: clamp(12px, 3vw, 24px); text-decoration: none; }
nav a:first-child { margin-left: 0; }

footer { margin-top: auto; padding-bottom: 0; font-size: 1.05rem; }
footer .sec { margin-top: clamp(36px, 7vw, 64px); }
footer .sec > div > p a { font-family: var(--ui); font-size: 1rem; }

.rail { display: none; pointer-events: none; }

/* ---------- Type ---------- */

h1 {
  font-family: Pennypacker, "Arial Narrow", Impact, sans-serif;
  font-weight: 700;
  font-size: clamp(3.4rem, 15vw, 8.5rem);
  line-height: .9;
  letter-spacing: -.05em;
  margin: clamp(40px, 8vw, 72px) 0 20px;
}

h2 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 20px;
  font-family: Pennypacker, "Arial Narrow", Impact, sans-serif;
  font-weight: 700;
  font-size: clamp(2.4rem, 9vw, 3.7rem);
  letter-spacing: -.05em;
  line-height: .98;
  margin: 0 0 28px;
}

h2 .no { white-space: nowrap; }

.lede { font-size: clamp(1.125rem, 2.6vw, 1.3rem); color: var(--mute); max-width: 34em; }

.lbl {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  color: var(--ink);
  font: 500 .84rem/1 var(--ui);
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* Checker line after each section label */
.lbl::after {
  content: "";
  flex: 1;
  height: 10px;
  margin-left: 6px;
  background: repeating-conic-gradient(var(--ink) 0 25%, transparent 0 50%) 0 0 / 4px 4px;
}

/* Sunrise mark sitting on the Beginnings label line */
.lbl .rise { flex: none; width: 44px; height: auto; }

.ico { width: 18px; height: 18px; fill: currentColor; shape-rendering: crispEdges; flex: none; }
.ico.sm { width: 14px; height: 14px; }

/* Small-caps UI labels shared by facts, row metadata, and the side rail */
.facts b,
.rows .t i,
.rail span {
  font-family: var(--ui);
  font-weight: 500;
  font-size: .84rem;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px 20px;
  margin: 36px 0 0;
  padding: 20px 0;
  border-block: 1px dotted var(--ink);
  font-size: 1rem;
}

.facts b { display: block; color: var(--mute); }

figcaption, .note, .meta { color: var(--mute); font-size: .96rem; }

/* ---------- Sections and rows ---------- */

.sec { position: relative; margin-top: clamp(56px, 9vw, 96px); }
.sec > div { position: relative; z-index: 1; padding: 0; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { margin: 0; border-top: 1px dotted var(--ink); padding: 18px 0; }
.rows a { text-decoration: none; display: block; }
.rows .t {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: clamp(1.05rem, 3vw, 1.25rem);
  font-weight: 700;
  letter-spacing: -.015em;
}
.rows .t i { font-style: normal; color: var(--mute); white-space: nowrap; align-self: center; }
.rows a:hover .t i, .rows a:focus-visible .t i { color: var(--at); }
.rows p { margin: 4px 0 0; color: var(--mute); font-size: 1.04rem; }
.rows .m { color: var(--at); font-weight: 700; }

/* Project titles inside rows use the condensed display face */
.rows .t .g { font-family: Pennypacker, "Arial Narrow", Impact, sans-serif; font-weight: 700; font-size: 1.25em; }

.pj a {
  display: grid;
  grid-template-columns: clamp(96px, 24vw, 170px) 1fr;
  gap: clamp(12px, 3vw, 24px);
  align-items: center;
}

.th {
  width: 100%;
  height: auto;
  aspect-ratio: 64 / 44;
  display: block;
  border: 2px solid #f3e8d8;
  outline: 2px solid #2a1512;
  image-rendering: pixelated;
  transition: transform .15s steps(2), box-shadow .15s steps(2);
}

.pj:nth-child(odd) .th { transform: rotate(-1.5deg); }
.pj:nth-child(even) .th { transform: rotate(1.5deg); }
.pj a:hover .th, .pj a:focus-visible .th { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--ink); }

.ic { display: grid; grid-template-columns: 34px 1fr; gap: 14px; align-items: start; }
.ic > a { display: block; }
.pi { width: 34px; height: 34px; color: var(--ink); }

/* ---------- Hero ---------- */

.hero { position: relative; overflow: visible; }
.hero > div { position: relative; z-index: 1; padding-bottom: clamp(24px, 5vw, 48px); }

/* The hero headline inherits Pennypacker from the h1 rule above; this rule
   only adjusts its size and spacing. Previously a later ".hero h1" rule set
   font-family: inherit, which beat the heading rule and kept it in Inter. */
.hero h1 {
  margin: 6px 0 16px;
  font-size: clamp(2.8rem, 8vw, 4.8rem);
  letter-spacing: -.04em;
  line-height: 1.04;
}

/* ---------- Decorative pieces ---------- */

.fl { position: absolute; color: var(--ink); pointer-events: none; z-index: 2; image-rendering: pixelated; }
.sky { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.sky .fl { z-index: 0; }

.bleed {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-top: clamp(36px, 7vw, 64px);
  position: relative;
  z-index: 1;
}

.band { display: block; color: var(--ink); width: 100%; }
.sk { margin-top: 40px; }

.skyline { position: relative; margin-top: 96px; line-height: 0; margin-bottom: -1px; }
.skyline .band { display: block; margin: 0; }

.lh {
  position: absolute;
  right: clamp(16px, 8vw, 120px);
  bottom: -12px;
  width: 132px;
  height: 162px;
  color: var(--ink);
  filter: drop-shadow(3px 0 0 var(--bg)) drop-shadow(-3px 0 0 var(--bg)) drop-shadow(0 -3px 0 var(--bg));
}

.cap {
  position: absolute;
  z-index: 4;
  left: clamp(8px, 3vw, 28px);
  bottom: -24px;
  margin: 0;
  max-width: 15em;
  padding: 10px 16px;
  background: #2a1512;
  color: #f3e8d8;
  border: 2px solid #f3e8d8;
  outline: 2px solid #2a1512;
  font: 700 1rem/1.15 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  text-align: center;
  transform: rotate(-2.5deg);
}

.cap.r { left: auto; right: clamp(8px, 4vw, 40px); transform: rotate(2deg); }

/* Animated background canvas (fx.js draws into this) */
.fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: .08;
  image-rendering: pixelated;
  pointer-events: none;
}

/* ---------- Controls ---------- */

.tg {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: clamp(12px, 3vw, 24px);
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.tg:hover { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.tg svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tg .sun { display: none; }
:root[data-theme="dark"] .tg .sun { display: block; }
:root[data-theme="dark"] .tg .moon { display: none; }

.soc { display: flex; flex-wrap: wrap; gap: 12px; list-style: none; padding: 0; margin: 24px 0; }
.soc li { margin: 0; }
.soc a {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  transition: background-color .2s, color .2s;
}
.soc a:hover, .soc a:focus-visible { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.soc svg { width: 20px; height: 20px; }

.top {
  position: fixed;
  right: clamp(12px, 3vw, 24px);
  bottom: clamp(12px, 3vw, 24px);
  z-index: 6;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--ink);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}

.top.show { opacity: 1; pointer-events: auto; transform: none; }
.top:hover, .top:focus-visible { background: var(--ink); color: var(--bg); }
.top svg { width: 20px; height: 20px; fill: currentColor; shape-rendering: crispEdges; }

/* ---------- Next-project cards (case-study pages) ---------- */

.next { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; margin-top: 16px; }
.nx { display: block; text-decoration: none; }
.nx span {
  display: block;
  font-family: Pennypacker, "Arial Narrow", Impact, sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -.015em;
}
.nx:hover span, .nx:focus-visible span { color: var(--at); }
.nx:hover .th, .nx:focus-visible .th { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--ink); }

/* ---------- Tables and figures ---------- */

table { border-collapse: collapse; width: 100%; font-size: 1rem; margin: 16px 0; display: block; overflow-x: auto; }
th, td { border-bottom: 1px dotted var(--ink); padding: 8px 10px; text-align: left; }
th { font-family: var(--ui); font-weight: 500; font-size: .84rem; text-transform: uppercase; letter-spacing: .1em; }
figure { margin: 28px 0; }
figure img { border: 1px solid var(--line); }

/* ---------- Case-study pages ---------- */

.cs h1 { font-size: clamp(2.6rem, 10vw, 5.5rem); margin-top: 40px; }

.cs h2 {
  display: block;
  font-family: Pennypacker, "Arial Narrow", Impact, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin: 48px 0 10px;
  line-height: 1.2;
}

.cs h2::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  background: var(--accent);
  margin-right: 10px;
}

.cs p, .cs li { color: var(--body); }
.cs .meta { margin-top: 0; }
.cs .meta.bk { margin-top: 28px; }

/* Marker highlight for the Role title on project pages */
mark { background: var(--accent); color: var(--bg); padding: .05em .3em; }

.cs .th {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  aspect-ratio: 64 / 44;
  margin: 28px 0 0;
  border: 2px solid #f3e8d8;
  outline: 2px solid #2a1512;
  image-rendering: pixelated;
  transform: rotate(-1.5deg);
}

.cs .nx .th { max-width: none; margin: 0 0 12px; transform: rotate(-1deg); transition: transform .15s steps(2), box-shadow .15s steps(2); }

/* ---------- Glitch hover on project titles ---------- */

.g { position: relative; display: inline-block; font-weight: 700; }
.g::before, .g::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  .rows a:hover .g::before, .rows a:focus-visible .g::before,
  .rows a:hover .g::after, .rows a:focus-visible .g::after { content: attr(data-text); }
  .rows a:hover .g::before, .rows a:focus-visible .g::before { color: var(--accent); animation: gl 1s steps(1) 1 forwards; }
  .rows a:hover .g::after, .rows a:focus-visible .g::after { color: var(--mute); animation: gl2 1s steps(1) 1 forwards; }
  .rows a:hover .g, .rows a:focus-visible .g { animation: gj 1s steps(1) 1; }
}

@keyframes gl {
  0% { clip-path: inset(10% 0 70% 0); transform: translate(-4px, 0px); opacity: 1; }
  12.5% { clip-path: inset(60% 0 10% 0); transform: translate(3px, 1px); opacity: 1; }
  25% { clip-path: inset(30% 0 40% 0); transform: translate(-2px, -1px); opacity: 1; }
  37.5% { clip-path: inset(75% 0 5% 0); transform: translate(4px, 0px); opacity: 1; }
  50% { clip-path: inset(5% 0 80% 0); transform: translate(-3px, 1px); opacity: 1; }
  62.5% { clip-path: inset(45% 0 30% 0); transform: translate(2px, 0px); opacity: 1; }
  75% { clip-path: inset(20% 0 55% 0); transform: translate(-3px, 0px); opacity: 1; }
  87.5% { clip-path: inset(65% 0 15% 0); transform: translate(3px, -1px); opacity: 1; }
  100% { clip-path: inset(0 0 100% 0); opacity: 0; }
}

@keyframes gl2 {
  0% { clip-path: inset(75% 0 5% 0); transform: translate(-4px, 0px); opacity: 1; }
  12.5% { clip-path: inset(5% 0 80% 0); transform: translate(3px, -1px); opacity: 1; }
  25% { clip-path: inset(45% 0 30% 0); transform: translate(-2px, 0px); opacity: 1; }
  37.5% { clip-path: inset(20% 0 55% 0); transform: translate(3px, 0px); opacity: 1; }
  50% { clip-path: inset(65% 0 15% 0); transform: translate(-3px, 1px); opacity: 1; }
  62.5% { clip-path: inset(10% 0 70% 0); transform: translate(4px, 0px); opacity: 1; }
  75% { clip-path: inset(60% 0 10% 0); transform: translate(-3px, -1px); opacity: 1; }
  87.5% { clip-path: inset(30% 0 40% 0); transform: translate(2px, 1px); opacity: 1; }
  100% { clip-path: inset(0 0 100% 0); opacity: 0; }
}

@keyframes gj {
  0%, 25%, 62.5% { transform: none; }
  12.5% { transform: translateX(1px); }
  37.5% { transform: translateX(-1px); }
}

/* ---------- Scroll reveal (driven by the inline script + .js class) ---------- */

.js :is(.lbl, .lede, .facts, .rows li, .cs h2, .cs p, .cs li, .cs table, .sec > div > p, .soc) {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .1, 1);
}

.js :is(.lbl, .lede, .facts, .rows li, .cs h2, .cs p, .cs li, .cs table, .sec > div > p, .soc).in {
  opacity: 1;
  transform: none;
}

.js h1:not(.sp), .js .sec h2:not(.sp) { visibility: hidden; }
.js .wd { display: inline-block; overflow: hidden; vertical-align: top; padding: .14em .08em .28em; margin: -.14em -.08em -.28em; }
.js .wi { display: inline-block; transform: translateY(110%); transition: transform .9s cubic-bezier(.2, .7, .1, 1); }
.js .in .wi { transform: none; }

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  body, header, .tg { transition: background-color .25s, color .25s, border-color .25s; }
  .wv rect { animation: wv 8s steps(16) infinite; }
  .fl:not(.sky .fl) { animation: bob 3s steps(2) infinite alternate; }
}

@keyframes wv { to { transform: translateX(-96px); } }
@keyframes bob { to { transform: translateY(-4px); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- Custom cursors ---------- */

html {
  cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAYAAACN1PRVAAAAfElEQVR4nGNkIAKIcHL9J6TmzfdvjITUMBFjGbUAXS1jIVXDa83vcLbodU6S9I7AYCQmBeJSjytlDt9gZCQmuJBTIC5ATMocIcFITHCRCpCDd4QEIy4wmhoJAZy1K67gJaaKGXllI84qBjkoRhs8hADJDR5SGznIYPgGIwAtSiehpe/6DwAAAABJRU5ErkJggg==) 13 13, auto;
}

a, button, summary, label, [role="button"] {
  cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAYAAACN1PRVAAAAeklEQVR4nGNkIAL8N2L8T0gN47n/jITUMBFjGbUAXS1jIVXDl23X4WweL02S9I7AYCQmBeJSjytlDt9gZCQmuJBTIC5ATMocIcFITHCRCpCDd4QEIy4wmhoJAZy1K67gJaaKGXllI84qBjkoRhs8hABBrzMwjAYjYQAA7bwtylkAOesAAAAASUVORK5CYII=) 13 13, pointer;
}

/* ---------- Wide screens ---------- */

@media (min-width: 1100px) {
  .rail {
    display: flex;
    position: fixed;
    right: 20px;
    top: 0;
    bottom: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
  }

  .rail span { writing-mode: vertical-rl; color: var(--mute); letter-spacing: .3em; }
  .rail i { width: 9px; height: 26px; background: var(--accent); }
}

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

@media (max-width: 819px) {
  .cap { position: relative; bottom: auto; left: auto; display: block; width: fit-content; margin: 18px 14px -14px; }
  .cap.r { right: auto; margin-left: auto; }
}

@media (max-width: 699px) {
  .sky, .fl:not(.hero .fl) { display: none; }
}
