/* =============================================================================
   CHOOSE YOUR LOOK
   -----------------------------------------------------------------------------
   Two switches, both on the <html ...> tag at the top of index.html:

     data-type    editorial | grotesk | classic
     data-bullet  dash | arrow | slash | dot | square | none

   Two more knobs are further down, as CSS variables you can edit directly:
     --h-featured / --h-card   project title sizes
     --font-meta               font for the role line and the tag row

   Change a value, save, refresh. If you change data-type, also swap the
   matching Google Fonts <link> in index.html (they are listed there,
   commented out) so the right fonts actually download.
   ============================================================================= */

/* --- font sets ------------------------------------------------------------ */

:root,
html[data-type='editorial'] {
  --serif: 'Libre Baskerville', ui-serif, Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

html[data-type='grotesk'] {
  --serif: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

html[data-type='classic'] {
  --serif: 'EB Garamond', ui-serif, Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Heading sizes live here because the sets are not optically equal: EB Garamond
   sets much smaller than Libre Baskerville at the same pt size, so `classic`
   needs a bump to hold the same weight on the page. */
:root {
  --h-featured: 1.875rem;
  --h-card: 1.375rem;
}

html[data-type='classic'] {
  --h-featured: 2.25rem;
  --h-card: 1.5rem;
}

/* Font for the role line and the tag row. The rest of the small uppercase
   furniture (eyebrows, index numbers, links) stays mono. Swap this for
   var(--mono) to put them back, or var(--serif) for something softer. */
:root {
  --font-meta: var(--sans);
}

/* --- bullet marker -------------------------------------------------------- */

:root,
html[data-bullet='dash'] { --bullet: '—'; }
html[data-bullet='arrow'] { --bullet: '→'; }
html[data-bullet='slash'] { --bullet: '/'; }
html[data-bullet='dot'] { --bullet: '·'; }
html[data-bullet='square'] { --bullet: '▪'; }
html[data-bullet='none'] { --bullet: ''; }

/* =============================================================================
   Paper & ink. Two palettes, one set of variable names — dark mode swaps the
   values on <html class="dark"> and every rule below follows along.
   ============================================================================= */

:root {
  --paper: #f5f4f0;
  --paper-sunk: #eeece5;
  --ink: #1b1a17;
  --ink-muted: #6d675c;
  --ink-faint: #97907f;
  --line: #d8d3c7;
  --line-strong: #b9b2a2;
  --accent: #9c5a34;
}

html.dark {
  --paper: #131211;
  --paper-sunk: #1b1917;
  --ink: #ebe7de;
  --ink-muted: #9a9384;
  --ink-faint: #6f6858;
  --line: #2c2925;
  --line-strong: #423d36;
  --accent: #d99a6c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
}

ul {
  list-style: none;
}

::selection {
  background: var(--accent);
  color: var(--paper);
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

/* -----------------------------------------------------------------------------
   The label: uppercase mono at a size where the letter-spacing does the work.
   Used for every eyebrow, tag, index number and link in the page furniture.
   -------------------------------------------------------------------------- */
.label {
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.faint {
  color: var(--ink-faint);
}

a.ul {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 6px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a.ul:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.wrap {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* -----------------------------------------------------------------------------
   Masthead + intro. Kept deliberately short: the first project should be on
   screen when the page loads, not one scroll down.
   -------------------------------------------------------------------------- */
.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: inherit;
  text-decoration: none;
}

.masthead-right {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
}

.masthead-right .meta {
  color: var(--ink-muted);
}

.toggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toggle:hover {
  color: var(--accent);
  border-color: var(--line-strong);
}

.intro {
  max-width: 42rem;
  padding: 2rem 0 2.25rem;
}

.intro p {
  font-size: 1rem;
  line-height: 1.7;
}

.intro .links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1.5rem;
  color: var(--ink-muted);
}

.section-head {
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--line);
}

/* A second section heading has to clear the grid above it. */
.grid + .section-head {
  margin-top: 5.5rem;
}

/* …and the grid under a heading already has that heading's rule as its
   top edge, so it drops its own border and the space that went with it. */
.section-head + .grid {
  margin-top: 0;
  padding-top: 2.5rem;
  border-top: none;
}

/* -----------------------------------------------------------------------------
   Project cards
   -------------------------------------------------------------------------- */
.shot {
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-sunk);
  aspect-ratio: 4 / 3;
}

/* A .shot that opens a gallery is a real <button>, so it needs the browser's
   button styling stripped back to what the <div> version looked like. */
button.shot {
  display: block;
  width: 100%;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button.shot img {
  transition: opacity 0.2s ease, transform 0.4s ease;
}

button.shot:hover img {
  opacity: 0.88;
  transform: scale(1.015);
}

/* Count of extra frames, revealed on hover over the shot. */
.shot-more {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 0.5rem 0.625rem;
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  color: var(--ink-muted);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.shot-wrap {
  position: relative;
}

.shot-wrap:hover .shot-more,
button.shot:focus-visible + .shot-more {
  opacity: 1;
}

/* Touch screens have no hover, so the badge stays on — otherwise there is
   nothing telling you the image opens a gallery. */
@media (hover: none) {
  .shot-more {
    opacity: 1;
  }
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--ink-faint);
}

.featured {
  display: grid;
  gap: 2rem;
  padding-top: 2.25rem;
}

.featured .shot {
  aspect-ratio: 16 / 10;
}

h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.25;
  text-wrap: balance;
}

.featured h3 {
  font-size: var(--h-featured);
}

.card h3 {
  font-size: var(--h-card);
}

.note {
  margin-top: 0.625rem;
  color: var(--accent);
}

.blurb {
  margin-top: 1rem;
  max-width: 34rem;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--ink-muted);
}

.card .blurb {
  margin-top: 0.75rem;
}

/* The part a recruiter is reading for: what he did, not what the game is. */
.contribution {
  margin-top: 1.125rem;
}

.contribution .role {
  font-family: var(--font-meta);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

.did {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink);
}

/* Hanging indent: the marker sits in the margin, wrapped lines stay aligned.
   The fixed marker width keeps every bullet style on the same left edge. */
.did li {
  padding-left: 1.25rem;
  text-indent: -1.25rem;
}

.did li + li {
  margin-top: 0.375rem;
}

.did li::before {
  content: var(--bullet);
  display: inline-block;
  width: 1.25rem;
  text-indent: 0;
  color: var(--line-strong);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  margin-top: 1.25rem;
  font-family: var(--font-meta);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

.tags li {
  white-space: nowrap;
}

.tags li + li::before {
  content: '/';
  padding: 0 0.375rem;
  color: var(--line-strong);
}

.ext-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1.25rem;
}

.ext-links a {
  color: var(--ink);
}

.grid {
  display: grid;
  gap: 4rem 3rem;
  margin-top: 4rem;
  padding-top: 3.5rem;
  border-top: 1px solid var(--line);
}

.card {
  min-width: 0;
}

.card .card-body {
  margin-top: 1.25rem;
}

footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-top: 6rem;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
}

/* -----------------------------------------------------------------------------
   Gallery. A native <dialog>, so Esc, focus handling and the backdrop come
   from the browser rather than from script.
   -------------------------------------------------------------------------- */
.lightbox {
  width: min(1100px, 94vw);
  max-width: none;
  max-height: 92vh;
  /* Explicit, because the `* { margin: 0 }` reset above cancels the auto
     margins a <dialog> normally relies on to centre itself. */
  margin: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
}

.lightbox[open] {
  display: flex;
  flex-direction: column;
}

.lightbox::backdrop {
  background: rgb(0 0 0 / 0.7);
}

.lightbox-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--line);
}

.lightbox-title {
  font-family: var(--font-meta);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  background: var(--paper-sunk);
}

/* auto sizing rather than 100%: several screenshots are ~620px wide, and
   stretching those to fill the stage just makes them soft. */
.lightbox-stage img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 74vh;
  object-fit: contain;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.lightbox-nav:hover {
  color: var(--accent);
  border-color: var(--line-strong);
}

.lightbox-prev { left: 0.75rem; }
.lightbox-next { right: 0.75rem; }

.lightbox-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.875rem 1rem;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
}

/* Thumbnail strip: one row, scrolls sideways when a project has many frames. */
.lightbox-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
}

.lightbox-strip button {
  flex: 0 0 auto;
  width: 4.5rem;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--paper-sunk);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.lightbox-strip button:hover {
  opacity: 0.85;
}

.lightbox-strip button[aria-current='true'] {
  opacity: 1;
  border-color: var(--accent);
}

.lightbox-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Dialog is open: stop the page behind it from scrolling. */
body.has-dialog {
  overflow: hidden;
}

/* -----------------------------------------------------------------------------
   Wider screens: the magazine layout only makes sense once there is room for
   two real columns.
   -------------------------------------------------------------------------- */
@media (min-width: 640px) {
  .wrap {
    padding: 0 2.5rem;
  }

  :root {
    --h-featured: 2.125rem;
  }

  html[data-type='classic'] {
    --h-featured: 2.5rem;
  }
}

@media (min-width: 768px) {
  .featured {
    grid-template-columns: 3fr 2fr;
    gap: 3rem;
    align-items: center;
  }

  .grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
