/* ==========================================================================
   Xfindr — editorial design system
   Typographic approach: oversized Jost display, Geist Mono micro-labels with
   wide tracking, Instrument Serif italic for emphasis, hairline rules and
   generous vertical rhythm. Palette stays light blue + white.
   ========================================================================== */

:root {
  /* Surfaces */
  --paper:        #ffffff;
  --paper-2:      #f5f9fb;
  --paper-3:      #e9f2f7;
  --paper-sunk:   #dceaf1;

  /* Ink */
  --ink:          #0c161e;
  --ink-2:        #3a4b56;
  --ink-dim:      #6d7f8a;
  --ink-faint:    #98a8b2;

  /* Hairlines */
  --rule:         #dfeaf0;
  --rule-lit:     #bed3de;

  /* Brand — the original light-blue pair, kept */
  --blue:         #2193b0;
  --blue-lit:     #6dd5ed;
  --blue-deep:    #12657c;
  --blue-wash:    #eaf6fa;
  --on-blue:      #ffffff;

  --accent:       var(--blue-deep);

  /* Type */
  --font-display: "Jost", Futura, "Century Gothic", "Trebuchet MS", system-ui, sans-serif;
  --font-body:    "Inter", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --font-serif:   "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-mono:    "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Fluid display scale, capped against viewport height so headings never
     push the fold off-screen on short windows. */
  --t-monument:   min(clamp(3.6rem, 13vw, 10rem), 24vh);
  --t-major:      min(clamp(2.5rem, 7vw, 5.25rem), 17vh);
  --t-minor:      clamp(1.75rem, 3.2vw, 2.5rem);
  --t-micro:      0.6875rem;

  --measure:      68ch;
  --gutter:       clamp(1.25rem, 4vw, 3.5rem);
  --shell:        min(1240px, 100% - var(--gutter) * 2);

  --radius:       14px;
  --radius-lg:    22px;
  --speed:        260ms;
  --ease:         cubic-bezier(0.22, 0.61, 0.36, 1);
}

body.dark {
  --paper:        #0b1319;
  --paper-2:      #101c24;
  --paper-3:      #16262f;
  --paper-sunk:   #0a1015;

  --ink:          #eef6fa;
  --ink-2:        #b3c6d0;
  --ink-dim:      #8ba0ac;
  --ink-faint:    #6a7f8b;

  --rule:         #1e313c;
  --rule-lit:     #2f4b59;

  --blue-wash:    #12242d;
  --accent:       var(--blue-lit);
}

/* --------------------------------------------------------------- base --- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

/* ---------------------------------------------------------- typography --- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 0.92;
  margin: 0;
  text-wrap: balance;
}

.display {
  font-size: var(--t-monument);
  line-height: 0.82;
  letter-spacing: -0.045em;
}

.display-major { font-size: var(--t-major); line-height: 0.88; }
.display-minor { font-size: var(--t-minor); line-height: 1.0; letter-spacing: -0.03em; }

/* The full stop carries the accent, as a small deliberate flourish. */
.stop { color: var(--blue); }

.lede {
  font-size: clamp(1.0625rem, 1.6vw, 1.3125rem);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: var(--measure);
  margin: 1.25rem 0 0;
}

.serif-note {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15em;
  color: var(--ink-2);
}

/* Monospace micro-label — the recurring structural motif. */
.micro {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0;
}

.micro-strong { color: var(--ink-2); }

/* ------------------------------------------------------------- layout --- */

.shell { width: var(--shell); margin-inline: auto; }

main { flex: 1 0 auto; width: 100%; }

.section {
  padding-block: clamp(2.5rem, 6vw, 5rem);
  border-top: 1px solid var(--rule);
}
.section:first-of-type { border-top: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.stack   { display: flex; flex-direction: column; gap: 1rem; }
.stack-l { display: flex; flex-direction: column; gap: 2rem; }
.center-col {
  width: min(440px, 100%);
  margin-inline: auto;
}

/* ------------------------------------------------------------- header --- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--rule);
}

.site-header__inner {
  width: var(--shell);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 68px;
}

.brand { display: inline-flex; align-items: center; gap: 0.6rem; flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand img { height: 26px; width: auto; }
.brand__light { display: none; }
body.dark .brand__dark  { display: none; }
body.dark .brand__light { display: block; }

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.75rem);
}

.nav-link {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 0.4rem 0;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}
.nav-link:hover { color: var(--ink); border-bottom-color: var(--blue); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--ink); border-bottom-color: var(--blue); }

.icon-btn {
  appearance: none;
  border: 1px solid var(--rule-lit);
  background: transparent;
  color: var(--ink-2);
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease),
              border-color var(--speed) var(--ease);
}
.icon-btn:hover { background: var(--blue-wash); color: var(--ink); border-color: var(--blue); }

/* ------------------------------------------------------------ buttons --- */

.btn {
  --btn-bg: var(--ink);
  --btn-fg: var(--paper);
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform var(--speed) var(--ease), background var(--speed) var(--ease),
              color var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { --btn-bg: var(--blue); --btn-fg: var(--on-blue); }
.btn-primary:hover { --btn-bg: var(--blue-deep); }

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  border-color: var(--rule-lit);
}
.btn-ghost:hover { --btn-bg: var(--blue-wash); border-color: var(--blue); }

.btn-block { width: 100%; }

/* -------------------------------------------------------------- forms --- */

.field { display: flex; flex-direction: column; gap: 0.45rem; }

.field > label,
.form-label {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--paper);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }

input[type="file"] {
  width: 100%;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  background: var(--paper-2);
  border: 1px dashed var(--rule-lit);
  border-radius: var(--radius);
  cursor: pointer;
}
input[type="file"]:hover { border-color: var(--blue); background: var(--blue-wash); }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.95rem;
  color: var(--ink-2);
}
.checkbox-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--blue); }

.form-error {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b4232f;
  background: #fdeced;
  border-left: 2px solid #b4232f;
  padding: 0.7rem 0.9rem;
  border-radius: 0 6px 6px 0;
}
body.dark .form-error { background: #2a1416; color: #ff8b93; }

/* --------------------------------------------------------- auth panel --- */

.panel {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 4vw, 2.75rem);
}

.panel-head { margin-bottom: 1.75rem; }
.panel-head .micro { margin-bottom: 0.75rem; }

.panel-foot {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--ink-dim);
  text-align: center;
}

/* ------------------------------------------------------------ hero ------ */

.hero {
  padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(1.5rem, 4vw, 3rem);
}

.hero__meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: clamp(1.75rem, 5vw, 3.5rem);
}

.hero__title { margin-bottom: 0.5rem; }

/* ===================================================== carousel ========= */

.carousel {
  position: relative;
  border-block: 1px solid var(--rule);
  background:
    linear-gradient(180deg, var(--paper-2) 0%, var(--paper) 100%);
  padding-block: clamp(1.75rem, 4vw, 2.75rem);
  overflow: hidden;
}

.carousel__head {
  width: var(--shell);
  margin: 0 auto clamp(1.25rem, 3vw, 2rem);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

/* Viewport clips the track; the track itself is centred and translated. */
.card-container {
  position: relative;
  width: 100%;
  height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Feather the edges so cards dissolve rather than getting chopped. */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.card {
  position: absolute;
  /* Anchored to the container's true centre. Relying on the static position
     of an absolutely-positioned flex child put the run off-centre by exactly
     one card, which clipped the right-hand card against the mask. */
  left: 50%;
  top: 50%;
  width: 208px;
  height: 300px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--paper-3);
  border: 1px solid var(--rule);
  box-shadow: 0 1px 2px rgba(12, 22, 30, 0.05), 0 12px 28px -18px rgba(12, 22, 30, 0.35);
  cursor: pointer;
  will-change: transform, opacity;
  transition: transform 700ms var(--ease), opacity 700ms var(--ease),
              box-shadow var(--speed) var(--ease), border-color var(--speed) var(--ease);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(6, 18, 26, 0.82) 100%);
  pointer-events: none;
}

.card img { width: 100%; height: 100%; object-fit: cover; }

.card h3 {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  margin: 0;
  padding: 0.9rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.2;
}

.card:hover {
  border-color: var(--blue);
  box-shadow: 0 1px 2px rgba(12, 22, 30, 0.06), 0 22px 44px -20px rgba(33, 147, 176, 0.6);
}

/* Depth cue: the centre card sits forward, neighbours recede. */
.card[data-depth="0"] { z-index: 3; }
.card[data-depth="1"] { z-index: 2; }
.card[data-depth="2"] { z-index: 1; }

.carousel__empty {
  width: var(--shell);
  margin-inline: auto;
  text-align: center;
  padding-block: clamp(2rem, 6vw, 4rem);
}
.carousel__empty .display-minor { margin-bottom: 0.75rem; }

/* ---------------------------------------------------- profile grid ------ */

.profile-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: clamp(1rem, 2.2vw, 1.75rem);
}

.profile-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--speed) var(--ease), transform var(--speed) var(--ease),
              box-shadow var(--speed) var(--ease);
}
.profile-card:hover {
  transform: translateY(-3px);
  border-color: var(--rule-lit);
  box-shadow: 0 18px 38px -24px rgba(12, 22, 30, 0.5);
}

.profile-card > a { display: block; color: inherit; }
.profile-card > a:hover { text-decoration: none; }

.profile-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--paper-3);
}

.profile-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  padding: 0.9rem 1.1rem 0.2rem;
  color: var(--ink);
}

.profile-card p {
  margin: 0;
  padding: 0 1.1rem 0.35rem;
  font-size: 0.875rem;
  color: var(--ink-dim);
}
.profile-card p.bio {
  color: var(--ink-2);
  padding-top: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.profile-card p:last-of-type { padding-bottom: 0.9rem; }

.like-btn, .go-to-top-btn {
  appearance: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 999px;
  transition: all var(--speed) var(--ease);
}

.like-btn {
  margin: 0 1.1rem 0.75rem;
  padding: 0.5rem 0.9rem;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  color: var(--ink-2);
  align-self: flex-start;
}
.like-btn:hover { border-color: #e05c6a; color: #e05c6a; }
.like-btn.liked { background: #fdeced; border-color: #e05c6a; color: #c2313f; }
body.dark .like-btn.liked { background: #2a1416; }

.go-to-top-btn {
  margin: 0 1.1rem 1.1rem;
  padding: 0.5rem 0.9rem;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-dim);
  align-self: flex-start;
}
.go-to-top-btn:hover { border-color: var(--blue); color: var(--blue-deep); }

/* --------------------------------------------------------- age gate ----- */

.popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: color-mix(in srgb, var(--ink) 62%, transparent);
  backdrop-filter: blur(10px) saturate(140%);
  padding: 1.25rem;
  overflow-y: auto;
}
.popup.is-open { display: grid; place-items: center; }

.popup-content {
  position: relative;
  width: min(430px, 100%);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 5vw, 2.5rem);
  text-align: center;
  box-shadow: 0 40px 80px -32px rgba(6, 18, 26, 0.6);
  animation: gate-in 420ms var(--ease) both;
}

@keyframes gate-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.popup-content .brand-mark {
  width: 46px; height: 46px;
  margin: 0 auto 1.25rem;
}
.popup-content .micro { margin-bottom: 0.85rem; }
.popup-content h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4.5vw, 2.1rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin: 0 0 0.75rem;
  color: var(--ink);
}
.popup-content p {
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-dim);
}
.popup-actions { display: flex; flex-direction: column; gap: 0.6rem; }
.popup-actions .btn { width: 100%; }

/* Nothing follows the buttons now, so the dialog keeps a little space below
   them rather than ending flush against its own padding. */
.popup-actions { padding-bottom: 0.5rem; }

/* ------------------------------------------------------ profile page ---- */

.profile-hero {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

.profile-portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule);
  background: var(--paper-3);
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 1.75rem;
}
.detail-list div { background: var(--paper); padding: 0.9rem 1rem; }
.detail-list dt {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 0.3rem;
}
.detail-list dd { margin: 0; font-size: 0.95rem; color: var(--ink); }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.gallery-item { position: relative; }
.gallery-item img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
}
.remove-photo {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(8, 18, 26, 0.72);
  color: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
}
.remove-photo:hover { background: #c2313f; }

.credits-display {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue-deep);
  background: var(--blue-wash);
  border: 1px solid var(--rule-lit);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  display: inline-block;
}

/* ------------------------------------------------------ filter overlay -- */

.filter-btn {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 70;
}

#filterOverlay {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(400px, 100%);
  z-index: 90;
  background: var(--paper);
  border-left: 1px solid var(--rule);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 380ms var(--ease);
  box-shadow: -30px 0 60px -40px rgba(6, 18, 26, 0.5);
}
#filterOverlay.open { transform: none; }

.liked-profiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.6rem;
  margin-top: 0.85rem;
}
.liked-profiles img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--rule);
}
.liked-profiles.expanded { max-height: none; }

/* ------------------------------------------------------------ footer ---- */

.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  padding-block: clamp(2rem, 5vw, 3.25rem);
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
}
.site-footer__inner {
  width: var(--shell);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.site-footer img { height: 22px; width: auto; opacity: 0.85; }

/* ------------------------------------------------------------- utils ---- */

.tick-rule {
  height: 1px;
  background: repeating-linear-gradient(90deg,
    var(--rule-lit) 0 1px, transparent 1px 9px);
  margin-block: 1.25rem;
}

.empty-note {
  text-align: center;
  padding-block: clamp(2.5rem, 7vw, 5rem);
  color: var(--ink-dim);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

body.page-fade-out { opacity: 0; transition: opacity 180ms var(--ease); }

/* ------------------------------------------------------- responsive ----- */

@media (max-width: 760px) {
  .profile-hero { grid-template-columns: 1fr; }
  .card-container { height: 300px; }
  .card { width: 176px; height: 258px; }
  .site-header__inner { min-height: 60px; }
  .brand img { height: 22px; }
  .nav-link { letter-spacing: 0.16em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==================================================== page furniture ==== */

/* Browse: search + filters bar ------------------------------------------- */
.browse-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  padding-bottom: clamp(1.25rem, 3vw, 2rem);
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
  border-bottom: 1px solid var(--rule);
}
.browse-toolbar .search-form { flex: 1 1 260px; }
.browse-toolbar .filter-btn { position: static; flex: 0 0 auto; }

.browse-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 260px);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}
@media (max-width: 900px) { .browse-layout { grid-template-columns: 1fr; } }

/* Trending rail ---------------------------------------------------------- */
.trending {
  position: sticky;
  top: 92px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  padding: 1.25rem;
}
.trending-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
}
.trending-item:last-child { border-bottom: 0; }
.trending-item:hover { text-decoration: none; color: var(--blue-deep); }
.trending-item img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.trending-name {
  font-size: 0.9rem; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trending-likes {
  font-family: var(--font-mono);
  font-size: 0.68rem; letter-spacing: 0.08em;
  color: var(--ink-dim);
}

/* Filter drawer ---------------------------------------------------------- */
.filter-overlay {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(400px, 100%);
  z-index: 90;
  background: var(--paper);
  border-left: 1px solid var(--rule);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 380ms var(--ease);
  box-shadow: -30px 0 60px -40px rgba(6, 18, 26, 0.5);
}
.filter-overlay.open { transform: none; }
.filter-content { padding: clamp(1.5rem, 4vw, 2.25rem); }

.filter-form--inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: end;
  padding-bottom: clamp(1.25rem, 3vw, 2rem);
  border-bottom: 1px solid var(--rule);
}
.filter-form--inline .btn { height: 46px; }

/* Two-up form rows ------------------------------------------------------- */
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.profile-form .profile-hero { align-items: start; }
.image-tag-btn { align-self: flex-start; }

/* Credit bundles --------------------------------------------------------- */
.purchase-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(0.75rem, 2vw, 1.25rem);
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
}
.purchase-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 1.5rem 1.25rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  color: var(--ink);
  transition: border-color var(--speed) var(--ease), transform var(--speed) var(--ease),
              background var(--speed) var(--ease);
}
.purchase-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: var(--blue);
  background: var(--blue-wash);
}
.purchase-amount {
  font-family: var(--font-display);
  font-size: 3rem; font-weight: 900;
  line-height: 1; letter-spacing: -0.04em;
}
.purchase-price {
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8rem; letter-spacing: 0.1em;
  color: var(--blue-deep);
}

/* Cropper modal ---------------------------------------------------------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: color-mix(in srgb, var(--ink) 62%, transparent);
  backdrop-filter: blur(8px);
  padding: 1.25rem;
  overflow-y: auto;
  /* The scripts open this with an inline `display: flex`, so the centring has
     to be flex alignment rather than grid placement. */
  align-items: center;
  justify-content: center;
}
.modal.open { display: flex; }
.modal-content {
  width: min(560px, 100%);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 4vw, 1.75rem);
}
.modal-content img { max-height: 60vh; margin-inline: auto; }

/* Cropper.js replaces the <img> with its own container. Constrain both, so a
   failure to load its stylesheet cannot spill a full-resolution photo across
   the page. */
#cropperImage { display: block; max-width: 100%; }
.modal-content .cropper-container { max-width: 100%; }
.modal-content .cropper-view-box img,
.modal-content .cropper-canvas img { max-height: none; }
.modal-actions { display: flex; gap: 0.6rem; margin-top: 1.25rem; }
.modal-actions .btn { flex: 1; }

/* Liked-profiles dropdown ------------------------------------------------ */
.liked-profiles-block {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  padding: 1.25rem;
}
.dropdown-toggle {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.dropdown-toggle:hover { color: var(--ink); }
.dropdown-content { display: none; margin-top: 1rem; }
.dropdown-content.expanded { display: grid; }

/* Age-gate mark ---------------------------------------------------------- */
.popup-content .brand-mark { display: block; }
body.dark .popup-content .brand-mark { filter: invert(1) brightness(1.6); }

/* Stripe element --------------------------------------------------------- */
#payment-element { margin-bottom: 0.5rem; }
#payment-message:not(:empty) {
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  background: var(--blue-wash);
  color: var(--blue-deep);
}

/* On narrow screens the four nav links plus the brand need more room than
   375px gives, so the nav drops to its own row rather than being squeezed. */
@media (max-width: 620px) {
  .site-header__inner {
    flex-wrap: wrap;
    row-gap: 0.35rem;
    padding-block: 0.55rem;
    min-height: 0;
  }
  .site-nav {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .nav-link { font-size: 0.625rem; letter-spacing: 0.11em; }
  .icon-btn { width: 30px; height: 30px; flex: 0 0 auto; }

  .hero__meta { flex-direction: column; gap: 0.35rem; }
  .browse-toolbar { flex-direction: column; align-items: stretch; }
  /* flex-basis is the main axis, which is now vertical: without this the
     search field claims 260px of height instead of width. */
  .browse-toolbar .search-form { flex: 0 0 auto; }
  .browse-toolbar .filter-btn { width: 100%; }
  .trending { position: static; }
}

/* The carousel leads the homepage, so it sits flush under the header and is
   given more room than when it sat below a hero. */
.carousel--lead {
  border-top: 0;
  padding-block: clamp(1.5rem, 3.5vw, 2.5rem) clamp(2rem, 4.5vw, 3.25rem);
  background: linear-gradient(180deg, var(--paper-2) 0%, var(--paper) 92%);
}
.carousel--lead .card-container { height: clamp(320px, 46vh, 400px); }
.carousel--lead .card { height: clamp(292px, 42vh, 364px); }

.section--tight { padding-block: clamp(1.5rem, 3.5vw, 2.25rem); border-top: 0; }

.lead-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Sign in with X ---------------------------------------------------------- */
.oauth-block { margin-top: 1.5rem; }
.oauth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.oauth-divider::before,
.oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.oauth-x { gap: 0.6rem; }
.oauth-x svg { flex: 0 0 auto; }
.oauth-note {
  margin-top: 0.6rem;
  text-align: center;
  letter-spacing: 0.16em;
}

/* Moderation -------------------------------------------------------------- */
.nav-link--admin { color: var(--blue-deep); }

.admin-notice {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue-deep);
  background: var(--blue-wash);
  border-left: 2px solid var(--blue);
  padding: 0.7rem 0.9rem;
  border-radius: 0 6px 6px 0;
  margin-bottom: 1.25rem;
}

.admin-list { display: flex; flex-direction: column; gap: 0.75rem; }

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  gap: 1.25rem;
  align-items: start;
  padding: 1.1rem 1.25rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}
.admin-row.is-blocked { background: var(--paper-2); opacity: 0.78; }

.admin-who { display: flex; gap: 0.9rem; align-items: flex-start; min-width: 0; }
.admin-avatar {
  width: 52px; height: 52px; flex: 0 0 auto;
  border-radius: 12px; object-fit: cover;
  background: var(--paper-3); border: 1px solid var(--rule);
}
.admin-name {
  font-family: var(--font-display);
  font-size: 1.15rem; font-weight: 800;
  letter-spacing: -0.02em; margin: 0 0 0.15rem;
}
.admin-meta {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  margin: 0.4rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-dim);
}
.admin-status { font-weight: 500; }
.admin-status--active    { color: #1a7f4b; }
.admin-status--suspended { color: #a8730c; }
.admin-status--banned    { color: #b4232f; }

.admin-actions {
  display: flex; flex-wrap: wrap; gap: 0.45rem;
  justify-content: flex-end;
}
.admin-form { display: flex; gap: 0.35rem; align-items: center; }
.admin-form input[type="number"] {
  width: 68px; padding: 0.4rem 0.5rem;
  font-family: var(--font-mono); font-size: 0.78rem;
}
.btn-sm { padding: 0.45rem 0.8rem; font-size: 0.66rem; letter-spacing: 0.12em; }
.btn-danger { color: #b4232f; border-color: #e8b4b8; }
.btn-danger:hover { background: #fdeced; border-color: #b4232f; }
body.dark .btn-danger { color: #ff8b93; border-color: #5a2a2e; }
body.dark .btn-danger:hover { background: #2a1416; }

@media (max-width: 760px) {
  .admin-row { grid-template-columns: 1fr; }
  .admin-actions { justify-content: flex-start; }
}

/* Gallery preview built by profile.js before upload -------------------------- */
#galleryPreview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.6rem;
}
#galleryPreview:empty { display: none; }

.thumb { position: relative; }
.thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--paper-3);
}
.remove-preview {
  position: absolute;
  top: 6px; right: 6px;
  width: 24px; height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(8, 18, 26, 0.72);
  color: #fff;
  font-size: 0.78rem;
  line-height: 1;
  cursor: pointer;
}
.remove-preview:hover { background: #c2313f; }

/* Credit badges ----------------------------------------------------------- */
:root { --badge-red: #f5434e; --badge-red-deep: #d92f3c; }

.credit-badge {
  /* Sized by height, not width: each tier has a different viewBox width, so
     constraining the width instead would scale the narrower badges up and
     render the same label at four different sizes. */
  height: 58px;
  width: auto;
  max-width: 100%;
  overflow: visible;
  /* The bubble's tail points at the price below it, so the whole badge tips
     forward slightly on hover rather than just scaling. */
  transform-origin: 50% 85%;
  transition: transform 320ms var(--ease), filter 320ms var(--ease);
  filter: drop-shadow(0 6px 14px rgba(217, 47, 60, 0.28));
}

.credit-badge__bubble {
  fill: var(--badge-red);
  transition: fill 320ms var(--ease);
}

.credit-badge__label {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.credit-badge__icon {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 420ms var(--ease);
}

/* Hover: the badge lifts, deepens, and the icons pop in sequence so the
   higher tiers visibly have more in them. */
.purchase-card:hover .credit-badge,
.purchase-card:focus-visible .credit-badge {
  transform: translateY(-6px) rotate(-1.4deg) scale(1.045);
  filter: drop-shadow(0 14px 26px rgba(217, 47, 60, 0.42));
}
.purchase-card:hover .credit-badge__bubble { fill: var(--badge-red-deep); }

.purchase-card:hover .credit-badge__icon {
  animation: badge-pop 460ms var(--ease) both;
  animation-delay: calc(var(--i) * 70ms);
}

@keyframes badge-pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.28) translateY(-2px); }
  100% { transform: scale(1); }
}

.purchase-card .purchase-price {
  margin-top: 0;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  color: var(--ink-2);
  transition: color 320ms var(--ease);
}
.purchase-card:hover .purchase-price { color: var(--blue-deep); }

@media (prefers-reduced-motion: reduce) {
  .purchase-card:hover .credit-badge { transform: none; }
  .purchase-card:hover .credit-badge__icon { animation: none; }
}

/* Checkout ---------------------------------------------------------------- */
.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 280px);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}
@media (max-width: 860px) {
  .checkout-layout { grid-template-columns: 1fr; }
}

.checkout-summary {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  padding: 1.25rem;
  text-align: center;
}
.checkout-summary .credit-badge { margin-top: 0.5rem; }

#checkout { min-height: 320px; }

/* Honeypot -----------------------------------------------------------------
   Positioned off-screen rather than display:none. Some form-filling bots skip
   fields that are outright hidden, and this one only works if they fill it. */
.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.cf-turnstile { margin-top: 0.5rem; }
