/* Stylesheet for both zones.
   Meadow is the base. body.zone-cards overrides colours,
   fonts and the card grid. */

@font-face {
  font-family: 'aleis dot';
  src: url('/assets/aleis-dot.woff2') format('woff2');
  font-display: swap;
}

:root {
  color-scheme: dark;
  --base: #1f1a24;
  --text: #ebe7f0;
  --head: #f1edf5;
  --body: #e3dde9;
  --subtle: #b9b0c6;
  --muted: #958aa3;
  --accent: #c1b0e7;
  --sage: #a4bba9;
  --line: #3a3245;
  --code: #2a2431;
  --pre: #17131b;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="meadow"]) {
    color-scheme: light;
    --base: #f7e8ee;
    --text: #382a3d;
    --head: #2e2133;
    --body: #423448;
    --subtle: #5f4e63;
    --muted: #857284;
    --accent: #715c97;
    --sage: #507357;
    --line: #e1ced7;
    --code: #efdee4;
    --pre: #efdee4;
  }
}

:root[data-theme="dacian"] {
  color-scheme: light;
  --base: #f7e8ee;
  --text: #382a3d;
  --head: #2e2133;
  --body: #423448;
  --subtle: #5f4e63;
  --muted: #857284;
  --accent: #715c97;
  --sage: #507357;
  --line: #e1ced7;
  --code: #efdee4;
  --pre: #efdee4;
}

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

html, body { margin: 0; background: var(--base); }

body {
  color: var(--text);
  font-family: 'aleis dot', monospace;
  font-size: 16px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, ul { margin: 0; font-weight: inherit; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

button { font: inherit; }

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

.root {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.meadow, .fall {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  image-rendering: pixelated;
  pointer-events: none;
}

.wrap {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 60px) clamp(20px, 5vw, 60px) 32px;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px 32px;
}

.wordmark { position: relative; width: 360px; height: 90px; flex: none; }
.wordmark a { display: block; }
.wordmark canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.wordmark button {
  all: unset;
  position: absolute;
  left: 0;
  top: 0;
  width: 22.2222%;
  height: 88.8889%;
  cursor: pointer;
}

/* text wordmark used in the light "cards" zone */
.wordmark-text {
  display: flex;
  align-items: center;
  height: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--head);
}

.nav { display: flex; flex-wrap: wrap; gap: 12px 28px; padding-top: 14px; }
.nav a.active { color: var(--accent); }

.fade { flex: 1; display: flex; flex-direction: column; }

main { flex: 1; display: flex; flex-direction: column; padding-bottom: 48px; }

.floor { height: 240px; flex: none; }

button.theme { all: unset; cursor: pointer; }
button.theme[hidden] { display: none; }
button.theme:hover { color: var(--accent); }
button.theme:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

.foot {
  padding-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 12px 24px;
}

.muted { color: var(--muted); }
.accent { color: var(--accent); }
.sage { color: var(--sage); }

.home { display: flex; flex-direction: column; padding-top: clamp(40px, 10vh, 140px); }
.home h1 {
  max-width: 640px;
  align-self: flex-start;
  font-size: 48px;
  line-height: 1.04;
  color: var(--head);
  text-wrap: balance;
}
.latest { margin-top: 32px; align-self: flex-start; display: flex; flex-wrap: wrap; gap: 6px 12px; }

/* homepage links into the two zones */
.home-zones {
  margin-top: clamp(40px, 8vh, 72px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 16px;
  width: 100%;
  max-width: 760px;
}
.zone-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 9%, var(--base));
  transition: border-color 120ms ease-out, background-color 120ms ease-out;
}
.zone-card:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--base));
}
.zone-label { color: var(--muted); font-size: 13px; }
.zone-title { font-size: 28px; line-height: 1.1; color: var(--head); }
.zone-desc { color: var(--subtle); font-size: 15px; line-height: 1.4; text-wrap: pretty; }

.page { display: flex; flex-direction: column; padding-top: 64px; max-width: 820px; }
.page h1 { font-size: 48px; line-height: 1; color: var(--head); }
.page > p:not(.lede) { margin-top: 18px; font-size: 16px; line-height: 1.9; color: var(--body); }
.lede {
  margin-top: 18px;
  max-width: 620px;
  font-size: 24px;
  line-height: 1.3;
  color: var(--subtle);
  text-wrap: pretty;
}
.endlink { margin-top: 28px; align-self: flex-start; color: var(--accent); }

.btn {
  all: unset;
  cursor: pointer;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  line-height: 1;
  border: 1px solid var(--line);
}
.btn:hover { color: var(--accent); }
.btn[hidden] { display: none; }

.filter {
  margin-top: 44px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.filter button { all: unset; cursor: pointer; box-sizing: border-box; display: inline-flex; align-items: center; height: 28px; padding: 0 10px; line-height: 1; border: 1px solid var(--line); }
.filter button:hover { color: var(--accent); }
.filter button.active { background: var(--accent); color: var(--base); }
.filter .count { margin-left: auto; line-height: 1; color: var(--muted); }

.post-row { display: flex; flex-direction: column; gap: 8px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.post-row[hidden] { display: none; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); }
.meta .tags, .meta a { color: var(--sage); }
.meta a:hover { color: var(--accent); }
.row-title { font-size: 32px; line-height: 1.1; }
.row-desc { font-size: 16px; line-height: 1.4; color: var(--subtle); text-wrap: pretty; }
.empty { margin-top: 24px; color: var(--subtle); }
.empty[hidden] { display: none; }

.post { display: flex; flex-direction: column; padding-top: 56px; max-width: 700px; }
.post h1 { margin: 0 0 18px; font-size: 48px; line-height: 0.95; color: var(--head); }
.post > .meta { padding-bottom: 28px; border-bottom: 1px solid var(--line); }

.prose { padding-top: 36px; }
.prose h2 { margin: 56px 0 18px; font-size: 32px; line-height: 1.1; color: var(--head); }
.prose > h2:first-child { margin-top: 0; }
.prose h3 { margin: 32px 0 10px; font-size: 24px; line-height: 1.2; color: var(--accent); }
.prose p { margin: 0 0 22px; font-size: 16px; line-height: 1.9; color: var(--body); text-wrap: pretty; }
.prose i, .prose em, .prose b, .prose strong { font-style: normal; font-weight: inherit; color: var(--accent); }
.prose a { color: var(--accent); }
.prose code { font-family: inherit; font-size: 16px; color: var(--accent); background: var(--code); padding: 1px 6px; }
.prose pre { margin: 0 0 22px; padding: 16px 20px; background: var(--pre); overflow-x: auto; }
.prose pre code { background: none; padding: 0; color: inherit; line-height: 1.5; }
.prose ul, .prose ol { margin: 0 0 22px; padding-left: 24px; line-height: 1.9; color: var(--body); }

.post-end {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  color: var(--muted);
}
.post-end .filed { display: flex; gap: 10px; }
.post-end .filed a { color: var(--sage); }
.post-end .filed a:hover { color: var(--accent); }

.proj-list { margin-top: 44px; display: flex; flex-direction: column; }
.proj { display: flex; flex-direction: column; gap: 6px; padding: 22px 0; border-top: 1px solid var(--line); }
.proj:last-child { border-bottom: 1px solid var(--line); }
.proj-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.proj-head .lang { color: var(--muted); }

.badge-own { margin-top: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 20px 28px; }
.badge-own img, .badges img { display: block; width: 176px; height: 62px; image-rendering: pixelated; }
.badge-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; flex: 1; }
.badge-info code { font-family: inherit; font-size: 14px; line-height: 1.5; color: var(--subtle); word-break: break-all; }
.badge-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.badge-actions .btn { color: var(--accent); }
.badges { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 16px; }
.badges a { display: block; }

.about-lede { margin-top: 28px; max-width: 680px; line-height: 1.35; }
.cols {
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 48px 56px;
}
.col { display: flex; flex-direction: column; }
.col-label { color: var(--accent); padding-bottom: 12px; }
.col-item { padding: 12px 0; border-top: 1px solid var(--line); line-height: 1.35; }

.pal-actions { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.pal-actions .btn { color: var(--accent); }
.pal-label {
  margin-top: 56px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--accent);
}
.pal-label span + span { color: var(--muted); }
.swatches { margin-top: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 20px 16px; }
.swatch, .shade { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.swatch .chip, .shade .chip { display: block; height: 64px; border: 1px solid var(--line); margin-bottom: 4px; }
.swatch.term .chip { height: 28px; }
.flower { display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 640px) { .swatches.flowers { grid-template-columns: repeat(6, 1fr); } }
.flower .chip { height: 40px; }
.hex { color: var(--muted); }
.swatch:hover .hex, .shade:hover .hex { color: var(--accent); }
.swatch:focus-visible, .shade:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
.v-dark { display: contents; }
.v-light { display: none; }
:root[data-theme="dacian"] .v-dark { display: none; }
:root[data-theme="dacian"] .v-light { display: contents; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="meadow"]) .v-dark { display: none; }
  :root:not([data-theme="meadow"]) .v-light { display: contents; }
}

html.js .fade, html.js .meadow, html.js .fall { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  html.js .fade, html.js .meadow, html.js .fall { opacity: 1; }
}

@media (max-width: 420px) {
  .wordmark { width: 288px; height: 72px; }
  .wordmark-text { font-size: 44px; }
}

/* Cards zone: projects and software. */

body.zone-cards {
  color-scheme: light;
  --base: #f2f6ff;
  --text: #022867;
  --head: #011626;
  --body: #104088;
  --subtle: #104088;
  --muted: #4a6ea8;
  --accent: #104088;
  --sage: #104088;
  --line: #c9d4f2;
  --code: #e4ebff;
  --pre: #dce6ff;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.zone-cards .meadow,
body.zone-cards .fall { display: none; }

body.zone-cards .floor { height: 120px; }

body.zone-cards .wordmark { width: auto; min-width: 180px; height: 72px; }

body.zone-cards .cards-page { max-width: 900px; }

body.zone-cards .cards-grid {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 14px;
}

body.zone-cards .card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  min-height: 140px;
  background: #d9dfff;
  border: 3px solid #104088;
  transition: background-color 120ms ease-out;
}

body.zone-cards .card h2 {
  font-size: 22px;
  line-height: 1.15;
  color: #104088;
  font-variant: small-caps;
  letter-spacing: 0.02em;
}

body.zone-cards .card p {
  font-size: 15px;
  line-height: 1.45;
  color: #104088;
  text-wrap: pretty;
}

body.zone-cards .card .card-tri {
  position: absolute;
  right: 14px;
  bottom: 10px;
  color: #104088;
}

body.zone-cards .card:hover { background: #104088; }
body.zone-cards .card:hover h2,
body.zone-cards .card:hover p,
body.zone-cards .card:hover .card-tri { color: #f2f6ff; }

body.zone-cards .lede { color: var(--subtle); }

body.zone-cards .nav a.active {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

body.zone-cards .foot a:hover { color: var(--accent); }
