/* =========================================================
   Butler Bots — styles
   Palette: off-white, near-black, red
   ========================================================= */

:root {
  --bg: #f7f7f5;
  --ink: #111111;
  --muted: #5c5c5a;
  --line: #111111;
  --line-soft: #d9d9d5;
  --red: #e63e1b;
  --red-soft: rgba(230, 62, 27, 0.18);

  --font: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gutter: clamp(16px, 2.5vw, 40px);
  --max: 1600px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* the sticky header is ~60px; keep anchored sections clear of it */
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }

.accent { color: var(--red); }
.arrow { display: inline-block; margin-left: 0.35em; font-size: 0.85em; }

::selection { background: var(--red); color: var(--bg); }

/* Visible keyboard focus everywhere, without ringing on mouse clicks. */
:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
  border-radius: 2px;
}
.skip-link:focus-visible { outline-color: var(--ink); }

/* Skip link: off-screen until focused, then pinned top-left. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 12px 20px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.skip-link:focus {
  left: var(--gutter);
  top: 12px;
}

/* Anchored sections clear the sticky header (belt and braces with
   scroll-padding, which older Safari ignores). */
[id] { scroll-margin-top: 88px; }

/* small uppercase label style used across the site */
.nav a,
.cta,
.brand,
.meta-row,
.section-label,
.link,
.tag {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 600; }

.nav { display: flex; gap: 32px; justify-content: center; }
.nav a:hover, .cta:hover, .link:hover { color: var(--red); }

.cta { justify-self: end; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 22px var(--gutter) 96px;
  max-width: var(--max);
  margin: 0 auto;
  overflow: hidden;
}

/* cursor-following dot matrix behind the hero */
.grain-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.grain-field canvas { display: block; width: 100%; height: 100%; }

/* Resting dot halo: what shows before the cursor arrives, and the
   whole effect on touch devices. Matches the canvas grid spacing so
   the live field reads as the same lattice waking up, not a second one.
   Fades out on hover while the canvas takes over. */
.hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: -40px;
  left: 14%;
  width: 560px;
  height: 560px;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(230, 62, 27, 0.22) 1.3px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0%, rgba(0,0,0,0.6) 40%, transparent 68%);
          mask-image: radial-gradient(circle at 50% 50%, #000 0%, rgba(0,0,0,0.6) 40%, transparent 68%);
  transition: opacity 0.45s ease;
}

@media (hover: hover) {
  .hero:hover::before { opacity: 0; }
}

.meta-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  margin-bottom: clamp(64px, 10vw, 140px);
}

.status { display: inline-flex; align-items: center; gap: 8px; }
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.headline {
  position: relative;
  font-size: clamp(48px, 9.4vw, 148px);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.045em;
  max-width: 12ch;
}

.hero-foot {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
  margin-top: clamp(48px, 7vw, 96px);
}

.intro { max-width: 520px; font-size: 15px; color: var(--muted); }

/* ---------- Sections ---------- */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) 120px;
}

.section-label {
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 48px;
  border-bottom: 1px solid var(--line);
}
.section-label .rule { width: 22px; height: 1px; background: var(--ink); }

/* Featured case */
.featured {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 2fr;
  gap: 48px;
}

.featured-text { display: flex; flex-direction: column; }

.featured h2 {
  font-size: clamp(34px, 3.6vw, 56px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.035em;
  margin-bottom: 20px;
}

.tag {
  align-self: flex-start;
  padding: 4px 8px;
  border: 1px solid var(--ink);
  margin-bottom: 28px;
}

.featured h3 {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 18px;
}

.highlights li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 14px;
  font-size: 16px;
}
.highlights li::before {
  content: "\2022";
  position: absolute;
  left: 8px;
  color: var(--ink);
}

.button {
  display: inline-block;
  align-self: flex-start;
  margin-top: auto;
  padding: 12px 40px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.button:hover { background: var(--red); }

/* Embedded demo on the home page (shares .demo-bar with work/case.css) */
.featured-media {
  border: 1px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.featured-media .demo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ink);
  background: var(--bg);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.featured-media .demo-bar .left { display: inline-flex; align-items: center; gap: 10px; }
.featured-media .demo-bar .dot { background: var(--red); }
.featured-media .demo-bar a:hover { color: var(--red); }
.featured-media iframe {
  display: block;
  width: 100%;
  height: clamp(480px, 60vh, 720px);
  border: 0;
  background: #fff;
}
.list-note {
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
}

.featured-media img {
  width: 100%;
  border-radius: 6px;
}

/* Project list */
.project-list li { border-bottom: 1px solid var(--line-soft); }
.project-list li:first-child { border-top: 1px solid var(--line-soft); }
.project-list a {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 24px;
  padding: 22px 0;
  align-items: baseline;
}
.project-list a:hover .project-name { color: var(--red); }
.project-name {
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 500;
  letter-spacing: -0.03em;
}
.project-desc { color: var(--muted); font-size: 15px; }
.project-year { font-size: 13px; text-transform: uppercase; }

/* About */
.statement {
  font-size: clamp(28px, 3.6vw, 54px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.035em;
  max-width: 20ch;
  margin-bottom: 64px;
}

.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.principle {
  padding-top: 16px;
  border-top: 1px solid var(--ink);
}
.principle-key {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 12px;
}
.principle p { font-size: 16px; max-width: 34ch; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 96px var(--gutter) 32px;
  max-width: var(--max);
  margin: 0 auto;
}

.footer-headline {
  font-size: clamp(36px, 6vw, 96px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.045em;
  max-width: 14ch;
  margin-bottom: 40px;
}

.link.large { font-size: clamp(16px, 1.6vw, 22px); }

.footer-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 96px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .featured { grid-template-columns: 1fr; }
  .featured-media { order: -1; }
  .button { margin-top: 28px; }
  .principles { grid-template-columns: 1fr; }
  .project-list a { grid-template-columns: 1fr; gap: 6px; }
}

@media (max-width: 640px) {
  .site-header { grid-template-columns: 1fr auto; row-gap: 12px; }
  .nav { grid-column: 1 / -1; justify-content: flex-start; gap: 20px; }
  .cta { grid-row: 1; grid-column: 2; }
  .hero::before { left: -10%; width: 420px; height: 420px; }
  .hero-foot { flex-direction: column; align-items: flex-start; }
  .headline { max-width: none; }
}

/* ---------- Motion & interaction polish ---------- */

/* Smooth hover transitions on the things that actually change colour. */
.nav a, .cta, .link, .brand, .crumbs a,
.project-list a .project-name,
.next-project .project-name,
.button, .demo-bar a {
  transition: color 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
}

/* The whole project row lifts slightly on hover, so the target reads as one unit. */
.project-list a, .next-project { transition: padding-left 0.18s ease; }
.project-list a:hover, .next-project:hover { padding-left: 8px; }

/* Respect the OS motion setting: no smooth scroll, no transitions, no shift. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .project-list a:hover, .next-project:hover { padding-left: 0; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .grain-field, .demo-bar, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .hero { color: #000; padding-top: 0; }
  .hero::before { display: none; }
  .section { padding-bottom: 32px; page-break-inside: avoid; }
  a[href^="http"]::after,
  a[href^="mailto"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  iframe { display: none; }
}
