/* =========================================================
   Amateur Engineers - public site styles
   Palette pulled from the logo: deep navy, cyan, mint,
   orange, coral and yellow.
   ========================================================= */

:root {
  --navy-950: #001a38;   /* footer */
  --navy-900: #00254d;   /* page background */
  --navy-850: #072f5c;   /* panels */
  --navy-800: #0c3a6b;   /* cards */
  --navy-700: #15477e;   /* hover */
  --line: rgba(124, 196, 235, 0.16);
  --line-strong: rgba(124, 196, 235, 0.3);

  --text: #e9f2ff;
  --muted: #95acd0;

  --cyan: #3cc3e0;
  --mint: #91ccac;
  --orange: #ff9f1c;
  --coral: #e9496f;
  --yellow: #ffc93c;

  --font-display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --radius: 14px;
  --wrap: 1180px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--navy-900);
  color: var(--text);
  font: 400 1.0625rem/1.65 var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--cyan); text-underline-offset: 3px; }
a:hover { color: var(--yellow); }
img { max-width: 100%; height: auto; }

:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--yellow); color: var(--navy-900); padding: .5rem 1rem; z-index: 100;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- Hero / page header ---------- */

.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 3.25rem 1rem 2.75rem;
  text-align: center;
  background:
    radial-gradient(ellipse 55% 70% at 50% 45%, #003063 0%, var(--navy-900) 70%),
    var(--navy-900);
  border-bottom: 1px solid var(--line);
}

/* the build-plate grid: fine 10mm squares + bold 50mm squares, fading toward the centre */
.hero::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--line-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-strong) 1px, transparent 1px),
    linear-gradient(rgba(124, 196, 235, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 196, 235, .07) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: center center;
  -webkit-mask-image: radial-gradient(ellipse 60% 75% at 50% 45%, transparent 18%, #000 75%);
          mask-image: radial-gradient(ellipse 60% 75% at 50% 45%, transparent 18%, #000 75%);
}

/* corner registration marks, like a print bed */
.hero::after {
  content: "";
  position: absolute; inset: 14px; z-index: -1; pointer-events: none;
  background:
    linear-gradient(var(--cyan), var(--cyan)) top left / 22px 2px,
    linear-gradient(var(--cyan), var(--cyan)) top left / 2px 22px,
    linear-gradient(var(--cyan), var(--cyan)) top right / 22px 2px,
    linear-gradient(var(--cyan), var(--cyan)) top right / 2px 22px,
    linear-gradient(var(--cyan), var(--cyan)) bottom left / 22px 2px,
    linear-gradient(var(--cyan), var(--cyan)) bottom left / 2px 22px,
    linear-gradient(var(--cyan), var(--cyan)) bottom right / 22px 2px,
    linear-gradient(var(--cyan), var(--cyan)) bottom right / 2px 22px;
  background-repeat: no-repeat;
  opacity: .55;
}

.hero-inner { max-width: var(--wrap); margin: 0 auto; }

.hero-home { padding: 2.25rem 1rem 3rem; }

.hero-logo {
  display: block;
  width: clamp(160px, 26vw, 240px);
  margin: 0 auto -.5rem;
  /* fade the square edge of the logo artwork into the header */
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 72%, transparent 84%);
          mask-image: radial-gradient(circle at 50% 50%, #000 72%, transparent 84%);
}

.hero-mark img {
  display: block; margin: 0 auto .5rem; width: 64px; height: 64px; border-radius: 14px;
  box-shadow: 0 0 0 1px var(--line-strong);
}

.hero-title {
  margin: 0;
  font: 700 clamp(2.1rem, 5.4vw, 3.6rem)/1.05 var(--font-display);
  letter-spacing: .01em;
  text-transform: uppercase;
  background: linear-gradient(92deg, var(--cyan) 0%, var(--mint) 38%, var(--yellow) 68%, var(--orange) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

.hero-sub {
  margin: .6rem auto 0;
  max-width: 40rem;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
}

/* Spec-sheet header: a printed datasheet */
.hero-specsheet {
  background: #f4f1e8;
  color: #13233f;
  border-bottom: 4px solid var(--navy-900);
  text-align: left;
}
.hero-specsheet::before {
  background-image:
    linear-gradient(rgba(13, 42, 92, .14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 42, 92, .14) 1px, transparent 1px);
  background-size: 100% 32px, 25% 100%;
  -webkit-mask-image: none; mask-image: none;
}
.hero-specsheet::after { opacity: 0; }
.hero-specsheet .hero-title {
  background: none; color: #0d2a5c;
  font-size: clamp(1.9rem, 4.6vw, 3rem);
}
.spec-meta {
  display: flex; flex-wrap: wrap; gap: .4rem 1.5rem;
  margin-bottom: .9rem;
  font: 500 .8rem/1 var(--font-mono);
  letter-spacing: .08em;
  color: #c23a5b;
}
.spec-meta span { border: 1.5px solid currentColor; padding: .35rem .55rem; }

/* ---------- Menu bar ---------- */

.menubar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(0, 26, 56, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.menubar-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 0 1rem;
  display: flex; align-items: center; gap: 1rem;
}
.menubar-home {
  display: flex; align-items: center; gap: .55rem;
  color: var(--text); text-decoration: none;
  font: 700 .95rem/1 var(--font-display); text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
.menubar-home img { border-radius: 7px; }
.menubar ul {
  list-style: none; margin: 0 0 0 auto; padding: 0;
  display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none;
}
.menubar ul::-webkit-scrollbar { display: none; }
.menubar li a {
  display: block; padding: 1rem .8rem;
  color: var(--muted); text-decoration: none; white-space: nowrap;
  font: 600 .92rem/1 var(--font-display); letter-spacing: .05em; text-transform: uppercase;
  border-bottom: 3px solid transparent;
}
.menubar li a:hover { color: var(--text); border-bottom-color: var(--line-strong); }
.menubar li a[aria-current="page"] { color: var(--text); border-bottom-color: var(--orange); }

@media (max-width: 760px) {
  .menubar ul { margin-left: 0; }
  .menubar li a { padding: .95rem .6rem; font-size: .85rem; }
}

/* ---------- Page body ---------- */

.page {
  flex: 1;
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 2.5rem 1rem 4rem;
}

.section { margin-top: 2.5rem; }
.section-title {
  display: flex; align-items: center; gap: .8rem;
  margin: 0 0 1.1rem;
  font: 700 1.35rem/1.2 var(--font-display); text-transform: uppercase; letter-spacing: .04em;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.notice {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: var(--navy-850);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.notice p { margin: 0; color: var(--muted); }
.notice-tag {
  font: 600 .78rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .08em;
  color: var(--navy-900); background: var(--yellow);
  padding: .4rem .6rem; border-radius: 6px;
}

/* category tiles (All categories page) */
.cat-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.cat-card {
  --accent: var(--cyan);
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; gap: .45rem;
  min-height: 190px;
  padding: 1.2rem 1.2rem 2.8rem;
  color: var(--text); text-decoration: none;
  background: linear-gradient(160deg, var(--navy-800), var(--navy-850));
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.cat-card.has-image::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(0, 37, 77, .55), rgba(0, 37, 77, .92) 70%), var(--card-image) center / cover;
}
.cat-card:hover {
  color: var(--text);
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px -12px var(--accent);
}
.cat-card-name { font: 700 1.35rem/1.1 var(--font-display); text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.cat-card-desc { font-size: .95rem; color: var(--muted); line-height: 1.5; }
.cat-card-count { position: absolute; left: 1.2rem; bottom: .9rem; font: 500 .8rem/1 var(--font-mono); color: var(--muted); }
.cat-card-go { position: absolute; right: 1rem; bottom: .7rem; font-size: 1.3rem; color: var(--accent); }

/* ---------- Article / CMS pages ---------- */

.prose { max-width: 46rem; margin: 0 auto; }
.prose h2 {
  margin: 2.2rem 0 .6rem;
  font: 700 1.4rem/1.25 var(--font-display); text-transform: uppercase; letter-spacing: .03em;
  color: var(--mint);
}
.prose h2:first-child { margin-top: 0; }
.prose h3 { font: 600 1.15rem/1.3 var(--font-display); margin: 1.6rem 0 .4rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: .35rem 0; }
.prose strong { color: #fff; }
.prose .updated { margin-top: 3rem; font: .82rem var(--font-mono); color: var(--muted); }

/* spec-sheet body: datasheet section rules */
.prose-spec h2 {
  color: var(--yellow);
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--line-strong);
  font-size: 1.15rem;
}
.prose-spec h2::before {
  content: "§ "; color: var(--coral);
}

.button {
  display: inline-block;
  padding: .7rem 1.2rem;
  border-radius: 10px;
  background: var(--orange); color: var(--navy-900);
  font: 700 .95rem/1 var(--font-display); text-transform: uppercase; letter-spacing: .05em;
  text-decoration: none;
}
.button:hover { background: var(--yellow); color: var(--navy-900); }

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--line);
  background: var(--navy-950);
  color: var(--muted);
  font-size: .92rem;
}
.footer-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 1.6rem 1rem;
  display: flex; flex-wrap: wrap; gap: .5rem 2rem; align-items: center;
}
.footer p { margin: 0; }
.footer-links { list-style: none; margin: 0 0 0 auto; padding: 0; display: flex; gap: 1.25rem; }
@media (max-width: 640px) { .footer-links { margin-left: 0; } }

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

/* =========================================================
   Step 4 - public pages
   ========================================================= */

/* --- header variants --- */
.hero.has-image { background: var(--navy-900); }
.hero.has-image::before {
  background-image:
    linear-gradient(180deg, rgba(0, 37, 77, .55) 0%, rgba(0, 37, 77, .78) 60%, var(--navy-900) 100%),
    var(--hero-image);
  background-size: cover; background-position: center;
  -webkit-mask-image: none; mask-image: none;
}
.hero-category, .hero-listing, .hero-grid { --accent: var(--cyan); }
.hero-category .hero-title, .hero-listing .hero-title {
  background: none; color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .55);
}
.hero-category .hero-inner::after, .hero-listing .hero-inner::after {
  content: ""; display: block; width: 64px; height: 4px; margin: 1rem auto 0; border-radius: 2px; background: var(--accent);
}
.hero-eyebrow {
  margin: 0 0 .4rem;
  font: 500 .82rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .14em;
  color: var(--accent);
}
.hero-eyebrow a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; }
.hero-eyebrow a:hover { color: #fff; }
.hero-icon {
  display: block; width: 112px; height: 112px; margin: 0 auto 1rem;
  object-fit: contain; padding: 10px;
  border-radius: 22px; background: rgba(7, 47, 92, .85);
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 0 6px rgba(0, 37, 77, .5), 0 14px 40px -12px var(--accent);
}
.hero-sub { text-wrap: balance; }

/* --- mobile menu --- */
.menu-toggle {
  display: none; margin-left: auto; align-items: center; gap: .55rem;
  padding: .6rem .8rem; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--text); border: 1px solid var(--line-strong);
  font: 600 .85rem/1 var(--font-display); text-transform: uppercase; letter-spacing: .06em;
}
.menu-toggle-bars, .menu-toggle-bars::before, .menu-toggle-bars::after {
  display: block; width: 16px; height: 2px; background: currentColor; border-radius: 1px; position: relative;
}
.menu-toggle-bars::before, .menu-toggle-bars::after { content: ""; position: absolute; left: 0; }
.menu-toggle-bars::before { top: -5px; }
.menu-toggle-bars::after { top: 5px; }
@media (max-width: 760px) {
  .has-menu-toggle .menubar-inner { flex-wrap: wrap; padding-top: .55rem; padding-bottom: .55rem; }
  .has-menu-toggle .menu-toggle { display: inline-flex; }
  .has-menu-toggle .menubar ul { display: none; flex-basis: 100%; flex-direction: column; margin: .4rem 0 0; }
  .has-menu-toggle .menubar ul.is-open { display: flex; }
  .has-menu-toggle .menubar li a { padding: .8rem .2rem; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
  .has-menu-toggle .menubar li a[aria-current="page"] { border-bottom-color: var(--line); border-left-color: var(--orange); padding-left: .6rem; }
}

/* --- section headers --- */
.home-section { --accent: var(--cyan); margin-top: 0; }
.home-section + .home-section { margin-top: 3rem; }
.section-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: .4rem; }
.section-head .section-title { flex: 1; margin: 0; }
.section-title a { color: var(--accent, var(--text)); text-decoration: none; }
.section-title a:hover { color: #fff; }
.home-section .section-title::after { background: linear-gradient(90deg, var(--accent), transparent); opacity: .5; }
.section-more { font: 600 .85rem/1 var(--font-display); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; text-decoration: none; }
.section-desc { margin: 0 0 1.1rem; color: var(--muted); font-size: .95rem; }
.empty-note { margin: .5rem 0 0; padding: 1rem 1.2rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); }
.related { margin-top: 3.5rem; }
.related .section-head { margin-bottom: 1.1rem; }

/* --- listing cards --- */
.listings { display: grid; gap: 1rem; }
.listings.view-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.listings.view-list { grid-template-columns: 1fr; gap: .6rem; }

.card {
  --accent: var(--cyan);
  position: relative;
  display: flex; flex-direction: column;
  background: linear-gradient(170deg, var(--navy-800), var(--navy-850));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 12px 32px -16px var(--accent); }
.card:focus-within { border-color: var(--accent); }

.card-media {
  display: grid; place-items: center;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(rgba(124, 196, 235, .07) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(90deg, rgba(124, 196, 235, .07) 1px, transparent 1px) 0 0 / 18px 18px,
    #021e40;
  border-bottom: 1px solid var(--line);
}
.card-media img { width: 100%; height: 100%; object-fit: contain; padding: 14px; }
.card-initial { font: 700 3rem/1 var(--font-display); color: var(--accent); opacity: .85; }

.card-body { display: flex; flex-direction: column; gap: .35rem; padding: .95rem 1.05rem 1.05rem; flex: 1; }
.card-title { margin: 0; font: 700 1.12rem/1.25 var(--font-display); letter-spacing: .01em; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; }     /* whole card is clickable */
.card-title a:hover { color: var(--accent); }
.featured { color: var(--yellow); font-size: .9em; margin-left: .2rem; }
.card-host { margin: 0; font: .8rem var(--font-mono); color: var(--accent); }
.card-desc {
  margin: .15rem 0 0; color: var(--muted); font-size: .93rem; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-tags { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; padding-top: .55rem; }

.tag, .cat-chip {
  display: inline-block; padding: .25rem .6rem; border-radius: 999px;
  font-size: .78rem; line-height: 1.3; text-decoration: none; white-space: nowrap;
}
.tag { color: #c7f0d8; background: rgba(145, 204, 172, .1); border: 1px solid rgba(145, 204, 172, .4); }
.tag:hover { color: #fff; border-color: var(--mint); background: rgba(145, 204, 172, .2); }
.cat-chip { color: var(--accent); border: 1px solid var(--accent); background: transparent; font-weight: 600; }
.cat-chip:hover { background: var(--accent); color: var(--navy-900); }

/* list view: compact rows */
.view-list .card { flex-direction: row; align-items: center; }
.view-list .card:hover { transform: none; }
.view-list .card-media { flex: 0 0 96px; width: 96px; height: 72px; aspect-ratio: auto; border-bottom: 0; border-right: 1px solid var(--line); align-self: stretch; height: auto; min-height: 72px; }
.view-list .card-media img { padding: 8px; }
.view-list .card-initial { font-size: 1.8rem; }
.view-list .card-body { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr) auto; align-items: center; gap: .2rem 1.25rem; padding: .7rem 1rem; }
.view-list .card-title { grid-column: 1; grid-row: 1; font-size: 1.02rem; }
.view-list .card-host { grid-column: 1; grid-row: 2; }
.view-list .card-desc { grid-column: 2; grid-row: 1 / span 2; margin: 0; -webkit-line-clamp: 2; font-size: .9rem; }
.view-list .card-tags { grid-column: 3; grid-row: 1 / span 2; margin: 0; padding: 0; justify-content: flex-end; max-width: 260px; }
@media (max-width: 860px) {
  .view-list .card-body { grid-template-columns: 1fr; }
  .view-list .card-title, .view-list .card-host, .view-list .card-desc, .view-list .card-tags { grid-column: 1; grid-row: auto; }
  .view-list .card-desc { display: none; }
  .view-list .card-tags { justify-content: flex-start; padding-top: .3rem; }
}

/* --- toolbar --- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.toolbar-count { margin: 0; font: 500 .85rem/1 var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.view-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.view-switch a {
  display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .8rem;
  color: var(--muted); text-decoration: none; font: 600 .82rem/1 var(--font-display); text-transform: uppercase; letter-spacing: .05em;
}
.view-switch a + a { border-left: 1px solid var(--line-strong); }
.view-switch svg { width: 14px; height: 14px; fill: currentColor; }
.view-switch a:hover { color: var(--text); }
.view-switch a.is-on { background: var(--navy-700); color: var(--text); }

.empty-state { max-width: 34rem; margin: 2rem auto; text-align: center; padding: 2.5rem 1.5rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-state h2 { margin: 0 0 .5rem; font: 700 1.3rem/1.2 var(--font-display); text-transform: uppercase; }
.empty-state p { margin: 0; color: var(--muted); }

/* --- listing page --- */
.listing { --accent: var(--cyan); max-width: 52rem; margin: 0 auto; }
.listing-head { margin-bottom: 1rem; }
.listing-name { margin: 0; font: 700 clamp(1.7rem, 4vw, 2.4rem)/1.1 var(--font-display); letter-spacing: .01em; }
.listing-url {
  display: block; margin-top: .45rem; padding-bottom: .55rem;
  border-bottom: 3px solid var(--accent);
  font: .95rem var(--font-mono); color: var(--accent); text-decoration: none;
  overflow-wrap: anywhere;
}
.listing-url:hover { color: #fff; }
.listing-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.4rem; }
.listing-desc { font-size: 1.08rem; }
.listing-desc p { margin: 0 0 1rem; }
.sub-title { margin: 2.5rem 0 1rem; font: 700 1.15rem/1.2 var(--font-display); text-transform: uppercase; letter-spacing: .05em; color: var(--mint); }

.gallery-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.gallery figure { margin: 0; }
.gallery a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 16 / 10; background: #021e40; }
.gallery a:hover { border-color: var(--accent); }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.gallery a:hover img { transform: scale(1.03); }
.gallery figcaption { margin-top: .4rem; font-size: .85rem; color: var(--muted); }

/* --- lightbox --- */
.lightbox {
  width: min(96vw, 1400px); max-height: 94vh; padding: 0; border: 0; background: transparent; color: var(--text); overflow: visible;
}
.lightbox::backdrop { background: rgba(0, 6, 22, .92); }
.lightbox figure { margin: 0; text-align: center; }
.lightbox img { max-width: 100%; max-height: 84vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.lightbox figcaption { margin-top: .6rem; color: var(--muted); }
.lightbox-close, .lightbox-nav {
  position: fixed; z-index: 2; display: grid; place-items: center; cursor: pointer;
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: rgba(7, 47, 92, .92); color: var(--text); font-size: 1.8rem; line-height: 1;
}
.lightbox-close { top: 16px; right: 16px; }
.lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-close:hover, .lightbox-nav:hover { border-color: var(--yellow); color: var(--yellow); }
.lightbox-nav[hidden] { display: none; }

/* --- Step 4 polish --- */
.card-media { text-decoration: none; }
.card-media img { width: auto; height: auto; max-width: 78%; max-height: 74%; padding: 0; }
.home-section .listings.view-grid, .related .listings.view-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.view-list .card-media img { max-width: 80%; max-height: 80%; }
.view-list .card-body { grid-template-columns: 220px minmax(0, 1fr) 290px; }
@media (max-width: 860px) {
  .view-list .card-body { grid-template-columns: 1fr; }
}

/* =========================================================
   Step 5 - search, filters, tags
   ========================================================= */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* sidebar search button */
.side-search button {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
}
.side-search button:hover { color: var(--yellow); }
.side-search svg { width: 15px; height: 15px; fill: currentColor; }

/* browse layout: sidebar + results */
.browse { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 2rem; align-items: start; }
.browse-side { position: sticky; top: 70px; }
.filter-box {
  padding: 1.1rem 1.1rem 1.25rem;
  background: var(--navy-850); border: 1px solid var(--line); border-radius: var(--radius);
}
.filter-box summary {
  list-style: none; cursor: default;
  font: 700 1rem/1 var(--font-display); text-transform: uppercase; letter-spacing: .06em;
}
.filter-box summary::-webkit-details-marker { display: none; }
.filter-badge {
  display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; margin-left: .35rem; padding: 0 .35rem;
  border-radius: 999px; background: var(--orange); color: var(--navy-900); font-size: .78rem;
}
.side-label {
  display: block; margin: 1.3rem 0 .55rem;
  font: 500 .74rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.side-search { margin-top: .2rem; }
.side-search-row { position: relative; }
.side-search input {
  width: 100%; padding: .6rem 2.4rem .6rem .75rem;
  background: var(--navy-900); color: var(--text); border: 1px solid var(--line-strong); border-radius: 9px; font: inherit; font-size: .92rem;
}
.side-search input:focus { outline: none; border-color: var(--cyan); }
.side-note { margin: 0; color: var(--muted); font-size: .9rem; }

.facets, .sorts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.facet {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  padding: .42rem .6rem; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: .93rem;
}
.facet:hover { background: var(--navy-700); color: var(--text); }
.facet-n { font: .78rem var(--font-mono); color: var(--muted); }
.facet.is-on { background: rgba(145, 204, 172, .16); color: #c7f0d8; box-shadow: inset 3px 0 0 var(--mint); font-weight: 600; }
.facet.is-on:hover { background: rgba(233, 73, 111, .16); box-shadow: inset 3px 0 0 var(--coral); }
.facet-x { font-size: 1.1rem; line-height: 1; }
.clear-filters { display: inline-block; margin-top: .7rem; font-size: .88rem; color: var(--coral); }
.sorts a { display: block; padding: .4rem .6rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .93rem; }
.sorts a:hover { color: var(--text); background: var(--navy-700); }
.sorts a.is-on { color: var(--text); box-shadow: inset 3px 0 0 var(--orange); background: var(--navy-800); }

@media (max-width: 900px) {
  .browse { grid-template-columns: 1fr; gap: 1.2rem; }
  .browse-side { position: static; }
  .filter-box summary { cursor: pointer; display: flex; align-items: center; }
  .filter-box summary::after {
    content: ""; margin-left: auto; width: 8px; height: 8px;
    border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
    transform: translateY(-2px) rotate(45deg); transition: transform .15s;
  }
  .filter-box[open] summary::after { transform: translateY(2px) rotate(-135deg); }
}
@media (min-width: 901px) {
  .filter-box summary { pointer-events: none; }        /* always open on wide screens */
}

/* tag cloud */
.home-tags { margin-top: 3.5rem; }
.home-tags .section-head { margin-bottom: 1rem; }
.cloud { list-style: none; margin: 0; padding: 1.4rem; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .5rem 1.1rem;
  background: var(--navy-850); border: 1px solid var(--line); border-radius: var(--radius); }
.cloud-tag { color: var(--mint); text-decoration: none; font-family: var(--font-display); font-weight: 600; line-height: 1.2; }
.cloud-tag:hover { color: var(--yellow); text-decoration: underline; }
.cloud-tag.s1 { font-size: .9rem; color: var(--muted); }
.cloud-tag.s2 { font-size: 1.05rem; }
.cloud-tag.s3 { font-size: 1.3rem; color: var(--cyan); }
.cloud-tag.s4 { font-size: 1.6rem; color: var(--cyan); }
.cloud-tag.s5 { font-size: 1.95rem; color: var(--orange); }

/* search page */
.big-search { display: flex; gap: .6rem; max-width: 44rem; margin: 0 auto 2rem; }
.big-search input {
  flex: 1; min-width: 0; padding: .85rem 1.1rem;
  background: var(--navy-850); color: var(--text); border: 1px solid var(--line-strong); border-radius: 12px; font: inherit; font-size: 1.05rem;
}
.big-search input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(60, 195, 224, .2); }
.big-search .button { border: 0; cursor: pointer; padding: .85rem 1.4rem; }

/* all tags A-Z */
.az { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; margin-bottom: 2rem; }
.az a {
  display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 8px;
  border: 1px solid var(--line-strong); color: var(--text); text-decoration: none; font: 700 .95rem/1 var(--font-display);
}
.az a:hover { border-color: var(--orange); color: var(--orange); }
.tag-index { columns: 4 220px; column-gap: 2rem; }
.tag-group { break-inside: avoid; margin-bottom: 1.6rem; scroll-margin-top: 80px; }
.tag-letter { margin: 0 0 .4rem; padding-bottom: .3rem; border-bottom: 2px solid var(--line-strong); font: 700 1.4rem/1 var(--font-display); color: var(--orange); }
.tag-group ul { list-style: none; margin: 0; padding: 0; }
.tag-group a { display: flex; justify-content: space-between; gap: .6rem; padding: .32rem .2rem; color: var(--text); text-decoration: none; border-bottom: 1px dashed var(--line); }
.tag-group a:hover { color: var(--mint); }

/* =========================================================
   Menu bar tweaks: logo only, collapsible search
   ========================================================= */
.menubar-inner { position: relative; min-height: 60px; }
.menubar-home { padding: 8px 0; }
.menubar-home img { width: 44px; height: 44px; border-radius: 10px; box-shadow: 0 0 0 1px var(--line-strong); }
.menubar-home:hover img { box-shadow: 0 0 0 2px var(--orange); }

/* the search: a circle with a magnifier... */
.nav-search {
  position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); z-index: 5;
  display: flex; align-items: center; justify-content: flex-end;
  width: 40px; height: 40px;
  transition: width .25s ease;
}
.nav-search input {
  width: 100%; height: 40px; padding: 0 3rem 0 1.1rem;
  background: var(--navy-850); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 999px;
  font: inherit; font-size: .98rem;
  opacity: 0; pointer-events: none;
  transition: opacity .15s ease;
}
.nav-search input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(60, 195, 224, .2); }
.nav-search-btn {
  position: absolute; right: 0; top: 0;
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  background: var(--navy-850); color: var(--text); border: 1px solid var(--line-strong);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.nav-search-btn:hover { border-color: var(--yellow); color: var(--yellow); }
.nav-search-btn svg { width: 16px; height: 16px; fill: currentColor; }
/* ...that opens across the menu (everything right of the logo) */
.nav-search.is-open { width: calc(100% - 44px - 3rem); }
.nav-search.is-open input { opacity: 1; pointer-events: auto; }
.nav-search.is-open .nav-search-btn { background: transparent; border-color: transparent; color: var(--cyan); }
.nav-search.is-open .nav-search-btn:hover { color: var(--yellow); }
/* while open, the menu items underneath are hidden completely */
.search-open > ul, .search-open > .menu-toggle { visibility: hidden; }
/* make room so the last menu item never sits under the circle */
.menubar ul { margin-right: 52px; }
/* without JavaScript the circle simply opens the search page */
@media (max-width: 760px) {
  .menubar ul { margin-right: 0; }
  .has-menu-toggle .menu-toggle { margin-right: 52px; }
  .has-menu-toggle .nav-search { top: 30px; }
}
@media (prefers-reduced-motion: reduce) { .nav-search, .nav-search input { transition: none; } }

/* "View all" links take the category's colour on the home page */
.home-section .section-more { color: var(--accent); }
.home-section .section-more:hover { color: #fff; }

/* =========================================================
   Listing header: rule line + TechTag icons
   ========================================================= */
.hero-listing .hero-inner::after { display: none; }
.hero-rule { display: block; width: 64px; height: 4px; margin: 1rem auto 0; border-radius: 2px; background: var(--accent); }
.hero-techtags {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem;
}
.hero-techtags li {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .38rem .7rem .38rem .55rem; border-radius: 999px;
  background: rgba(0, 26, 56, .72); border: 1px solid var(--line-strong);
  font: 600 .78rem/1 var(--font-display); text-transform: uppercase; letter-spacing: .06em; color: var(--text);
  backdrop-filter: blur(4px);
}
.hero-techtags .ti { width: 18px; height: 18px; color: var(--accent); }

/* =========================================================
   Maker's Take: a card on a textured build plate
   ========================================================= */
.makers-take {
  position: relative;
  width: calc(100% - 3rem); max-width: 46rem;
  margin: 2rem auto 2.2rem;
  padding: 1.5rem 1.7rem 1.4rem;
  border-radius: 18px;
  color: #261806;
  background-color: #c99d52;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='1' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .95 0 0 0 0 .8 0 0 0 3 -2.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"),
    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='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .22 0 0 0 0 .06 0 0 0 2.2 -1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 90% 70% at 30% 15%, rgba(255, 236, 190, .55), transparent 60%),
    linear-gradient(135deg, #d9b16a 0%, #c4964b 45%, #b4843c 100%);
  background-size: 120px 120px, 180px 180px, 100% 100%, 100% 100%;
  box-shadow:
    inset 0 0 0 1px rgba(255, 240, 205, .45),
    inset 0 0 0 5px rgba(120, 82, 28, .18),
    0 16px 40px -18px rgba(0, 0, 0, .7);
}
/* the alignment notch found on magnetic spring-steel sheets */
.makers-take::before {
  content: ""; position: absolute; left: 50%; top: -1px; transform: translateX(-50%);
  width: 64px; height: 10px; border-radius: 0 0 10px 10px;
  background: var(--navy-900);
  box-shadow: inset 0 -1px 0 rgba(255, 240, 205, .35);
}
.makers-take-title {
  margin: 0 0 .6rem;
  font: 700 .92rem/1 var(--font-display); text-transform: uppercase; letter-spacing: .14em;
  color: #5a3a0e;
}
.makers-take-title::before { content: "✎ "; letter-spacing: 0; }
.makers-take-body { font-size: 1.02rem; line-height: 1.65; }
.makers-take-body p { margin: 0 0 .8rem; }
.makers-take-body p:last-child { margin-bottom: 0; }
.makers-take a { color: #4a2c00; font-weight: 600; }
@media (max-width: 640px) { .makers-take { width: 100%; padding: 1.3rem 1.2rem; } }

/* =========================================================
   Menu bar: logo that hangs below the bar, and "More…"
   ========================================================= */
:root { --menu-logo-h: 76px; --menu-logo-w: 76px; --menu-logo-stuck: 50px; }
/* centred on the bar: the extra height spills equally above and below without making the bar taller */
.menubar-home { position: relative; z-index: 6; align-self: center; padding: 0; }
.menubar-home img {
  display: block; height: var(--menu-logo-h); width: auto; max-width: 160px;
  margin: calc((60px - var(--menu-logo-h)) / 2) 0;
  border-radius: 0; box-shadow: none;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .45));
  transition: height .2s ease, margin .2s ease, transform .15s ease;
}
.menubar-home:hover img { box-shadow: none; transform: scale(1.04); }
/* once the bar sticks to the top of the window there's no room above it, so the logo settles inside the bar */
.menubar.is-stuck .menubar-home img { height: var(--menu-logo-stuck); margin: calc((60px - var(--menu-logo-stuck)) / 2) 0; }
.menubar-sentinel { height: 1px; margin-bottom: -1px; }
.nav-search.is-open { width: calc(100% - var(--menu-logo-w) - 3rem); }

/* with JavaScript, items that don't fit move into "More…" instead of scrolling */
.has-menu-more #main-menu { flex: 1 1 auto; min-width: 0; justify-content: flex-end; overflow: visible; }
.menu-more { position: relative; }
.menu-more-btn {
  display: block; padding: 1rem .8rem; cursor: pointer;
  background: none; border: 0; border-bottom: 3px solid transparent;
  color: var(--muted); white-space: nowrap;
  font: 600 .92rem/1 var(--font-display); letter-spacing: .05em; text-transform: uppercase;
}
.menu-more-btn:hover, .menu-more-btn[aria-expanded="true"] { color: var(--text); border-bottom-color: var(--line-strong); }
.menu-more.has-current .menu-more-btn { color: var(--text); border-bottom-color: var(--orange); }
.menubar .menu-more-list {
  display: none; position: absolute; right: 0; top: 100%; z-index: 30;
  flex-direction: column; gap: 0; min-width: 13rem; margin: 0; padding: .35rem 0; overflow: visible;
  background: var(--navy-900); border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7);
}
.menu-more.is-open .menu-more-list { display: flex; }
.menubar .menu-more-list a { padding: .7rem 1rem; border-bottom: 0; border-left: 3px solid transparent; }
.menubar .menu-more-list a:hover { background: var(--navy-800); border-bottom: 0; }
.menubar .menu-more-list a[aria-current="page"] { border-left-color: var(--orange); border-bottom: 0; }

@media (max-width: 760px) {
  :root { --menu-logo-h: 48px; --menu-logo-w: 48px; }
  :root { --menu-logo-stuck: 48px; }
  .menubar.is-stuck .menubar-home img { margin: 0; }
  .menubar-home img { margin: 0; }
  .has-menu-toggle .menu-more { display: none; }
}
