/* ========================================
   ThisExists.fyi — Design Tokens
   ======================================== */
:root {
  --bg: #FAFAF7;
  --bg-card: #FFFFFF;
  --primary: #0D7377;
  --primary-dark: #095456;
  --accent: #F59E0B;
  --accent-dark: #D97706;
  --text: #1C1917;
  --text-light: #44403C;
  --muted: #78716C;
  --border: #E7E5E4;
  --success: #16A34A;
  --warning: #F59E0B;
  --error: #DC2626;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --max-width: 960px;
}

/* ========================================
   Reset + Base
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img { max-width: 100%; }

/* ========================================
   Typography
   ======================================== */
h1, h2, h3 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

.because-text {
  font-family: 'DM Serif Display', Georgia, serif;
  font-style: italic;
  font-size: 1.125rem;
  color: var(--text-light);
}

/* ========================================
   Layout
   ======================================== */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header__logo {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.35rem;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-header__logo:hover {
  text-decoration: none;
}

.site-header__logo-img {
  height: 32px;
  width: auto;
}

.site-header__logo span span {
  color: var(--primary);
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.site-nav a {
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 500;
}

.site-nav a:hover {
  color: var(--primary);
  text-decoration: none;
}

.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.hero__title {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.hero__subtitle {
  font-size: 1.2rem;
  color: var(--text-light);
  max-width: 560px;
  margin: 0 auto 2rem;
}

.hero__cta-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--primary-dark);
}

.btn--accent {
  background: var(--accent);
  color: var(--text);
}

.btn--accent:hover {
  background: var(--accent-dark);
}

.btn--outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn--outline:hover {
  background: var(--primary);
  color: #fff;
}

.btn--small {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
}

.btn--danger {
  background: var(--error);
  color: #fff;
}

.btn--danger:hover {
  background: #B91C1C;
}

/* ========================================
   Cards
   ======================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card__header {
  margin-bottom: 0.5rem;
}

.card__name {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.2rem;
  margin-bottom: 0.15rem;
}

.card__name a {
  color: var(--text);
}

.card__domain {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.card__because {
  font-style: italic;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  line-height: 1.5;
  flex: 1;
}

.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.card__date {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ========================================
   Grid
   ======================================== */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid--cards {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* ========================================
   Browse Toolbar
   ======================================== */
.browse-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.browse-toolbar__search {
  display: flex;
  gap: 0.5rem;
  max-width: 400px;
  flex: 1;
}

.browse-toolbar__search .form-input {
  flex: 1;
}

.browse-toolbar__sort {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.browse-toolbar__sort a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-light);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.browse-toolbar__sort a:hover {
  background: var(--border);
  text-decoration: none;
}

.browse-toolbar__sort a.active {
  background: var(--primary);
  color: #fff;
}

.browse-toolbar__sort a.active:hover {
  background: var(--primary-dark);
}

.browse-results-info {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.browse-results-info a {
  margin-left: 0.5rem;
}

/* ========================================
   Section
   ======================================== */
.section {
  margin-bottom: 3rem;
}

.section__title {
  margin-bottom: 1.25rem;
}

.section__subtitle {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* ========================================
   Forms
   ======================================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.form-group__hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.form-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.1);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.form-inline {
  display: flex;
  gap: 0.5rem;
}

.form-inline .form-input {
  flex: 1;
}

/* ========================================
   Word Counter
   ======================================== */
.word-counter {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.word-counter--ok { color: var(--success); }
.word-counter--warn { color: var(--warning); }
.word-counter--over { color: var(--error); }

/* ========================================
   Subscribe Form
   ======================================== */
.subscribe-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  margin: 2rem 0;
}

.subscribe-section h2 {
  margin-bottom: 0.5rem;
}

.subscribe-section p {
  color: var(--muted);
  margin-bottom: 1.25rem;
}

/* ========================================
   App Listing (single page)
   ======================================== */
.listing {
  max-width: 640px;
}

.listing__because {
  font-family: 'DM Serif Display', Georgia, serif;
  font-style: italic;
  font-size: 1.35rem;
  color: var(--text-light);
  margin: 1rem 0 1.5rem;
  line-height: 1.4;
}

.listing__link {
  margin-bottom: 2rem;
}

.listing__back {
  margin-top: 2rem;
  font-size: 0.9rem;
}

/* ========================================
   Admin
   ======================================== */
.admin-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.admin-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  flex: 1;
  min-width: 140px;
}

.admin-stat__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.admin-stat__label {
  font-size: 0.85rem;
  color: var(--muted);
}

.admin-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.admin-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-light);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.admin-nav a:hover {
  background: var(--border);
  text-decoration: none;
}

.admin-nav a.active {
  background: var(--primary);
  color: #fff;
}

.admin-nav__spacer {
  flex: 1;
}

.admin-nav a.admin-nav__logout {
  color: var(--error);
}

.admin-nav a.admin-nav__logout:hover {
  background: #FEF2F2;
}

.queue-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.queue-item--paid {
  border-left: 4px solid var(--accent);
}

.queue-item__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.queue-item__name {
  font-weight: 600;
  font-size: 1.05rem;
}

.queue-item__badge {
  background: var(--accent);
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.queue-item__because {
  font-style: italic;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.queue-item__meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  overflow-wrap: break-word;
  word-break: break-word;
}

.queue-item__actions {
  display: flex;
  gap: 0.5rem;
}

.queue-item__action-form {
  display: inline;
}

.admin-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ========================================
   Result Pages (success/confirmation)
   ======================================== */
.result-page {
  text-align: center;
  padding: 3rem 0 2rem;
  max-width: 480px;
  margin: 0 auto;
}
.result-page__icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.result-page__title {
  margin-bottom: 0.75rem;
}
.result-page__message {
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 2rem;
}
.result-page__actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ========================================
   Admin Table
   ======================================== */
.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-table tr:hover td {
  background: #FAFAF7;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge--success {
  background: #F0FDF4;
  color: #166534;
}

.badge--warning {
  background: #FFFBEB;
  color: #92400E;
}

.badge--muted {
  background: #F5F5F4;
  color: var(--muted);
}

.badge--error {
  background: #FEF2F2;
  color: #991B1B;
}

/* ========================================
   Alerts / Messages
   ======================================== */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.alert--success {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: #166534;
}

.alert--error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #991B1B;
}

.alert--info {
  background: #F0F9FF;
  border: 1px solid #BAE6FD;
  color: #0C4A6E;
}

/* ========================================
   Pagination
   ======================================== */
.pagination {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 2rem;
}

/* ========================================
   Priority / Payment
   ======================================== */
.priority-box {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.priority-box h2 {
  color: var(--accent-dark);
  margin-bottom: 0.5rem;
}

.priority-box .price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

.priority-box ul {
  margin: 1rem 0;
  padding-left: 1.25rem;
  color: var(--text-light);
}

.priority-box li {
  margin-bottom: 0.5rem;
}

/* ========================================
   Legal Pages
   ======================================== */
.legal {
  max-width: 640px;
}

.legal h2 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.legal p,
.legal li {
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.legal ul {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

/* ========================================
   Footer
   ======================================== */
.site-footer__links {
  margin-top: 0.5rem;
}

.site-footer__links a {
  color: var(--muted);
}

.site-footer__links a:hover {
  color: var(--primary);
}

/* ========================================
   Utilities
   ======================================== */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-small { font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 640px) {
  .hero__title { font-size: 2rem; }
  h1 { font-size: 2rem; }
  .site-header__inner { flex-direction: column; gap: 0.75rem; }
  .form-inline { flex-direction: column; }

  /* Browse toolbar */
  .browse-toolbar { flex-direction: column; align-items: stretch; }
  .browse-toolbar__search { max-width: none; }
  .browse-toolbar__sort { justify-content: center; }
  .card__footer { flex-direction: column; gap: 0.5rem; align-items: stretch; text-align: center; }
  .card__footer .btn { width: 100%; }

  /* Admin nav — horizontal scroll tab bar */
  .admin-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.25rem;
    padding-bottom: 0.75rem;
    scrollbar-width: none;
  }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav a { white-space: nowrap; font-size: 0.82rem; padding: 0.35rem 0.65rem; }
  .admin-nav__spacer { display: none; }

  /* Admin stats — 2-col grid */
  .admin-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .admin-stat { min-width: 0; padding: 0.75rem 1rem; }
  .admin-stat__value { font-size: 1.5rem; }

  /* Admin actions (dashboard / digest) */
  .admin-actions { flex-direction: column; }
  .admin-actions .btn { width: 100%; text-align: center; }

  /* Queue items */
  .queue-item { padding: 1rem; }
  .queue-item__meta { font-size: 0.75rem; }
  .queue-item__actions { flex-direction: column; }
  .queue-item__action-form { display: block; width: 100%; }
  .queue-item__actions .btn { width: 100%; }

  /* Admin table — compact + scrollable */
  .admin-table-wrap { margin: 0 -1.5rem; padding: 0 1.5rem; }
  .admin-table { font-size: 0.8rem; min-width: 480px; }
  .admin-table th,
  .admin-table td { padding: 0.5rem 0.5rem; }
}
