/* --------------------------------------------------------------------------
   Design tokens. Light values here, dark overrides below.
   -------------------------------------------------------------------------- */
:root {
  --bg:        #ffffff;
  --bg-soft:   #f4f5f7;
  --card:      #ffffff;
  --text:      #16191d;
  --text-soft: #5b6572;
  --border:    #e2e5ea;
  --accent:    #2563eb;
  --accent-fg: #ffffff;
  --shadow:    0 1px 2px rgba(16,25,45,.06), 0 8px 24px rgba(16,25,45,.07);

  --radius: 10px;
  --gap: 1.5rem;
  --wrap: 1180px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0e1116;
    --bg-soft:   #161b22;
    --card:      #161b22;
    --text:      #e6e9ee;
    --text-soft: #9aa4b2;
    --border:    #2a313b;
    --accent:    #5b91f5;
    --accent-fg: #0e1116;
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}

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

/* The `hidden` attribute is only display:none in the UA stylesheet, so any
   author rule setting display (.lb-link, .card-badge) silently beats it. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* --------------------------------------------------------------------------
   Header / footer
   -------------------------------------------------------------------------- */
.site-header {
  padding: 4rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -.02em;
}

.tagline {
  margin: .4rem 0 1.25rem;
  color: var(--text-soft);
  font-size: 1.1rem;
}

.links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.links a { text-decoration: none; font-weight: 600; }
.links a:hover { text-decoration: underline; }

.site-footer {
  margin-top: 5rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: .9rem;
}

/* --------------------------------------------------------------------------
   Filter chips
   -------------------------------------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 2rem;
}

/* The kind row sits directly above the tag row; tighten the gap between them
   so they read as two axes of one control rather than two separate widgets. */
#kind-filters { margin-bottom: .6rem; }

.chip {
  font: inherit;
  font-size: .875rem;
  padding: .35rem .85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-soft);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}

.chip:hover { border-color: var(--accent); color: var(--text); }

.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Card grid. auto-fill + minmax handles every breakpoint with no media query.
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--gap);
}

@media (max-width: 400px) {
  /* Below the 320px track width, stop the grid forcing horizontal overflow. */
  .grid { grid-template-columns: 1fr; }
}

.card {
  margin: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform .14s ease, border-color .14s ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent);
}

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

.card-frame { position: relative; }

.card-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top left;   /* dashboards read from the top-left corner */
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

/* Stand-in for projects with no image at all — a write-up, or a tool with
   nothing worth screenshotting. Matches .card-img's aspect ratio so a mixed
   grid keeps its rows aligned. */
.card-frame--text {
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.card-mark {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-soft);
}

/* "3 views" marker on projects carrying more than one screenshot. */
.card-badge {
  position: absolute;
  right: .6rem;
  bottom: .6rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: rgba(18,22,28,.78);
  color: #fff;
  backdrop-filter: blur(3px);
}

.card-body { padding: 1rem 1.1rem 1.25rem; flex: 1; }

.card-meta {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-soft);
  margin: 0 0 .35rem;
}

/* Optional state marker ("in progress"). Accent-bordered so it reads as a
   status rather than as another technology tag. */
.card-status {
  margin-left: .5rem;
  padding: .05rem .45rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: .7rem;
  letter-spacing: .05em;
  white-space: nowrap;
}

.card-title { margin: 0 0 .4rem; font-size: 1.15rem; letter-spacing: -.01em; }

.card-blurb {
  margin: 0 0 .9rem;
  color: var(--text-soft);
  font-size: .925rem;
}

/* Bullet-list blocks inside a blurb. The colour, size and margins already come
   from the .card-blurb / .lb-text class kept alongside; this only supplies what
   a <ul> additionally needs. */
.bullets { padding-left: 1.15rem; }
.bullets li { margin-bottom: .3rem; }
.bullets li:last-child { margin-bottom: 0; }

/* Consecutive blocks in one blurb shouldn't double up their gaps. */
.card-blurb + .card-blurb,
.lb-text + .lb-text { margin-top: -.35rem; }

/* Marks a card whose blurb continues in the lightbox, so the shortened card
   reads as deliberate rather than as a rendering bug. */
.card-more {
  margin: -.4rem 0 .9rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
}

.tags { display: flex; flex-wrap: wrap; gap: .35rem; }

.tag {
  font-size: .75rem;
  padding: .15rem .55rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-soft);
}

.empty { color: var(--text-soft); padding: 2rem 0; }

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */
.lightbox {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  background: var(--card);
  color: var(--text);
  max-width: min(1100px, 94vw);
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

.lightbox::backdrop { background: rgba(8,10,14,.82); }

.lb-figure { margin: 0; }

#lb-img {
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  background: var(--bg-soft);
}

.lb-caption { padding: 1.25rem 1.5rem 1.75rem; }
.lb-caption h2 { margin: 0; font-size: 1.35rem; }
.lb-caption p { margin: 0 0 .75rem; color: var(--text-soft); }
.lb-text { margin: 0 0 .75rem; color: var(--text-soft); }

.lb-head {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: .4rem;
}

.lb-count {
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .1rem .5rem;
  white-space: nowrap;
}

.lb-tags { display: flex; flex-wrap: wrap; gap: .35rem; }

.lb-link {
  display: inline-block;
  margin-top: .5rem;
  padding: .45rem 1rem;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: .9rem;
}

.lb-close, .lb-nav {
  position: fixed;
  z-index: 2;
  font: inherit;
  line-height: 1;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(20,24,30,.72);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  backdrop-filter: blur(4px);
}

.lb-close {
  top: 1.1rem; right: 1.1rem;
  width: 2.4rem; height: 2.4rem;
  font-size: 1.6rem;
}

.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 2.9rem; height: 2.9rem;
  font-size: 1.9rem;
}

.lb-prev { left: 1.1rem; }
.lb-next { right: 1.1rem; }

.lb-close:hover, .lb-nav:hover { background: var(--accent); border-color: var(--accent); }

@media (max-width: 600px) {
  .lb-nav { display: none; }  /* swipe-free devices get arrow keys / closing instead */
}

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