/* Basic reset-ish */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  font-size: 18px; /* default is ~16px; 18px is a nice bump */
}

body {
  font-size: 1rem; /* keep rem-based scaling clean */
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #222;
  background-color: #f8fafc;
  line-height: 1.6;
}

/* Layout helpers */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header & nav */
.site-header {
  background: #0f172a;
  color: #e5e7eb;
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.logo-mark {
  display: inline-flex;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 2px solid #e5e7eb;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

/* Make header title text match nav links on all pages */
.logo-text,
.main-nav a,
.main-nav .nav-button {
  font-size: 0.95rem;
  font-weight: 600;
}


.main-nav a {
  color: #e5e7eb;
  text-decoration: none;
  margin-left: 1rem;
  font-size: 0.95rem;
}

.main-nav a:hover {
  text-decoration: underline;
}

/* Hero */
.hero {
  padding: 3.5rem 0 2.5rem;
  background: linear-gradient(135deg, #0f172a, #1d283a);
  color: #e5e7eb;
}

.hero-inner {
  max-width: 720px;
}

.hero h1 {
  font-size: 2.4rem;
  margin-bottom: 0.75rem;
}

.hero p {
  margin-bottom: 0.75rem;
}

.hero-note {
  font-size: 0.95rem;
  opacity: 0.9;
}

/* Sections */
.section {
  padding: 2.5rem 0;
  background-color: #f8fafc;
}

.section-alt {
  background-color: #ffffff;
}

.section h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.6rem;
}

/* Generic lists */
ul {
  padding-left: 1.25rem;
}

#item-list,
#meta-tags-list,
#length-tag-list-form,
#length-tag-list-agg,
#review-list {
  list-style: none;
  padding-left: 0;
  margin: 0.5rem 0;
}

#item-list li,
#meta-tags-list li,
#length-tag-list-form li,
#length-tag-list-agg li,
#review-list li {
  margin-bottom: 0.35rem;
}

/* Item list links on index page */
#item-list a {
  text-decoration: none;
}

#item-list a:hover {
  text-decoration: underline;
}

/* Cards (used on home if needed) */
.card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.card {
  border-radius: 0.75rem;
  padding: 1.25rem;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

/* Forms */
form label {
  font-weight: 500;
}

input[type="number"],
input[type="text"],
textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.35rem;
  border: 1px solid #d1d5db;
  margin-top: 0.25rem;
}

input[type="number"],
input[type="text"] {
  max-width: 260px;
}

textarea {
  width: 100%;
  max-width: 100%;
  resize: vertical;
}

button {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.35rem 0.75rem;
  border-radius: 0.4rem;
  border: 1px solid #2563eb;
  background-color: #2563eb;
  color: white;
  cursor: pointer;
}

button:hover {
  background-color: #1d4ed8;
}

/* Footer */
.site-footer {
  border-top: 1px solid #e5e7eb;
  padding: 1rem 0;
  background-color: #f9fafb;
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
}

.footer-note {
  color: #6b7280;
}

/* Links */
a {
  color: #2563eb;
}

a:hover {
  text-decoration: underline;
}

/* Responsive tweaks */
@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .main-nav a {
    margin-left: 0;
    margin-right: 1rem;
  }

  .hero h1 {
    font-size: 2rem;
  }
}

/* Length bars and segments */
.length-bar {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(to right, #e5e7eb, #d1d5db);
  cursor: pointer;
  margin: 0.5rem 0;
  /* allow tooltip to show outside */
  overflow: visible;
}

.length-tag-segment {
  position: absolute;
  top: 0;
  height: 100%;
  background-color: rgba(37, 99, 235, 0.4); /* blue-ish band */
  border-left: 2px solid #2563eb;
  border-right: 2px solid #2563eb;
}

/* Tooltip that appears when hovering over a length bar */
.length-bar-tooltip {
  position: absolute;
  top: 0; /* anchor to top of bar */
  background: #111827;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  pointer-events: none;
  transform: translate(-50%, -120%);
  white-space: nowrap;
  z-index: 20;
  display: none;
}

/* Highlight effect */
.length-bar:hover {
  outline: 2px solid #2563eb;
}

.length-bar-hint {
  font-size: 0.9rem;
  color: #6b7280;
}
.length-bar-scale {
  position: relative;
  max-width: 600px;
  height: 1rem;
  margin-top: 0.1rem;
  font-size: 0.8rem;
  color: #6b7280;
}

/* Base style for all tick labels */
.length-bar-scale span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* Highlight active thumbs */
.thumb-btn.active {
  font-weight: bold;
  outline: 1px solid #ccc;
}

.item-list-entry {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.item-list-entry a {
  font-weight: 600;
}

.item-tag-summary {
  font-size: 0.85rem;
  color: #555;
  opacity: 0.9;
}

/* Alpha letter bar: two neat rows */
.alpha-letter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.alpha-letter-btn {
  flex: 0 0 calc(100% / 14 - 0.25rem); /* 14 buttons per row -> 2 rows for 28 */
  padding: 0.4rem 0.3rem;
  border: 1px solid #ddd;
  border-radius: 999px;
  background: #f9fafb;
  font-size: 0.85rem;
  cursor: pointer;
}

.alpha-letter-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

/* Range controls + info */
.alpha-range-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.alpha-range-controls label {
  font-size: 0.9rem;
}

.alpha-range-controls input {
  width: 4rem;
}

.alpha-range-hint {
  flex-basis: 100%;
  font-size: 0.8rem;
  color: #6b7280;
  margin: 0.25rem 0 0;
}

.alpha-range-info {
  font-size: 0.85rem;
  color: #374151;
  margin-top: 0.5rem;
}

/* Reuse your existing styles if you still have them */
.item-list-entry {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.item-main a {
  font-weight: 600;
}

.item-tag-summary {
  font-size: 0.85rem;
  color: #555;
  opacity: 0.9;
}

/* Homepage analytics sections */
.home-section {
  margin-top: 2rem;
}

.section-subtitle {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Grid for top items */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

/* Vertical list for recent reviews */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item-card,
.review-card {
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  background: #fff;
}

.item-card-header,
.review-card-header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.35rem;
}

.item-name {
  text-decoration: none;
  color: inherit;
  font-weight: 600;
}

.item-name:hover {
  text-decoration: underline;
}

a.item-name:link,
a.item-name:visited,
a.item-name:active,
a.item-name:hover {
  color: inherit;
  text-decoration: none;
}

a.item-name:hover {
  text-decoration: underline;
}

.item-details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem 1rem;
}

.item-details-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  column-gap: 1rem;
  row-gap: 0.25rem;
  font-size: 0.9rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.item-details-row:last-child {
  border-bottom: none;
}

.item-details-label {
  font-weight: 600;
  opacity: 0.85;
}

.item-details-value {
  opacity: 0.95;
}

.rating-pill {
  font-size: 0.85rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.tag-row {
  margin-top: 0.35rem;
  font-size: 0.8rem;
}

.tag-label {
  font-weight: 600;
  margin-right: 0.25rem;
}

.tag-list {
  font-size: 0.8rem;
  opacity: 0.9;
}

.review-text {
  margin-top: 0.4rem;
  font-size: 0.9rem;
}

.review-meta {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Generic button used in nav and elsewhere */
.nav-button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

/* Header-specific layout for nav buttons */
.main-nav .nav-button {
  margin-left: 1rem;     /* same spacing as .main-nav a */
}

/* First nav element (Back) shouldn't be indented */
.main-nav .nav-button:first-child {
  margin-left: 0;
}

/* Hover underline for both links and buttons in the header */
.main-nav .nav-button:hover,
.main-nav a:hover {
  text-decoration: underline;
}

.main-nav .nav-button {
  background: none;
  border: none;
  color: inherit;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.main-nav .nav-button:hover {
  text-decoration: underline;
}

/* If you want extra spacing on feature chips, in addition to item-page */
.facet-chip {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  margin: 0.1rem 0.15rem 0.1rem 0;
  border-radius: 999px;
  background: #222;
  border: 1px solid #444;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.facet-chip:hover {
  background: #333;
  border-color: #666;
}

.auth-btn {
  background-color: #1976d2;
  color: white;
  border: none;
  padding: 0.45rem 0.8rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9rem;
}

.auth-btn:hover {
  background-color: #0f5aa4;
}

.login-status {
  font-weight: bold;
  color: #2e7d32; /* green */
  margin-left: 1rem;
  font-size: 0.95rem;
}

/* ======================================
   Tag / facet link visual behavior
   ====================================== */

/* General tag links (item pages, feature pages, tag page, etc.) */
a.tag-link,
a.tag-link:link,
a.tag-link:visited,
a.tag-link:active {
  color: inherit !important;        /* no blue */
  text-decoration: none !important; /* no underline */
  font-weight: 600;                 /* bold */
  cursor: pointer;
}

a.tag-link:hover {
  text-decoration: underline !important;  /* only on hover */
}

/* Feature-page meta-tag pills:
   keep the pill background on <li>,
   but make the inner <a> look like simple bold text. */
.feature-meta-tag-list li a.tag-link,
.feature-length-list li a.tag-link {
  color: inherit !important;
  text-decoration: none !important;
  font-weight: 600;
}

.feature-meta-tag-list li a.tag-link:hover,
.feature-length-list li a.tag-link:hover {
  text-decoration: underline !important;
}

/* Keep home / browse summary tag text the same weight, just add hover underline */
.item-tag-summary a.tag-link,
.tag-list a.tag-link {
  font-weight: inherit;
}

/* ======================================
   Review comments styling
   ====================================== */

.review-comments {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.85rem;
}

/* Header row that contains the Show/Hide button + count */
.review-comments-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

/* Make the Show/Hide button in the header look normal */
.review-comments-header button {
  margin: 0;
}

/* The list of individual comments */
.review-comments-list {
  list-style: none;
  padding-left: 0;
  margin: 0.25rem 0 0.5rem;
}

.review-comments-list li {
  padding: 0.15rem 0.2rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.review-comments-list li:last-child {
  border-bottom: none;
}

/* Comment form below the list */
.review-comment-form {
  margin-top: 0.25rem;
}

.review-comment-form textarea {
  font-size: 0.85rem;
  min-height: 3rem;
}

.review-comment-form button {
  margin-top: 0.25rem;
}

/* Slightly dim the hint text inside the comment form */
.review-comment-form .length-bar-hint {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: #6b7280;
}

.clickable-username {
  cursor: pointer;
  text-decoration: none;   /* no underline normally */
}

.clickable-username:hover {
  text-decoration: underline; /* underline only on hover */
}

.auth-section { margin-top: 1rem; }
.auth-header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.auth-toggle-btn,
.auth-login-btn,
.auth-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid #1d4ed8;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
}
.auth-toggle-btn:hover,
.auth-login-btn:hover,
.auth-submit-btn:hover {
  background: #1d4ed8;
}
.auth-panel {
  margin-top: 0.25rem;
  max-width: 420px;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #f9fafb;
}
.auth-field-row {
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
}
.auth-field-row label {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  font-weight: 500;
}
.auth-field-row input {
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 0.95rem;
}
.auth-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.auth-status { font-size: 0.85rem; }
.auth-error { color: #b00020; }
.auth-success { color: #0b7a0b; }
.auth-pending { color: #555; }
.hidden { display: none; }

#item-search-results li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

#item-search-results a {
  font-weight: 600;
}

#item-search-results .item-tag-summary {
  font-size: 0.8rem;
  color: #555;
}

/* Exact positions along the bar */
.length-bar-scale span:nth-child(1) { left: 0%; }
.length-bar-scale span:nth-child(2) { left: 20%; }
.length-bar-scale span:nth-child(3) { left: 40%; }
.length-bar-scale span:nth-child(4) { left: 60%; }
.length-bar-scale span:nth-child(5) { left: 80%; }
.length-bar-scale span:nth-child(6) { left: 100%; }
