/* =========================================================================
   Matthew Beaconsfield — Builds
   A single stylesheet for the whole portfolio. No build step, no framework.
   ========================================================================= */

:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --surface-2: #f4f2ee;
  --border: #e7e3dc;
  --text: #1c1a17;
  --text-soft: #5b554c;
  --text-faint: #8b8479;
  --accent: #1c1a17;
  --accent-soft: #2f2b26;

  /* Tool brand colours */
  --claude: #d97757;   /* Anthropic coral */
  --codex: #10a37f;    /* OpenAI green */

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(28, 26, 23, .04), 0 8px 24px rgba(28, 26, 23, .06);
  --maxw: 1080px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130f;
    --surface: #1d1b16;
    --surface-2: #24211b;
    --border: #322e26;
    --text: #f4f1ea;
    --text-soft: #c3bdb0;
    --text-faint: #8b8479;
    --accent: #f4f1ea;
    --accent-soft: #d9d4c8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
  transition: transform .3s ease, opacity .3s ease;
}
/* Hidden on arrival (top of page); revealed once scrolled. JS toggles .is-visible. */
.site-header:not(.is-visible) {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { text-decoration: none; display: flex; align-items: baseline; gap: 10px; }
.brand-name { font-weight: 650; letter-spacing: -.01em; }
.header-nav { display: flex; gap: 22px; font-size: 14px; }
.header-nav a { text-decoration: none; color: var(--text-soft); transition: color .15s; }
.header-nav a:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero { padding: 92px 0 64px; position: relative; }
.hero::before {
  /* soft radial wash to add depth without imagery */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 70% at 15% -10%, color-mix(in srgb, var(--claude) 14%, transparent), transparent 60%),
    radial-gradient(55% 60% at 95% 0%, color-mix(in srgb, var(--codex) 12%, transparent), transparent 60%);
}
.hero-eyebrow {
  font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); margin: 0 0 18px; font-weight: 600;
}
.hero h1 {
  font-size: clamp(2.3rem, 6vw, 4rem);
  line-height: 1.04; letter-spacing: -.03em; margin: 0 0 20px;
}
.lede { font-size: clamp(1.02rem, 2vw, 1.24rem); color: var(--text-soft); max-width: 58ch; margin: 0 0 30px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-builtwith { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 34px; }
.hbw-label { font-size: 12.5px; color: var(--text-faint); letter-spacing: .04em; }
.hbw-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 550;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); cursor: help;
}
.hbw-chip img { display: block; }

/* ---------- About ---------- */
.about { padding: 24px 0 8px; }
.about-grid {
  display: grid; grid-template-columns: 280px 1fr; gap: 48px; align-items: center;
  padding-top: 48px; border-top: 1px solid var(--border);
}
.about-photo { display: flex; flex-direction: column; gap: 16px; }
.about-photo img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--surface-2);
}
.resume-btn { justify-content: center; }
.about-copy h2 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); letter-spacing: -.02em; margin: 6px 0 14px; }
.about-copy p { color: var(--text-soft); margin: 0 0 14px; max-width: 56ch; font-size: 1.02rem; }
.about-copy p:last-child { margin-bottom: 0; }

@media (max-width: 720px) {
  .about-grid { grid-template-columns: 1fr; gap: 28px; }
  .about-photo { max-width: 240px; }
}

/* ---------- Approach band ---------- */
.approach { padding: 16px 0 40px; }
.approach-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start;
  padding-top: 40px; border-top: 1px solid var(--border);
}
.approach-lead h2 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.02em; margin: 0 0 14px; max-width: 16ch; }
.approach-lead p { color: var(--text-soft); margin: 0; font-size: 1.02rem; max-width: 46ch; }
.approach-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.approach-points li {
  display: flex; flex-direction: column; gap: 3px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: help; transition: border-color .15s, transform .12s;
}
.approach-points li:hover { border-color: color-mix(in srgb, var(--border) 40%, var(--text-faint)); transform: translateY(-2px); }
.ap-k { font-weight: 600; font-size: .98rem; }
.ap-v { color: var(--text-soft); font-size: .9rem; }

@media (max-width: 760px) {
  .approach-grid { grid-template-columns: 1fr; gap: 28px; }
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 550;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform .12s ease, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent-soft); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }

/* ---------- Projects section ---------- */
.projects-section { padding: 24px 0 96px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 26px;
}
.section-head h2 { font-size: 1.5rem; letter-spacing: -.02em; margin: 0; }

.filters { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.filter {
  border: 0; background: transparent; color: var(--text-soft);
  font: inherit; font-size: 13.5px; padding: 7px 14px; border-radius: 999px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: background .15s, color .15s;
}
.filter:hover { color: var(--text); }
.filter.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-claude { background: var(--claude); }
.dot-codex { background: var(--codex); }

/* ---------- Project grid + cards ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .2s, border-color .2s;
  overflow: hidden;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--border) 50%, var(--text-faint)); }
.card-thumb {
  height: 132px; margin: -22px -22px 18px; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-thumb .thumb-fallback { font-size: 2rem; font-weight: 700; color: var(--text-faint); letter-spacing: -.03em; }
.card h3 { margin: 0 0 8px; font-size: 1.18rem; letter-spacing: -.015em; }
.card p { margin: 0 0 16px; color: var(--text-soft); font-size: .94rem; flex: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11.5px; color: var(--text-faint); background: var(--surface-2);
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border);
}

/* ---------- "Built with" badge ---------- */
.built-with {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 10px 4px 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  color: var(--text-soft); cursor: help;
}
.built-with svg { width: 15px; height: 15px; display: block; }
.built-with .bw-label { white-space: nowrap; }
.built-with.is-claude { border-color: color-mix(in srgb, var(--claude) 35%, var(--border)); }
.built-with.is-codex { border-color: color-mix(in srgb, var(--codex) 35%, var(--border)); }

/* On a card thumbnail, lift the badge above the image */
.card-thumb .built-with { top: 14px; right: 14px; }

/* ---------- Tooltip (shared, used on badges + UI) ---------- */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--text); color: var(--bg);
  font-size: 12px; font-weight: 500; line-height: 1.35;
  padding: 8px 11px; border-radius: 8px; width: max-content; max-width: 240px;
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity .15s, transform .15s; z-index: 30;
  box-shadow: var(--shadow);
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translateY(0); }

.empty-state { text-align: center; color: var(--text-faint); padding: 48px 0; }
.empty-state code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-family: var(--mono); font-size: .85em; }

/* ---------- Project detail ---------- */
.project-detail { padding: 40px 0 96px; }
.back-link { display: inline-block; color: var(--text-soft); text-decoration: none; font-size: 14px; margin-bottom: 28px; }
.back-link:hover { color: var(--text); }
.loading { color: var(--text-faint); }

.detail-head { position: relative; margin-bottom: 28px; }
.detail-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.025em; margin: 0 0 10px; padding-right: 180px; }
.detail-summary { font-size: 1.12rem; color: var(--text-soft); max-width: 64ch; margin: 0 0 18px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 0; }

.detail-why {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; margin: 28px 0; box-shadow: var(--shadow);
}
.detail-why h2 { margin: 0 0 8px; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); }
.detail-why p { margin: 0; color: var(--text-soft); }

.demo-frame-wrap {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow); margin: 28px 0;
}
.demo-frame-bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.demo-frame-bar .dots { display: flex; gap: 6px; }
.demo-frame-bar .dots span { width: 11px; height: 11px; border-radius: 50%; background: var(--border); }
.demo-frame-bar .demo-title { font-size: 12.5px; color: var(--text-faint); }
.demo-frame-bar a { margin-left: auto; font-size: 12.5px; color: var(--text-soft); text-decoration: none; }
.demo-frame-bar a:hover { color: var(--text); }
.demo-frame { width: 100%; height: 640px; border: 0; display: block; background: #fff; }

@media (max-width: 560px) {
  .detail-head h1 { padding-right: 0; }
  .detail-head .built-with { position: static; margin-bottom: 14px; }
  .demo-frame { height: 520px; }
}
