/* =====================================================
   Pixmely — public frontend
   Imagery-forward gallery. Quiet monochrome chrome so
   photos carry the colour; one cobalt accent, used sparingly.
   System fonts (zero external requests = fast, SEO-friendly).
   ===================================================== */

:root {
  --ink:      #141518;
  --ink-2:    #3b3c42;
  --muted:    #7a7b83;
  --canvas:   #ffffff;
  --panel:    #f5f6f7;
  --line:     #e7e8ec;
  --accent:   #2f5bff;
  --accent-d: #1f43cc;
  --radius:   14px;
  --radius-s: 10px;
  --maxw:     1200px;
}
* , *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--canvas); line-height: 1.6; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; color: var(--accent); margin: 0 0 10px; }

/* Header */
.site-head { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--line); }
.head-inner { display: flex; align-items: center; gap: 20px; height: 64px; min-width: 0; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.02em; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: .85rem; font-weight: 800; }
.logo-word { font-size: 1.12rem; }
.logo-dim { color: var(--muted); font-weight: 700; }
.site-nav { display: flex; gap: 20px; margin-left: 6px; }
.site-nav a { font-size: .92rem; font-weight: 600; color: var(--ink-2); }
.site-nav a:hover { color: var(--ink); }
.head-search { margin-left: auto; display: flex; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 4px 4px 14px; }
.head-search input { border: none; background: none; outline: none; font-size: .9rem; width: 180px; min-width: 0; color: var(--ink); }
.head-search button { display: grid; place-items: center; width: 34px; height: 34px; border: none; cursor: pointer; background: var(--ink); color: #fff; border-radius: 999px; }
.head-search button:hover { background: #000; }

/* Hero */
.hero { padding: 64px 0 40px; border-bottom: 1px solid var(--line); }
.hero-title { font-size: clamp(2.2rem, 5.5vw, 3.6rem); line-height: 1.05; letter-spacing: -.03em; font-weight: 800; margin: 0 0 16px; }
.hero-sub { font-size: 1.08rem; color: var(--ink-2); max-width: 46ch; margin: 0 0 28px; }
.hero-search { display: flex; gap: 8px; max-width: 560px; }
.hero-search input { min-width: 0; }
.hero-search input { flex: 1; padding: 15px 18px; font-size: 1rem; color: var(--ink); border: 1.5px solid var(--line); border-radius: 12px; outline: none; background: #fff; }
.hero-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(47,91,255,.12); }
.hero-search button { padding: 0 24px; font-size: 1rem; font-weight: 700; color: #fff; cursor: pointer; background: var(--ink); border: none; border-radius: 12px; }
.hero-search button:hover { background: #000; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.chip { font-size: .85rem; font-weight: 600; color: var(--ink-2); padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.chip:hover { border-color: var(--ink); color: var(--ink); }

/* Bands */
.band { padding: 44px 0; }
.band-top { padding-top: 40px; }
.band-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.band-head h2 { font-size: 1.5rem; letter-spacing: -.02em; margin: 0; font-weight: 800; }
.band-head .eyebrow { margin-bottom: 6px; }
.more { font-size: .9rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
.more:hover { color: var(--accent-d); }
.page-title { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -.02em; font-weight: 800; margin: 0 0 8px; }
.page-lead { color: var(--ink-2); margin: 0 0 24px; font-size: 1.02rem; }
.crumbs { font-size: .84rem; color: var(--muted); margin-bottom: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--ink); }
.crumbs b { color: var(--ink-2); font-weight: 600; }

/* Masonry */
.masonry { column-count: 4; column-gap: 16px; }
@media (max-width: 1100px) { .masonry { column-count: 3; } }
@media (max-width: 760px)  { .masonry { column-count: 2; } }
@media (max-width: 440px)  { .masonry { column-count: 1; } }
.ph-card { position: relative; display: block; margin: 0 0 16px; break-inside: avoid; border-radius: var(--radius-s); overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.ph-img { width: 100%; height: auto; transition: transform .5s ease; }
.ph-card:hover .ph-img { transform: scale(1.04); }
.ph-overlay { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 12px 14px; color: #fff; opacity: 0; background: linear-gradient(to top, rgba(10,10,15,.72) 0%, rgba(10,10,15,0) 55%); transition: opacity .25s ease; }
.ph-card:hover .ph-overlay, .ph-card:focus-visible .ph-overlay { opacity: 1; }
.ph-title { font-size: .85rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ph-dl { flex-shrink: 0; width: 32px; height: 32px; display: grid; place-items: center; background: rgba(255,255,255,.18); border-radius: 8px; backdrop-filter: blur(4px); }

/* Category cards */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.cat-card { border-radius: var(--radius-s); overflow: hidden; border: 1px solid var(--line); background: #fff; }
.cat-cover { aspect-ratio: 4 / 3; overflow: hidden; background: var(--panel); }
.cat-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.cat-card:hover .cat-cover img { transform: scale(1.05); }
.cat-cover-empty { width: 100%; height: 100%; background: repeating-linear-gradient(45deg, #eef0f3, #eef0f3 10px, #f5f6f7 10px, #f5f6f7 20px); }
.cat-cap { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 13px 15px; }
.cat-name { font-weight: 700; letter-spacing: -.01em; }
.cat-count { font-size: .8rem; color: var(--muted); }

/* Detail */
.detail { padding: 28px 0 20px; }
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 32px; align-items: start; }
.detail-stage { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; place-items: center; min-height: 300px; }
.detail-stage img { max-height: 74vh; width: auto; border-radius: 6px; box-shadow: 0 10px 40px rgba(15,18,30,.12); }
.detail-side { position: sticky; top: 84px; }
.detail-title { font-size: 1.5rem; letter-spacing: -.02em; font-weight: 800; margin: 0 0 12px; }
.badge-link { display: inline-block; font-size: .8rem; font-weight: 700; color: var(--accent); background: rgba(47,91,255,.09); padding: 5px 12px; border-radius: 999px; margin-bottom: 20px; }
.badge-link:hover { background: rgba(47,91,255,.16); }
.btn-download { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 15px 20px; font-size: 1.02rem; font-weight: 700; color: #fff; cursor: pointer; background: var(--ink); border-radius: 12px; transition: background .15s; }
.btn-download:hover { background: #000; }
.specs { margin: 24px 0 0; padding: 20px 0 4px; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.specs div { display: flex; justify-content: space-between; align-items: baseline; }
.specs dt { color: var(--muted); font-size: .88rem; margin: 0; }
.specs dd { margin: 0; font-weight: 600; font-size: .92rem; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.tag { font-size: .82rem; color: var(--ink-2); background: var(--panel); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; }
.tag:hover { border-color: var(--ink); color: var(--ink); }

/* Pager */
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 36px; }
.pager a, .pager .pg-gap { min-width: 40px; height: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; font-weight: 600; color: var(--ink-2); background: #fff; }
.pager a:hover { border-color: var(--ink); color: var(--ink); }
.pager a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager .pg-gap { border: none; background: none; color: var(--muted); }
.pager .pg-arrow { font-weight: 700; }

/* Empty / misc */
.empty-state { padding: 56px 20px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.search-page { max-width: 560px; margin-bottom: 28px; }
.notfound { text-align: center; padding: 80px 0; }
.notfound .btn-download { width: auto; display: inline-flex; margin-top: 12px; }

/* Footer */
.site-foot { border-top: 1px solid var(--line); margin-top: 40px; background: var(--panel); }
.foot-inner { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; padding: 40px 20px 24px; }
.foot-brand .logo-word { font-size: 1.1rem; font-weight: 800; }
.foot-brand p { color: var(--muted); font-size: .9rem; margin: 12px 0 0; max-width: 34ch; }
.foot-nav { display: flex; gap: 22px; align-items: flex-start; }
.foot-nav a { font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.foot-nav a:hover { color: var(--ink); }
.foot-legal { padding: 0 20px 32px; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); padding-top: 20px; }

/* Detail responsive */
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } .detail-side { position: static; } .detail-stage img { max-height: 60vh; } }

/* Focus + motion */
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Search toolbar ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; padding: 14px 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.tb-left { font-weight: 700; color: var(--ink); }
.tb-right { display: flex; gap: 16px; flex-wrap: wrap; }
.tb-right label { font-size: .82rem; color: var(--muted); font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px; }
.tb-right select { font-family: inherit; font-size: .88rem; color: var(--ink); font-weight: 600;
  padding: 8px 30px 8px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237a7b83' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.tb-right select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.suggest { padding-top: 8px; }

/* =====================================================
   Mobile / tablet refinements
   ===================================================== */

/* Tablet & below: header wraps to two rows, search gets its own full-width row */
@media (max-width: 820px) {
  .head-inner {
    flex-wrap: wrap;
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    gap: 10px 16px;
  }
  .logo { margin-right: auto; }          /* push nav to the right of the logo */
  .site-nav { gap: 20px; }
  .site-nav a { padding: 6px 2px; }       /* bigger tap target */
  .head-search {
    order: 3;
    width: 100%;
    margin-left: 0;
    padding: 6px 6px 6px 16px;
  }
  .head-search input { width: 100%; flex: 1; font-size: 1rem; }  /* 16px stops iOS zoom */
  .head-search button { width: 38px; height: 38px; }
  .band-head { flex-wrap: wrap; }
}

/* Phones */
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }

  /* Header: logo left, nav right, comfortable tap targets */
  .head-inner { padding-top: 10px; padding-bottom: 10px; }
  .logo-mark { width: 28px; height: 28px; }
  .logo-word { font-size: 1.02rem; }
  .site-nav { gap: 16px; }
  .site-nav a { font-size: .9rem; padding: 6px 2px; }
  .head-search input { font-size: 1rem; }

  .logo-word { font-size: 1rem; }
  .logo-mark { width: 27px; height: 27px; }
  .site-nav { gap: 14px; }
  .site-nav a { font-size: .86rem; }

  .hero { padding: 36px 0 30px; }
  .hero-sub { font-size: 1rem; margin-bottom: 22px; }
  .hero-search { flex-direction: column; }
  .hero-search input,
  .hero-search button { width: 100%; }
  .hero-search button { padding: 13px 20px; }

  .band { padding: 32px 0; }
  .band-head { margin-bottom: 18px; }
  .band-head h2 { font-size: 1.28rem; }
  .more { margin-top: 4px; }

  /* Category cards: two per row instead of a 220px minimum that can overflow */
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cat-cap { padding: 11px 12px; flex-direction: column; align-items: flex-start; gap: 2px; }
  .cat-name { font-size: .92rem; }

  /* Search toolbar stacks */
  .toolbar { gap: 12px; padding-bottom: 16px; margin-bottom: 20px; }
  .tb-right { width: 100%; gap: 10px; }
  .tb-right label { flex: 1; min-width: 0; }
  .tb-right select { width: 100%; min-width: 0; }

  /* Detail page */
  .detail { padding: 18px 0 12px; }
  .detail-stage { padding: 12px; min-height: 0; }
  .detail-stage img { max-height: 52vh; }
  .detail-title { font-size: 1.3rem; }

  /* Footer */
  .foot-inner { flex-direction: column; gap: 20px; padding: 32px 16px 20px; }
  .foot-nav { gap: 18px; }
  .foot-legal { padding: 16px 16px 28px; }

  .pager a, .pager .pg-gap { min-width: 36px; height: 36px; padding: 0 9px; font-size: .85rem; }
  .empty-state { padding: 40px 16px; }
}

/* Very small phones: single-column category grid */
@media (max-width: 380px) {
  .cat-grid { grid-template-columns: 1fr; }
  .site-nav { gap: 12px; }
}

/* =====================================================
   Keywords section (below the main image)
   ===================================================== */
.detail-main { min-width: 0; }
.keywords {
  margin-top: 20px; padding: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.kw-head {
  margin: 0 0 14px; font-size: 1rem; font-weight: 700;
  color: var(--ink); letter-spacing: -.01em;
}
.kw-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kw {
  display: inline-block; padding: 8px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  font-size: .86rem; color: var(--ink-2); line-height: 1.2;
  transition: border-color .15s, color .15s;
}
.kw:hover { border-color: var(--ink); color: var(--ink); }
.kw.is-hidden { display: none; }
.kw-toggle {
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: .86rem; font-weight: 600; color: var(--ink-2);
  padding: 8px 4px; text-decoration: underline; text-underline-offset: 3px;
}
.kw-toggle:hover { color: var(--accent); }
@media (max-width: 560px) {
  .keywords { padding: 16px; margin-top: 16px; }
  .kw { padding: 7px 12px; font-size: .82rem; }
}

/* =====================================================
   Small phones — final polish (<= 400px)
   ===================================================== */
@media (max-width: 400px) {
  .wrap { padding: 0 14px; }

  /* Header stays on one tidy row: shrink nav slightly, keep logo readable */
  .head-inner { gap: 8px 12px; }
  .logo-word { font-size: .98rem; }
  .site-nav { gap: 13px; }
  .site-nav a { font-size: .86rem; }

  /* Hero: keep the big title from feeling cramped */
  .hero { padding: 30px 0 26px; }
  .hero-title { font-size: 2rem; line-height: 1.1; }
  .hero-sub { font-size: .96rem; }
  .eyebrow { font-size: .72rem; }

  /* One column of category cards reads better than two squeezed ones */
  .cat-grid { grid-template-columns: 1fr; gap: 12px; }
  .cat-card .cat-cover { aspect-ratio: 16 / 10; }   /* shorter, less scrolling */

  /* Comfortable tap target for the main search button */
  .hero-search button { padding: 14px 20px; font-size: 1rem; }

  /* Footer: stack neatly */
  .foot-nav { flex-wrap: wrap; gap: 14px; }
}

/* Make every primary button/link comfortable to tap on touch devices */
@media (hover: none) and (pointer: coarse) {
  .btn, .hero-search button, .head-search button,
  .site-nav a, .foot-nav a, .chip { min-height: 40px; }
  .site-nav a, .foot-nav a { display: inline-flex; align-items: center; }
}

/* =====================================================
   Flash messages (public side)
   ===================================================== */
.flash {
  margin: 18px 0 0; padding: 13px 16px; border-radius: 10px;
  font-size: .92rem; font-weight: 500; border: 1px solid transparent;
}
.flash-ok  { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash-err { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* =====================================================
   Auth pages (contributor register / login)
   ===================================================== */
.auth-page { padding: 40px 0 64px; }
.auth-wrap { display: flex; justify-content: center; }
.auth-card { width: 100%; max-width: 440px; }
.auth-title { font-size: 1.7rem; line-height: 1.15; margin: 6px 0 10px; letter-spacing: -.02em; }
.auth-lead { color: var(--muted); font-size: .95rem; line-height: 1.55; margin: 0 0 24px; }
.auth-form { margin-bottom: 18px; }
.auth-form .field { margin-bottom: 15px; }
.auth-form label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.auth-form .opt { font-weight: 400; color: var(--muted); }
.auth-form .input {
  width: 100%; padding: 11px 13px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.auth-form .input:focus {
  outline: none; border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(15,23,41,.08);
}
.fieldnote { font-size: .78rem; color: var(--muted); margin: 6px 0 0; }
.check { display: flex; gap: 9px; align-items: center; font-size: .85rem; color: var(--ink-2); cursor: pointer; }
.btn-block { width: 100%; justify-content: center; padding: 13px; font-size: 1rem; }
.auth-alt { text-align: center; font-size: .9rem; color: var(--muted); }
.auth-alt a { color: var(--accent); font-weight: 600; }

/* =====================================================
   Contributor dashboard
   ===================================================== */
.dash { padding: 36px 0 64px; }
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.dash-title { font-size: 1.7rem; margin: 4px 0 6px; letter-spacing: -.02em; }
.dash-sub { color: var(--muted); font-size: .9rem; margin: 0; }
.btn-ghost { background: none; border: 1px solid var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.dash-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 28px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; text-align: center;
}
.stat-num { display: block; font-size: 1.7rem; font-weight: 800; color: var(--ink); line-height: 1; }
.stat-label { display: block; margin-top: 6px; font-size: .82rem; color: var(--muted); }
.dash-empty {
  background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 32px 24px; text-align: center;
}
.dash-empty h2 { margin: 0 0 8px; font-size: 1.1rem; color: var(--ink); }
.dash-empty p { margin: 0 auto; max-width: 440px; color: var(--muted); font-size: .92rem; line-height: 1.55; }

@media (max-width: 560px) {
  .auth-page { padding: 28px 0 44px; }
  .auth-title { font-size: 1.45rem; }
  .dash-head { flex-direction: column; }
  .dash-stats { gap: 10px; }
  .stat-num { font-size: 1.4rem; }
}

/* "Contribute" call-to-action in the header nav */
.site-nav .nav-cta {
  background: var(--ink); color: #fff; padding: 7px 14px; border-radius: 999px;
}
.site-nav .nav-cta:hover { background: #000; color: #fff; }
@media (max-width: 560px) {
  .site-nav .nav-cta { padding: 6px 12px; }
}
