/* Projects section styles. Design rules and rationale: the lauchlin-design-profile memory (kept out of the repo so it is not published) */

@font-face { font-family: "Space Grotesk"; src: url("/assets/fonts/space-grotesk-latin.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/jetbrains-mono-latin.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  color-scheme: dark light;
  --font-ui: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --bg: #110e0a;
  --surface: #1b1610;
  --surface-2: #262016;
  --line: #3a3022;
  --fg: #efe6d2;
  --muted: #a99c80;
  --brand: #d28a3c;
  --moss: #7a8a42;
  --rust: #b5532b;
  --shade: rgba(17, 14, 10, .88);
  --backdrop-opacity: .17;

  --accent: var(--brand);
  --accent-fg: #17110a;

  --tile: 10px;
  --card: 12px;
  --measure: 46rem;
  --gutter: clamp(16px, 4vw, 48px);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f1e6;
    --surface: #fffdf8;
    --surface-2: #efe8d8;
    --line: #ddd3bd;
    --fg: #241c10;
    --muted: #6b5d44;
    --brand: #a8621c;
    --moss: #566326;
    --rust: #9a4220;
    --shade: rgba(246, 241, 230, .9);
    --backdrop-opacity: .1;
    --accent-fg: #fff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1.0625rem/1.62 var(--font-ui);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* The home-page photograph, very faint, showing in the margins on wide screens. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg) url("/assets/bg-leaves.webp") center / cover no-repeat;
  opacity: 1;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to right,
    color-mix(in srgb, var(--bg) 68%, transparent) 0%,
    color-mix(in srgb, var(--bg) 95%, transparent) 26%,
    color-mix(in srgb, var(--bg) 95%, transparent) 74%,
    color-mix(in srgb, var(--bg) 68%, transparent) 100%);
}
@media (max-width: 1100px) {
  body::after { background: color-mix(in srgb, var(--bg) 94%, transparent); }
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) body::after { background: color-mix(in srgb, var(--bg) 96%, transparent); }
}

main {
  width: min(100%, 78rem);
  margin: 0 auto;
  padding: 28px var(--gutter) 72px;
}
@media (min-width: 1800px) { main { width: min(100%, 100rem); } }

a { color: inherit; text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* breadcrumb */
nav {
  margin-bottom: 28px;
  font: 500 .75rem/1.4 var(--font-mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--fg); text-decoration: underline; }

/* masthead: title left, hero mosaic right on desktop */
.masthead { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; margin-bottom: 36px; align-items: center; }
@media (min-width: 1000px) {
  .masthead.has-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); }
}
.masthead-text { max-width: var(--measure); min-width: 0; }

h1 {
  margin: 0 0 12px;
  font-size: clamp(2.1rem, 1.2rem + 3.2vw, 3.6rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -.025em;
}
.sub { margin: 0 0 20px; color: var(--muted); font-size: 1.125rem; line-height: 1.55; }

h2 {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 2.6rem 0 .6rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -.01em;
}
h2::before {
  content: "";
  flex: none;
  width: .6rem;
  height: .6rem;
  border-radius: 2px;
  background: var(--accent);
}
h3 { margin: 1.8rem 0 .4rem; font-size: 1rem; font-weight: 600; color: var(--muted); font-family: var(--font-mono); letter-spacing: .02em; text-transform: uppercase; font-size: .8rem; }

p, ul, ol, table, .note, .links { max-width: var(--measure); }
p { margin: .7rem 0; }
ul, ol { padding: 0; margin: .6rem 0; list-style: none; }
main ul:not(.tags):not(.grid):not(.board):not(.filters) > li { position: relative; padding-left: 1.3rem; margin: .45rem 0; }
main ul:not(.tags):not(.grid):not(.board):not(.filters) > li::before {
  content: "";
  position: absolute;
  left: .15rem;
  top: .62em;
  width: .42rem;
  height: .42rem;
  border-radius: 2px;
  background: var(--accent);
  opacity: .9;
}
ol { counter-reset: n; }
ol > li { counter-increment: n; position: relative; padding-left: 1.8rem; margin: .45rem 0; }
ol > li::before { content: counter(n); position: absolute; left: 0; top: .1em; font: 600 .75rem/1.6 var(--font-mono); color: var(--accent); }
code { font: .88em var(--font-mono); background: var(--surface-2); border-radius: 5px; padding: .08em .35em; }

.note { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }

/* tags */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; max-width: none; }
.tags li { margin: 0; padding: 3px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font: 500 .72rem/1.5 var(--font-mono); letter-spacing: .02em; color: var(--muted); }
.tags li::before { display: none; }

/* buttons */
.links { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; max-width: none; }
.links a, a.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--tile);
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
  text-decoration: none;
  transition: transform .15s ease, filter .15s ease;
}
.links a:hover, a.button:hover { color: var(--accent-fg); filter: brightness(1.08); transform: translateY(-1px); }

/* hero mosaic */
.hero { display: grid; gap: 6px; justify-content: start; user-select: none; max-width: 100%; overflow: hidden; }
@media (min-width: 1000px) { .hero { justify-content: end; } }
.hero .t {
  border-radius: var(--tile);
  background-repeat: no-repeat;
  background-color: var(--surface-2);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
  will-change: transform;
}
.hero .t.dim { filter: saturate(.7) brightness(.78); }
.hero .t.pop { background-image: none !important; background-color: var(--accent); opacity: .9; }
@media (prefers-reduced-motion: reduce) { .hero .t { transition: none !important; } }

/* cards on group landing pages */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); margin: 14px 0 0; padding: 0; list-style: none; max-width: none; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--card);
  text-decoration: none;
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease;
}
.card::before { content: ""; width: .7rem; height: .7rem; border-radius: 3px; background: var(--accent); margin-bottom: 14px; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--fg); }
.card strong { font-size: 1.08rem; font-weight: 600; letter-spacing: -.01em; }
.card span { color: var(--muted); font-size: .94rem; margin-top: 4px; }
.card .tags { margin-top: auto; padding-top: 14px; }

/* screenshots: masonry columns on desktop, swipe carousel on phones */
.shots { columns: 21rem; column-gap: 16px; margin: 22px 0; max-width: none; }
.shots:has(figure:only-child) { columns: 1; max-width: 52rem; }
.shots figure { margin: 0 0 18px; min-width: 0; break-inside: avoid; }
.shots:has(.phone) { columns: auto; display: flex; flex-wrap: wrap; gap: 16px; }
.shots:has(.phone) figure { margin: 0; flex: 0 1 14rem; }
.shots figure.phone { max-width: 17rem; }
.shots img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--tile);
  background: var(--surface);
  cursor: zoom-in;
  transition: transform .18s ease, border-color .18s ease;
}
.shots img:hover { transform: translateY(-2px); border-color: var(--accent); }
.shots figcaption { margin-top: 8px; font: 400 .8rem/1.45 var(--font-ui); color: var(--muted); }
.shots figcaption::before { content: "\2197  "; font-family: var(--font-mono); color: var(--accent); }

@media (max-width: 700px) {
  .shots, .shots:has(.phone) {
    columns: auto;
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    margin-inline: calc(var(--gutter) * -1);
    padding: 2px var(--gutter) 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .shots figure, .shots:has(.phone) figure { flex: 0 0 82%; margin: 0; scroll-snap-align: start; }
  .shots:has(.phone) figure, .shots figure.phone { flex-basis: 56%; max-width: none; }
  .shots:has(figure:only-child) { display: block; overflow: visible; margin-inline: 0; padding: 0; }
  .shots:has(figure:only-child) figure { flex: none; }
  .shots:has(figure:only-child) figure.phone { max-width: 17rem; }
}

table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .94rem; margin: 10px 0; border: 1px solid var(--line); border-radius: var(--tile); overflow: hidden; background: var(--surface); }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font: 500 .72rem/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }

/* index: tile board */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 18px; max-width: none; padding: 0; list-style: none; }
.filters button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font: 500 .78rem/1 var(--font-mono);
  letter-spacing: .03em;
  text-transform: uppercase;
  cursor: pointer;
}
.filters button:hover { color: var(--fg); border-color: var(--muted); }
.filters button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }

.board {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: 11rem;
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: none;
}
@media (min-width: 700px)  { .board { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 12rem; } }
@media (min-width: 1000px) { .board { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; grid-auto-rows: 13rem; } }
@media (min-width: 1500px) { .board { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1900px) { .board { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 2600px) { .board { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.board > li { display: contents; }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  grid-column: span 1;
  min-width: 0;
  padding: 14px;
  border-radius: var(--tile);
  background-color: var(--surface);
  background-image: var(--cover, none);
  background-size: cover;
  background-position: top left;
  border: 1px solid var(--line);
  color: #f4ecd9;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: transform .2s ease, border-color .2s ease;
}
.tile.wide { grid-column: span 2; }
.tile.tall { grid-row: span 2; }
.tile::before {   /* readable text over any screenshot */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to top, rgba(12, 9, 5, .97) 0%, rgba(12, 9, 5, .94) 46%, rgba(12, 9, 5, .5) 70%, rgba(12, 9, 5, 0) 100%);
}
.tile.plain {   /* no screenshot yet: accent mosaic */
  background-image:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 38%, #0c0905), #0c0905 80%);
}
.tile.plain::after {
  content: "";
  position: absolute;
  top: 14px; right: 14px;
  width: 54px; height: 54px;
  z-index: -1;
  background:
    linear-gradient(var(--accent), var(--accent)) 0 0 / 24px 24px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 30px 30px / 24px 24px no-repeat,
    linear-gradient(color-mix(in srgb, var(--accent) 45%, transparent), color-mix(in srgb, var(--accent) 45%, transparent)) 30px 0 / 24px 24px no-repeat;
  border-radius: 6px;
  opacity: .85;
}
.tile:hover { transform: translateY(-3px); border-color: var(--accent); color: #fff; }
.tile .t-name { display: block; font-size: 1.1rem; font-weight: 700; letter-spacing: -.015em; line-height: 1.15; }
.tile .t-name::before { content: ""; display: inline-block; width: .5rem; height: .5rem; border-radius: 2px; background: var(--accent); margin-right: .45rem; vertical-align: .08em; }
.tile .t-desc { display: block; margin-top: 4px; font-size: .85rem; line-height: 1.4; color: #d9cdb3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .t-tags { display: block; margin-top: 8px; font: 500 .66rem/1.4 var(--font-mono); letter-spacing: .03em; text-transform: uppercase; color: var(--accent); }
.tile[hidden] { display: none; }
@media (hover: none) { .tile .t-desc { -webkit-line-clamp: 2; } }

/* lightbox */
.shots img[role="button"] { cursor: zoom-in; }
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
dialog.lightbox::backdrop { background: rgba(8, 6, 3, .9); }
dialog.lightbox .lb-body { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; cursor: zoom-out; }
dialog.lightbox img { max-width: 100%; max-height: calc(100vh - 90px); width: auto; height: auto; border-radius: var(--tile); background: #000; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
dialog.lightbox .lb-cap { color: #e6dcc4; font-size: .9rem; text-align: center; max-width: 60rem; }
dialog.lightbox button { position: fixed; top: 12px; right: 16px; min-width: 44px; min-height: 44px; font-size: 1.6rem; line-height: 1; padding: 6px 12px; border: 0; border-radius: var(--tile); background: rgba(255,255,255,.14); color: #fff; cursor: pointer; }
dialog.lightbox button:hover { background: rgba(255,255,255,.26); }
dialog.lightbox .lb-nav { top: 50%; transform: translateY(-50%); font-size: 2rem; }
dialog.lightbox .lb-prev { left: 12px; right: auto; }
dialog.lightbox .lb-next { right: 12px; }

/* ultrawide: the index grows by adding tiles, not by enlarging them */
@media (min-width: 1800px) { main:has(> .filters) { width: min(100%, 118rem); } }
@media (min-width: 2600px) { main:has(> .filters) { width: min(100%, 160rem); } }

/* masthead hero: the lead screenshot, intact */
.hero-shot { margin: 0; max-width: none; columns: auto; display: block; }
.hero-shot figure { margin: 0; }
.hero-shot img { box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }
@media (min-width: 1000px) { .masthead.has-hero .hero-shot { justify-self: end; width: 100%; } .hero-shot.is-phone { max-width: 17rem; } }
.hero-shot.is-phone { max-width: 17rem; }
.hs-wrap { position: relative; }
.hs-ov { position: absolute; inset: 0 auto auto 0; background: var(--bg); border-radius: var(--tile); overflow: hidden; z-index: 2; pointer-events: none; transition: opacity .5s ease; }
.hs-ov.out { opacity: 0; }
.hs-t { position: absolute; border-radius: var(--tile); background-repeat: no-repeat; will-change: transform; }
.hs-t.lift { z-index: 3; box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }

/* more projects */
.more { margin-top: 3.2rem; }
.more .board { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 11rem; gap: 12px; }
@media (max-width: 700px) { .more .board { grid-template-columns: 1fr; grid-auto-rows: 9.5rem; } }
.more .tile.wide { grid-column: span 1; }

/* on-this-page rail: only where the margin is wide enough to hold it */
.toc { display: none; }
.toc ul { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--line); }
.toc li { margin: 0; padding: 0; }
.toc a { display: block; padding: 5px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; text-transform: uppercase; }
.toc a:hover { color: var(--fg); }
.toc a.on { color: var(--fg); border-left-color: var(--accent); }
@media (min-width: 1700px) and (max-width: 1799px), (min-width: 2100px) {
  .toc { display: block; position: fixed; top: 7.5rem; width: 12rem; font: 500 .74rem/1.4 var(--font-mono); letter-spacing: .02em; }
}
@media (min-width: 1700px) and (max-width: 1799px) { .toc { left: max(1rem, calc(50vw - 39rem - 13rem)); } }
@media (min-width: 2100px) { .toc { left: calc(50vw - 50rem - 13rem); } }

/* index: shuffle button, readable tags on any accent */
.filters .push { margin-left: auto; }
.filters .shuffle::before { content: "\21C4  "; }
.tile .t-tags { color: color-mix(in srgb, var(--accent) 62%, #fff); }

/* lightbox counter */
dialog.lightbox .lb-count { position: fixed; left: 16px; top: 18px; font: 500 .78rem/1 var(--font-mono); color: #d9cdb3; letter-spacing: .04em; }
