/* ============================================================
   Blake Henstock — portfolio design system
   "Atelier Arcade": warm dark editorial theme for a GameMaker dev
   ============================================================ */

:root {
  color-scheme: dark;

  /* surfaces */
  --ink: #0d0b09;
  --panel: #1a140f;
  --panel-hi: #221a12;

  /* text */
  --paper: #f2e9d8;
  --paper-dim: #b7a98e;
  --paper-faint: #574d3d;

  /* accents */
  --brass: #cf9f4f;
  --brass-hi: #f1c46f;
  --teal: #4b8b76;
  --teal-hi: #6fae97;

  /* lines */
  --line: #2a2117;
  --line-hi: rgba(207, 159, 79, 0.45);

  /* type */
  --serif: "Fraunces", "Iowan Old Style", ui-serif, Georgia, serif;
  --sans: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 200ms;
  --med: 450ms;

  /* misc */
  --r-sm: 3px;
  --r-md: 6px;
  --wrap: 1180px;
  --shadow-lg: 0 30px 80px -24px rgba(0, 0, 0, 0.65);
}

/* ---------- reset ---------- */
* { box-sizing: border-box; }

html {
  scroll-behavior: auto;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p { margin: 0; }

::selection {
  background: var(--brass);
  color: var(--ink);
}

/* thin brass scrollbar (webkit) */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb {
  background: var(--panel-hi);
  border: 3px solid var(--ink);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: var(--brass); }

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brass-hi);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- skip link ---------- */
.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 1000;
  background: var(--brass);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  transition: top var(--fast) var(--ease);
}
.skip-link:focus { top: 16px; }

/* ---------- atmosphere ---------- */
body::before {
  content: "";
  position: fixed;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(720px circle at 88% -8%, rgba(207, 159, 79, 0.16), transparent 60%),
    radial-gradient(920px circle at -8% 112%, rgba(75, 139, 118, 0.14), transparent 60%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-repeat: repeat;
  background-size: 180px 180px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

header, main, footer {
  position: relative;
  z-index: 1;
}

/* ---------- layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-inline: clamp(20px, 5vw, 48px);
}

main { flex: 1; }

.section {
  padding-block: clamp(56px, 9vw, 108px);
}

.section--tight { padding-block: clamp(40px, 6vw, 72px); }

/* ---------- header / nav ---------- */
header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(14px);
  background: rgba(13, 11, 9, 0.82);
  border-bottom: 1px solid var(--line);
}

.nav {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 16px clamp(20px, 5vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-hi);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--brass-hi);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.brand-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.navlinks {
  display: flex;
  align-items: center;
  gap: 28px;
}

.navlink {
  position: relative;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper-dim);
  padding-bottom: 4px;
  transition: color var(--fast) var(--ease);
}

.navlink::after {
  content: "";
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: 0;
  height: 1px;
  background: var(--brass-hi);
  transition: left var(--fast) var(--ease), right var(--fast) var(--ease);
}

.navlink:hover,
.navlink[aria-current="page"] {
  color: var(--paper);
}

.navlink:hover::after,
.navlink[aria-current="page"]::after {
  left: 0;
  right: 0;
}

/* ---------- eyebrow / headings ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass-hi);
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brass-hi);
  box-shadow: 0 0 0 3px rgba(207, 159, 79, 0.18);
}

.lead {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-optical-sizing: auto;
  color: var(--paper);
  font-size: clamp(19px, 2.3vw, 25px);
  line-height: 1.45;
}

.sub {
  color: var(--paper-dim);
  font-size: 16px;
  line-height: 1.7;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease),
    border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.btn .arrow {
  display: inline-block;
  transition: transform var(--fast) var(--ease);
}

.btn:hover .arrow { transform: translateX(4px); }

.btn--primary {
  background: var(--brass);
  color: var(--ink);
  border: 1px solid var(--brass);
}

.btn--primary:hover {
  background: var(--brass-hi);
  border-color: var(--brass-hi);
  transform: translateY(-2px);
}

.btn--ghost {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--line);
}

.btn--ghost:hover {
  border-color: var(--line-hi);
  color: var(--brass-hi);
  transform: translateY(-2px);
}

/* ---------- tags ---------- */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 6px 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--paper-dim);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.03em;
}

/* ---------- stat row ---------- */
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
}

.stat {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.stat:first-child { padding-left: 0; border-left: none; }

.stat b {
  display: block;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--paper);
}

.stat span {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

/* ---------- framed screenshot component ---------- */
.frame {
  position: relative;
  display: flex;
  box-sizing: border-box;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transform: translateY(var(--lift, 0px)) rotate(var(--rot, 0deg)) perspective(900px)
    rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform var(--med) var(--ease), box-shadow var(--fast) var(--ease),
    border-color var(--fast) var(--ease);
}

button.frame {
  appearance: none;
  border: 1px solid var(--line);
  width: 100%;
}

.frame:hover,
.frame:focus-visible {
  border-color: var(--line-hi);
  box-shadow: 0 40px 90px -28px rgba(0, 0, 0, 0.75);
}

.frame img {
  flex: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
  display: block;
  background: var(--ink);
}

.corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 0 solid var(--brass-hi);
  opacity: 0;
  transition: opacity var(--fast) var(--ease);
}

.frame:hover .corner,
.frame:focus-visible .corner { opacity: 1; }

.corner.tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.corner.tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.corner.bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.corner.br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

/* ================= index.html ================= */

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 420px);
  gap: clamp(32px, 6vw, 64px);
  align-items: center;
}

.hero-copy h1 {
  margin-top: 14px;
  font-size: clamp(42px, 6.4vw, 78px);
  line-height: 0.98;
}

.hero-copy .lead { margin-top: 20px; max-width: 46ch; }

.hero-copy .stat-row { margin-top: 30px; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

.gallery {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 0.82;
  margin-inline: auto;
}

.gallery .frame {
  position: absolute;
  padding: 7px;
}

/* stacked in three non-overlapping vertical bands so tilted/staggered
   placement can never clip a neighbour's text content */
.gallery .frame--1 { width: 48%; aspect-ratio: 1.5; top: 0%; left: 26%; --rot: -4deg; z-index: 3; }
.gallery .frame--2 { width: 52%; aspect-ratio: 1.5; top: 35%; left: 0%; --rot: 5deg; z-index: 2; }
.gallery .frame--3 { width: 50%; aspect-ratio: 1.5; top: 70%; left: 24%; --rot: -3deg; z-index: 1; }

.gallery .tab {
  position: absolute;
  bottom: -11px;
  left: 14px;
  background: var(--ink);
  border: 1px solid var(--line-hi);
  color: var(--brass-hi);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.gallery .frame--2 .tab { left: auto; right: 14px; }

/* text-forward variant for projects with no screenshot yet */
.frame--stat {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  padding: 22px;
}

.frame--stat .stat-big {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(26px, 3.6vw, 38px);
  color: var(--brass-hi);
  line-height: 1.05;
}

.frame--stat .stat-caption {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--paper-dim);
  line-height: 1.55;
}

/* toolkit */
.toolkit-section {
  position: relative;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.toolkit-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(242, 233, 216, 0.09) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(700px circle at 15% 30%, black, transparent 75%);
  pointer-events: none;
}

.toolkit-section .wrap { position: relative; }

.toolkit-header { max-width: 56ch; margin-bottom: 32px; }
.toolkit-header h2 { font-size: clamp(28px, 3.6vw, 38px); margin-top: 10px; }

.toolkit-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}

.toolkit-group span.label {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper-dim);
  margin-bottom: 10px;
}

/* featured work mini list */
.work-list {
  display: flex;
  flex-direction: column;
}

.work-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 20px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  transition: padding-left var(--fast) var(--ease);
}

.work-list .work-item:last-child { border-bottom: 1px solid var(--line); }

.work-item:hover { padding-left: 10px; }

.work-num {
  font-family: var(--mono);
  color: var(--paper-faint);
  font-size: 13px;
}

.work-title {
  font-family: var(--serif);
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 600;
}

.work-item p.sub { margin-top: 6px; max-width: 60ch; }

.work-arrow {
  font-family: var(--mono);
  color: var(--paper-dim);
  transition: transform var(--fast) var(--ease), color var(--fast) var(--ease);
}

.work-item:hover .work-arrow {
  color: var(--brass-hi);
  transform: translateX(4px);
}

/* experience list */
.exp-list {
  display: flex;
  flex-direction: column;
}

.exp-item {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.exp-list .exp-item:last-child { border-bottom: 1px solid var(--line); }

.exp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 20px;
}

.exp-role {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
}

.exp-org { color: var(--paper-dim); font-weight: 400; }

.exp-dates {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--paper-faint);
  white-space: nowrap;
}

.exp-item p.sub { margin-top: 6px; max-width: 62ch; }

/* contact */
.contact-section { text-align: left; }

.contact-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(28px, 4vw, 44px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}

.contact-card h2 { font-size: clamp(26px, 3.4vw, 36px); margin-top: 10px; }
.contact-card .sub { margin-top: 10px; max-width: 44ch; }

/* ================= projects.html ================= */

.projects-hero { max-width: 70ch; }
.projects-hero h1 { font-size: clamp(38px, 5.6vw, 64px); margin-top: 14px; }
.projects-hero .lead { margin-top: 18px; }

.project {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 5vw, 56px);
  align-items: center;
  padding-block: clamp(48px, 7vw, 88px);
  border-top: 1px solid var(--line);
  scroll-margin-top: 96px;
}

.project:last-child { border-bottom: 1px solid var(--line); }

.project--reverse .project__media { order: 2; }
.project--reverse .project__body { order: 1; }

.project__body {
  position: relative;
  z-index: 1;
}

.project__num {
  position: absolute;
  top: -0.42em;
  left: -0.05em;
  z-index: -1;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(80px, 11vw, 150px);
  color: transparent;
  -webkit-text-stroke: 1px var(--line-hi);
  line-height: 1;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

.project__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.project__index {
  font-family: var(--mono);
  color: var(--brass-hi);
  font-size: 13px;
}

.project__body h3 {
  font-size: clamp(26px, 3.4vw, 36px);
  margin-bottom: 14px;
}

.project__body p.sub { max-width: 48ch; margin-bottom: 20px; }

.project__meta-extra {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--paper-faint);
}

.callout {
  max-width: 48ch;
  margin-bottom: 20px;
  padding: 14px 16px;
  border-left: 2px solid var(--brass);
  background: var(--panel);
}

.callout .callout-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass-hi);
  margin-bottom: 6px;
}

.callout p { color: var(--paper-dim); font-size: 14.5px; line-height: 1.65; }

.link-out {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--paper-dim);
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.link-out:hover { color: var(--brass-hi); border-color: var(--brass-hi); }

.other-note {
  padding-top: clamp(40px, 6vw, 64px);
  color: var(--paper-dim);
  font-size: 14.5px;
}

.project__media .frame { aspect-ratio: 16 / 10; width: 100%; }

/* modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(9, 7, 6, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 500;
  padding: 24px;
}

.modal.open { display: flex; }

.modal__frame {
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line-hi);
  border-radius: var(--r-md);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.8);
  max-width: 92vw;
  max-height: 78vh;
  display: flex;
}

.modal__frame img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 2px;
  display: block;
  object-fit: contain;
}

.modal__caption {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

.modal__close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--paper);
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 16px;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

.modal__close:hover { border-color: var(--brass-hi); color: var(--brass-hi); }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line);
  background: rgba(15, 12, 9, 0.92);
  padding: 32px clamp(20px, 5vw, 48px);
}

.footer-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-copy {
  color: var(--paper-dim);
  font-size: 13.5px;
}

.footer-tagline {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--paper-faint);
}

.footer-links {
  display: flex;
  gap: 22px;
}

/* ---------- reveal-on-scroll ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- responsive ---------- */
@media (max-width: 959px) {
  .hero-grid { grid-template-columns: 1fr; }

  .gallery {
    aspect-ratio: auto;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .gallery .frame {
    position: static;
    width: 100% !important;
    aspect-ratio: 1.7 !important;
    --rot: 0deg;
  }

  .gallery .tab { display: none; }

  .project,
  .project--reverse {
    grid-template-columns: 1fr;
  }

  .project__media,
  .project--reverse .project__media { order: -1; }

  .project__body,
  .project--reverse .project__body { order: 2; }

  .project__num { display: none; }
}

@media (max-width: 640px) {
  .nav { padding: 14px 18px; }
  .brand-name { font-size: 16px; }
  .navlinks { gap: 18px; }
  .stat-row { flex-direction: column; gap: 12px; }
  .stat { padding-left: 0; border-left: none; }
  .contact-card { flex-direction: column; align-items: flex-start; }
}

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