@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* Sized for a short number+label stat (research.md #22 note, T279 bugfix) -
   unlike .grid-3's 260px minimum (sized for full brand cards), two 260px
   tracks don't fit within the homepage stats block's own 32rem max-width
   container, so auto-fit always collapsed it to one column there. */
.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.gradient-text {
  background-image: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.glass-card {
  background: hsl(var(--card) / 0.85);
  border: 1px solid hsl(var(--border) / 0.5);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
}

.hover-lift {
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-elevated);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

.badge.active {
  background-image: var(--gradient-primary);
  color: hsl(var(--primary-foreground));
  border-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  min-height: 2.75rem;
}

/* Touch-target modifier (research.md #22): applied only where .badge is an
   interactive <a> link (pagination, clickable tag/contact links) — never on
   a plain display-only <span class="badge"> chip, which has no tap target
   to guarantee. */
.badge-link {
  min-height: 2.75rem;
}

.btn-primary {
  background-image: var(--gradient-primary);
  color: hsl(var(--primary-foreground));
}

.btn-outline {
  border-color: hsl(var(--border));
  background: transparent;
  color: hsl(var(--foreground));
}

/* Header language switcher (T286/T287): a <select> + fallback submit button
   sized to sit inline in nav.nav-primary at the same height as the adjacent
   .btn/theme-toggle controls, without reflowing the nav's existing flex row. */
.locale-select {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}

.locale-select select {
  height: 2.75rem;
  padding: 0 0.5rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--foreground));
  font-size: 0.85rem;
}

.locale-select-submit {
  padding: 0 0.75rem;
}

.locale-select-submit.js-hidden {
  display: none;
}

.text-muted {
  color: hsl(var(--muted-foreground));
}

/* Similar Brands carousel (research.md #15). Without carousel.js this is
   simply a native horizontally-scrollable list of real links — the content
   remains fully crawlable with no JS required (research.md #1, #6). */
.carousel {
  position: relative;
}

.carousel-track {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}

.carousel-item {
  flex: 0 0 260px;
  scroll-snap-align: start;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  border-radius: 999px;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.carousel-nav.prev {
  left: -0.75rem;
}

.carousel-nav.next {
  right: -0.75rem;
}

input[type="text"], input[type="search"], input[type="email"], input[type="password"], select, textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

/* Chip picker (research.md #21): a reusable tags/categories input with
   removable chips and a live-suggestion dropdown, replacing the earlier
   datalist-based tag-picker.js. */
.chip-picker {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--card));
}

.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.chip-remove:hover {
  background: hsl(var(--border));
}

.chip-picker-entry {
  flex: 1;
  min-width: 8rem;
  border: none !important;
  padding: 0.25rem !important;
  background: transparent !important;
}

.chip-picker-entry:focus {
  outline: none;
}

.chip-picker-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-elevated);
  max-height: 12rem;
  overflow-y: auto;
}

.chip-picker-suggestions[hidden] {
  /* display:flex above would otherwise override the hidden attribute and
     draw the empty, bordered list as a stray line under the input. */
  display: none;
}

.chip-picker-suggestions button {
  all: unset;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: hsl(var(--foreground));
}

.chip-picker-suggestions button:hover {
  background: hsl(var(--accent));
}

/* Tag field (004 research #8). Without JavaScript: checked checkboxes for
   existing tags plus a text input. With tag-select.js: chips and a combobox
   with a listbox popup, reusing the chip look above. */
.tag-select-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.tag-select-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  font-size: 0.85rem;
  cursor: pointer;
}

.tag-select-control {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
}

.tag-select-control:focus-within {
  border-color: hsl(var(--primary));
}

.tag-select-chips {
  display: contents;
  list-style: none;
}

.tag-select-control input[role="combobox"] {
  flex: 1;
  min-width: 8rem;
  border: none !important;
  padding: 0.25rem !important;
  background: transparent !important;
}

.tag-select-control input[role="combobox"]:focus {
  outline: none;
}

.tag-select-listbox {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  margin: 0.25rem 0 0;
  padding: 0.25rem 0;
  list-style: none;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-elevated);
  /* Never taller than the space a phone keyboard leaves. */
  max-height: min(16rem, 45vh);
  overflow-y: auto;
}

.tag-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: hsl(var(--foreground));
  overflow-wrap: anywhere;
}

.tag-select-item.active,
.tag-select-item:hover {
  background: hsl(var(--accent));
}

.tag-select-item[aria-selected="true"]::after {
  content: "✓";
  color: hsl(var(--primary));
}

.tag-select-create {
  font-weight: 600;
  border-top: 1px solid hsl(var(--border));
}

.tag-select-message {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

.badge-warn {
  border-color: hsl(var(--destructive));
  color: hsl(var(--destructive));
}

/* Responsive layout (research.md #22). Mobile-first: base rules below target
   phone portrait, the most constrained case; two min-width breakpoints
   (48rem tablet/landscape-phone, 64rem desktop) additively relax layout as
   space grows. See tokens.css for the breakpoint values as documentation. */

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

/* Header nav: a CSS-only checkbox-hack hamburger (research.md #22) — no JS
   is involved in opening/closing it, so it works identically whether or not
   JavaScript runs, unlike every other feature this project has added. */
.nav-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.nav-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--foreground));
  font-size: 1.25rem;
  cursor: pointer;
}

.nav-primary {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: hsl(var(--card));
  border-top: 1px solid hsl(var(--border));
  padding: 1rem;
  gap: 0.75rem;
  z-index: 40;
}

.nav-toggle-input:checked ~ .nav-primary {
  display: flex;
}

.nav-primary a {
  padding: 0.5rem 0.75rem;
  display: inline-block;
}

@media (min-width: 48rem) {
  .nav-toggle-btn {
    display: none;
  }

  .nav-primary {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    position: static;
    background: none;
    border: none;
    padding: 0;
    gap: 1.5rem;
    z-index: auto;
  }
}

@media (max-width: 47.99rem) {
  .nav-toggle-btn {
    display: flex;
  }
}

/* Admin sidebar + content layout. */
.admin-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: stretch;
}

@media (min-width: 48rem) {
  .admin-layout {
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

.admin-sidebar {
  --admin-sidebar-min-width: 14rem;
  min-width: 100%;
}

@media (min-width: 48rem) {
  .admin-sidebar {
    min-width: var(--admin-sidebar-min-width);
    width: auto;
  }
}

/* Catalog filter bar: full-width stacked fields on phones, existing
   min-width-driven wrap behavior returns at tablet+. */
.filter-bar > * {
  flex: 1 1 100%;
}

@media (min-width: 48rem) {
  .filter-bar > * {
    flex: initial;
  }
}

/* Generic utility for the remaining admin sub-form rows (ad-plan creation,
   moderation reason+action rows) that use fixed-width inputs today. */
.stack-mobile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

@media (min-width: 48rem) {
  .stack-mobile {
    flex-direction: row;
    align-items: flex-end;
  }
}

/* !important, scoped to the mobile-only query, is required here (unlike
   .filter-bar's flex-basis approach) because several stacked fields declare
   a hard inline `width:8rem`/`width:6rem` — an inline declaration always
   beats an external rule for that same property regardless of media query
   nesting, so an unqualified `.stack-mobile > * { width: 100% }` would
   silently have no effect. Scoping !important to only the sub-48rem query
   forces full width there while leaving the inline widths completely
   untouched (and therefore exactly as they were) at tablet+. */
@media (max-width: 47.99rem) {
  .stack-mobile > * {
    width: 100% !important;
  }
}

/* Shared add-brand form (002 research #1, #11): required group first,
   optional fields inside a native <details>. Built from the site's existing
   pieces: glass-card container, rounded inputs, Space Grotesk headings,
   pill-shaped secondary controls. */
.brand-form {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand-form-group {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.brand-form-legend {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0;
  margin-bottom: 0.25rem;
}

/* A fieldset's own top border runs through its legend, so groups are
   separated by a plain rule instead. */
.brand-form-divider {
  border: 0;
  border-top: 1px solid hsl(var(--border) / 0.6);
  margin: 0;
}

.brand-form-note {
  font-size: 0.85rem;
  margin: -0.35rem 0 0.25rem;
}

.brand-form-hint {
  font-size: 0.8rem;
  margin: 0.35rem 0 0;
}

.brand-form label:not(.sr-only) {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.brand-form input[type="text"],
.brand-form input[type="email"],
.brand-form select,
.brand-form textarea {
  width: 100%;
}

.brand-form [aria-invalid="true"] {
  border-color: hsl(var(--destructive));
}

.field-error {
  color: hsl(var(--destructive));
  font-size: 0.85rem;
  margin: 0.35rem 0 0;
}

.required-marker {
  color: hsl(var(--destructive));
  margin-left: 0.25rem;
}

.brand-form-optional {
  /* No box around the optional area: its fields line up with the required
     ones, edge to edge, and only thin rules mark where it starts. */
  border-top: 1px solid hsl(var(--border) / 0.6);
}

.brand-form-optional > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.75rem;
  padding: 0.85rem 0;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
}

.brand-form-optional > summary::-webkit-details-marker {
  display: none;
}

/* Chevron that turns when the area opens. */
.brand-form-optional > summary::after {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-25%) rotate(45deg);
  transition: transform 0.2s ease-out;
}

.brand-form-optional[open] > summary::after {
  transform: translateY(25%) rotate(-135deg);
}

.brand-form-optional > summary:hover {
  color: hsl(var(--primary));
}

.brand-form-optional[open] > summary {
  border-bottom: 1px solid hsl(var(--border) / 0.6);
}

.brand-form-optional > summary:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
}

.brand-form-optional-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .brand-form-optional > summary::after {
    transition: none;
  }
}

/* Repeatable social media links (002 research #9). */
.social-link-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.social-link-list:empty {
  display: none;
}

.social-link-row {
  position: relative;
}

/* The input spans the whole row; the remove button sits inside its right
   end, in the chip picker's chip-remove style. */
.social-link-row input {
  width: 100%;
  padding-right: 3rem;
}

.social-link-remove {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  min-height: 2rem;
  padding: 0;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1;
  color: hsl(var(--muted-foreground));
}

.social-link-remove:hover {
  color: hsl(var(--destructive));
  background: hsl(var(--border) / 0.5);
}

/* Pill-shaped "add" control in the badge style, with the brand accent. */
.social-links-add {
  align-self: flex-start;
  margin-top: 0.75rem;
  border-radius: 999px;
  border-style: dashed;
  border-color: hsl(var(--primary) / 0.6);
  color: hsl(var(--primary));
  font-size: 0.9rem;
  padding: 0.5rem 1.25rem;
}

.social-link-list:empty + .social-links-add {
  margin-top: 0;
}

.social-links-add::before {
  content: "+";
  font-size: 1.15rem;
  line-height: 1;
}

.social-links-add:hover {
  background: hsl(var(--primary) / 0.08);
  border-style: solid;
}

.social-links-add[aria-disabled="true"] {
  border-color: hsl(var(--border));
  color: hsl(var(--muted-foreground));
  background: transparent;
  border-style: dashed;
  cursor: not-allowed;
}

.social-links-hint {
  font-size: 0.8rem;
  margin: 0.4rem 0 0;
}

/* Brand page "Social Media links" section (002 research #10): a divided
   sub-section of the profile card, headed like the page's other sections. */
.brand-social {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid hsl(var(--border) / 0.6);
}

.brand-social-heading {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

.brand-social-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.brand-social-buttons .badge-link {
  gap: 0.4rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* Keyboard-focus visibility (research.md #22) — previously unstyled. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
}

/* Reduced-motion (research.md #22), mirroring tokens.css's existing
   prefers-color-scheme pattern. */
@media (prefers-reduced-motion: reduce) {
  .hover-lift {
    transition: none;
  }

  .hover-lift:hover {
    transform: none;
  }

  .carousel-track {
    scroll-behavior: auto;
  }
}

/* Keep the carousel's prev/next buttons inside the container's padding on
   narrow screens instead of overhanging it. */
@media (max-width: 47.99rem) {
  .carousel-nav.prev {
    left: 0.25rem;
  }

  .carousel-nav.next {
    right: 0.25rem;
  }
}

/* Email page after an anonymous submission (003). The card carries the
   padding for both the notice and the form, so the form drops its own. */
.notify-card {
  padding: 1.5rem;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.notify-card > p {
  margin: 0;
}

.notify-card .notify-form {
  padding: 0;
}
