@font-face {
  font-family: "Terminess";
  src: url("fonts/TerminessNerdFontMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Terminess";
  src: url("fonts/TerminessNerdFontMono-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #0d0d0d;
  --panel: #141414;
  --fg: #ececec;
  --dim: #8a8a8a;
  --line: #2a2a2a;
  --accent: #39d353;
  --gold: #e8b24a;
  --mono: "Terminess", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(16px, 4vw, 48px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 18px/1.5 var(--mono);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--dim); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.muted { color: var(--dim); }
.ps1 { color: var(--accent); }

/* fishnet background (drawn by net.js) */
.net { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #000; padding: 4px 8px; }
.skip:focus { left: 8px; }

/* header */
.site-header { padding: var(--gutter); padding-top: 20px; max-width: 1400px; margin: 0 auto; }
.nav { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: flex-end; font-size: 16px; }
.nav a { text-decoration: none; color: var(--dim); }
.nav a:hover { color: var(--fg); }
.nav .flag { color: var(--accent); }

.prompt { margin: 0; font-size: 18px; font-weight: 400; color: var(--dim); }
.hero {
  display: grid; grid-template-columns: minmax(0, 720px) minmax(0, 1fr);
  gap: 24px 48px; align-items: end; margin-top: clamp(40px, 10vw, 120px);
}

/* spinning pen */
.pen { justify-self: center; position: relative; z-index: 6; }
/* rainbow that pours from the nib on hover (drawn by pen.js); the pen sits in front of it */
.ooze { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; }
.pen-toggle { display: block; padding: 0; border: 0; background: none; cursor: pointer; }
.pen-art {
  display: block; white-space: pre; margin: 0; color: var(--dim);
  font: 400 clamp(7px, 0.9vw, 13px)/1 var(--mono);
}
.pen-art .g { color: var(--gold); }
/* solid silhouette so the pen sits in front of the net */
.pen-art span { background: var(--bg); }
.pen-art .s { background: none; }
/* hover: Nyan Cat rainbow and sparkles */
.pen-art .r0 { color: #ff2a2a; }
.pen-art .r1 { color: #ff9a00; }
.pen-art .r2 { color: #ffec00; }
.pen-art .r3 { color: #33ff33; }
.pen-art .r4 { color: #1fa3ff; }
.pen-art .r5 { color: #8a4dff; }
.pen-art .s { color: #fff; }
.pen-toggle:hover .pen-art [class^="r"] { text-shadow: 0 0 6px currentColor; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .pen { justify-self: start; }
  .pen-art { font-size: clamp(5px, 1.7vw, 9px); }
}
.logo { margin: 28px 0 0; font-weight: 400; }
.logo img { display: block; width: min(100%, 720px); height: auto; }
.tagline {
  display: flex; align-items: center; gap: 0.6ch;
  width: min(100%, 720px);
  margin-top: 28px;
  font-size: clamp(16px, 2.6vw, 26px);
  font-weight: 700;
  letter-spacing: 0.42em;
  text-transform: uppercase;
}
.cursor {
  display: inline-block; width: 0.6em; height: 1.1em; margin-left: 0.2em;
  background: var(--accent); animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* sections */
.section { max-width: 1400px; margin: 0 auto; padding: 56px var(--gutter) 24px; }
.section > .prompt { padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }

.filters { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; margin-left: 1ch; }
.filters button {
  font: inherit; color: var(--dim); background: none; border: 0; padding: 0; cursor: pointer;
}
.filters button:hover { color: var(--fg); }
.filters button[aria-pressed="true"] { color: var(--fg); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.count { color: var(--dim); font-size: 15px; margin: -10px 0 18px; }

/* gallery: masonry via columns */
.gallery { list-style: none; margin: 0; padding: 0; columns: 3 320px; column-gap: 24px; }
.gallery li { break-inside: avoid; margin-bottom: 28px; }
.gallery button {
  display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit;
  font: inherit; text-align: left; cursor: url("glove.svg") 8 1, pointer; /* 1-bit pointing glove, old Mac style */
}
.gallery img {
  display: block; width: 100%; height: auto; background: var(--panel);
  outline: 1px solid var(--line); transition: outline-color .15s;
}
.gallery button:hover img { outline-color: var(--accent); }
.gallery .cap { display: flex; justify-content: space-between; gap: 1ch; margin-top: 8px; font-size: 15px; }
.gallery .cap .t::before { content: "> "; color: var(--accent); }
.gallery .cap .y { color: var(--dim); white-space: nowrap; }

/* about / contact */
.about { max-width: 68ch; }
.about p { margin: 0 0 1em; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 4ch; margin: 24px 0 0; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; }
.contact { font-size: 22px; }

.site-footer { max-width: 1400px; margin: 0 auto; padding: 56px var(--gutter) 40px; }

/* viewer: an early-80s Mac window, two-tone: Omarchy orange "ink" on the site's black
   background as "paper" (instead of black on white). Pinstriped title bar with the file name,
   and a close box (with a little x) in the top-left corner. Opening and closing play
   the old Finder "zoom rects" between the thumbnail and the window. */
.viewer {
  --mac-paper: var(--bg);
  --mac-ink: #faa968;
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: none; color: var(--mac-ink);
}
.viewer[open] { display: grid; place-items: center; }
.viewer::backdrop { background: rgba(0, 0, 0, .75); }
.viewer.zooming .mac-window { visibility: hidden; }
.mac-window {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(92vw, 860px); max-height: 92vh;
  background: var(--mac-paper); border: 2px solid var(--mac-ink);
  box-shadow: 8px 8px 0 0 rgba(250, 169, 104, .28);
  font: 16px/1.3 var(--mono);
}
.mac-title {
  position: relative; display: flex; justify-content: center; align-items: center;
  height: 28px; border-bottom: 2px solid var(--mac-ink);
  background: var(--mac-paper) repeating-linear-gradient(var(--mac-ink) 0 1px, var(--mac-paper) 1px 2px) 4px 7px / calc(100% - 8px) 13px no-repeat;
}
.mac-name {
  margin: 0; padding: 0 10px; background: var(--mac-paper); font-weight: 700;
  max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mac-close {
  position: absolute; left: 12px; top: 50%; translate: 0 -50%;
  display: grid; place-items: center; width: 17px; height: 17px; padding: 0;
  border: 2px solid var(--mac-ink); background: var(--mac-paper);
  box-shadow: 0 0 0 3px var(--mac-paper);   /* the gap in the stripes */
  font: 700 15px/1 var(--mono); color: var(--mac-ink); cursor: pointer;
}
.mac-close:hover, .mac-close:active { background: var(--mac-ink); color: var(--mac-paper); }
.viewer figure { margin: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; padding: 16px; }
.viewer-img { max-width: 100%; max-height: calc(92vh - 170px); min-height: 0; object-fit: contain; }
.viewer figcaption { display: flex; flex-wrap: wrap; gap: 0 2ch; justify-content: center; padding-top: 12px; text-align: center; }
.viewer-title { font-weight: 700; }
.viewer-meta { opacity: .75; }
.mac-foot { display: flex; justify-content: space-between; align-items: center; gap: 1ch; padding: 8px 12px; border-top: 2px solid var(--mac-ink); }
.mac-foot button {
  font: 700 14px/1 var(--mono); color: var(--mac-ink); background: var(--mac-paper); cursor: pointer;
  border: 2px solid var(--mac-ink); border-radius: 0; padding: 5px 12px;   /* square, terminal style */
}
.mac-foot button:hover, .mac-foot button:active { background: var(--mac-ink); color: var(--mac-paper); }
.viewer :focus-visible { outline: 2px dotted var(--mac-ink); outline-offset: 2px; }
.zoom-rect {
  position: fixed; pointer-events: none; opacity: 0;
  border: 1px solid #faa968; outline: 1px solid var(--bg);
  animation: zoom-rect 70ms linear;   /* hidden while it waits its turn, shown only while it runs */
}
@keyframes zoom-rect { from, to { opacity: 1; } }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav { justify-content: flex-start; }
  .gallery { columns: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
}
