:root {
  --text: #161616;
  --text-muted: #767676;
  --bg: #ffffff;
  --border: #e2e2e2;
  --border-strong: #161616;
  --max-width: 1000px;
  --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.25;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

a { color: var(--text); }
a:hover { color: var(--text-muted); }

/* ---- Header ---- */
.site-header {
  border-bottom: 1px solid var(--border);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
}
.brand {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--text);
}
.main-nav a,
.main-nav-toggle,
.main-nav-text {
  text-decoration: none;
  color: var(--text);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.main-nav a:hover, .main-nav-toggle:hover { color: var(--text-muted); }

.main-nav-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 22px;
  margin: 0;
  padding: 0;
}
.main-nav-item { position: relative; }
.main-nav-toggle {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-sans);
}
.main-nav-item.has-children > .main-nav-toggle::after {
  content: "";
  display: inline-block;
  margin-left: 6px;
  border: 3px solid transparent;
  border-top-color: currentColor;
  transform: translateY(2px);
}
.main-nav-submenu {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: var(--bg);
  border: 1px solid var(--border);
  z-index: 20;
  display: none;
}
/* Hover for mouse users; .is-open is set by main.js for click and keyboard. */
.main-nav-item.has-children:hover > .main-nav-submenu,
.main-nav-item.has-children:focus-within > .main-nav-submenu,
.main-nav-item.is-open > .main-nav-submenu { display: block; }
.main-nav-submenu a {
  display: block;
  padding: 7px 16px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.85rem;
  white-space: nowrap;
}
.main-nav-submenu a:hover { background: var(--border); color: var(--text); }

.main-content { padding: 36px 24px 60px; }

/* ---- Hero ---- */
.hero {
  text-align: center;
  padding: 20px 0 24px;
}
.hero h1 { font-size: 2.2rem; margin: 0 0 12px; }
.hero p {
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 22px;
}

.button {
  display: inline-block;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  padding: 10px 24px;
  border: 1px solid var(--border-strong);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: background 0.15s ease, color 0.15s ease;
}
.button:hover { background: var(--border-strong); color: var(--bg); }

/* ---- Tag strip ---- */
.tag-strip { margin: 36px 0; }
.tag-strip h2, .hobby-grid-section h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: var(--font-sans);
  color: var(--text-muted);
  margin-bottom: 4px;
}
.tag-strip h2 + h2,
.tag-strip .tag-list + h2 { margin-top: 26px; }

/* Quick-fact axes as a plain text directory rather than pills — six
   categories of boxes overwhelmed the homepage. */
.tag-browse {
  display: grid;
  /* 132px min fits all six quick-fact axes on one row at desktop width,
     so none of them orphans onto a row of its own. */
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 18px 16px;
  align-items: start;
  margin-top: 12px;
}
.tag-browse-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 5px;
}
.tag-browse-list { list-style: none; padding: 0; margin: 0; }
.tag-browse-list li { line-height: 1.5; }
.tag-browse-list a {
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--text);
}
.tag-browse-list a:hover { text-decoration: underline; }
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 6px 0 14px;
}
.tag-list a {
  display: inline-block;
  padding: 5px 13px;
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: 0.85rem;
}
.tag-list a:hover { border-color: var(--border-strong); color: var(--text); }
.tag-description { color: var(--text-muted); }

/* ---- Tag category grouping (public) ---- */
.tag-group-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 12px 0 0;
}
.tag-group-pills { margin: 5px 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }

/* Quick-facts block on hobby pages: one column per tag category so six
   categories read as a compact grid instead of six full-width rows. */
.at-a-glance {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 4px 16px;
}
.at-a-glance .tag-group-label { margin-top: 0; }
.at-a-glance .tag-group-pills { margin-bottom: 8px; }
.tag-pill {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--text);
}
.tag-pill:hover { border-color: var(--border-strong); }

/* ---- Hobby grid ---- */
.hobby-grid-section { margin-top: 36px; }
.hobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 26px 24px;
  margin-top: 16px;
}
.hobby-card { display: block; }
/* The card's link is inside the card rather than being it, so the photo
   credit's own links can sit outside it (anchors cannot nest). */
.hobby-card-link {
  display: block;
  text-decoration: none;
  color: var(--text);
}
.hobby-card-image {
  aspect-ratio: 16/9;
  background: #f4f4f4;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.hobby-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hobby-card-image-placeholder { width: 100%; height: 100%; background: #f4f4f4; }
.hobby-card-body h3 { margin: 0 0 4px; font-size: 1.1rem; }
.hobby-card-link:hover .hobby-card-body h3 { text-decoration: underline; }
.hobby-card-body p { margin: 0 0 7px; color: var(--text-muted); font-size: 0.9rem; }
.hobby-card-credit {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin: 6px 0 0;
}
.hobby-card-credit a { color: var(--text-muted); text-decoration: none; }
.hobby-card-credit a:hover { text-decoration: underline; }
.hobby-card-tags { display: block; }
.hobby-card-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.hobby-card-tag:not(:last-child)::after { content: "\00b7"; margin: 0 6px; }

/* ---- Filter form ---- */
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 22px;
}
.filter-form select, .filter-form input[type="text"] {
  padding: 8px 11px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}
.filter-form button {
  padding: 8px 18px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  cursor: pointer;
}
.filter-form button:hover { background: var(--border-strong); color: var(--bg); }

/* ---- Hobby detail ---- */
.hobby-detail-header { margin-bottom: 16px; }
.hobby-detail-tags { margin: 0 0 8px; }
.hobby-detail-tag {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-decoration: none;
}
.hobby-detail-tag:hover { color: var(--text); }
.hobby-detail-tag:not(:last-child)::after { content: "\00b7"; margin: 0 8px; color: var(--border-strong); }
.hobby-detail-header h1 { margin: 2px 0; font-size: 2rem; }
.hobby-detail-lede { color: var(--text-muted); font-size: 1.02rem; margin: 6px 0 0; }
.hobby-detail-hero-figure { margin: 0 0 20px; }
.hobby-detail-hero {
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  display: block;
}
.hobby-detail-hero-credit {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 5px;
  text-align: right;
}
.hobby-detail-hero-credit a { color: var(--text-muted); text-decoration: none; }
.hobby-detail-hero-credit a:hover { text-decoration: underline; }
.hobby-detail-section { margin: 30px 0; }
.hobby-detail-section h2,
.link-section h2 {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  font-weight: 400;
  margin-bottom: 10px;
}
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 20px; }
.prose li { margin-bottom: 4px; }
.prose > :last-child { margin-bottom: 0; }

/* ---- Link lists ---- */
.link-section { margin: 30px 0; }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.link-list a { font-weight: 600; text-decoration: none; }
.link-list a:hover { text-decoration: underline; }
.link-list p { margin: 2px 0 0; color: var(--text-muted); font-size: 0.9rem; }

/* ---- Affiliate items ---- */
.affiliate-disclosure { font-size: 0.85rem; color: var(--text-muted); }
.affiliate-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 22px;
  margin-top: 12px;
}
.affiliate-item-card {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.affiliate-item-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; margin-bottom: 9px; background: #f4f4f4; }
.affiliate-item-card h3 { margin: 0 0 4px; font-size: 1rem; font-family: var(--font-sans); }
.affiliate-item-card p { color: var(--text-muted); font-size: 0.88rem; margin: 0 0 10px; }
.affiliate-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.affiliate-button {
  display: inline-block;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}
.affiliate-button:hover { background: var(--border-strong); color: var(--bg); }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 20px;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.site-footer-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 22px 24px;
  align-items: start;
  margin-bottom: 24px;
}
.site-footer-heading {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text);
  margin: 0 0 7px;
}
.site-footer-heading a { text-decoration: none; }
.site-footer-heading a:hover { text-decoration: underline; }
.site-footer-links { list-style: none; padding: 0; margin: 0; }
.site-footer-links li { line-height: 1.6; }
.site-footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}
.site-footer-links a:hover { color: var(--text); text-decoration: underline; }
.site-footer-legal { margin: 0; }
.site-footer-columns + .site-footer-legal {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

/* ---- Content pages ---- */
.page-detail h1 { font-size: 2rem; margin: 0 0 14px; }

/* ---- Flash messages ---- */
.flash {
  border: 1px solid var(--border-strong);
  padding: 11px 15px;
  margin-bottom: 18px;
  font-size: 0.92rem;
}
.flash-error { border-width: 2px; }
.flash-error::before { content: "Error — "; font-weight: 600; }

/* ---- Auth ---- */
.auth-page { max-width: 380px; padding-top: 40px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.auth-form input {
  padding: 11px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-sans);
}
.auth-form input:focus, .filter-form select:focus, .filter-form input:focus {
  outline: none;
  border-color: var(--border-strong);
}
.auth-form button {
  padding: 11px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  cursor: pointer;
}
.auth-form button:hover { background: var(--border-strong); color: var(--bg); }

/*
 * Dark mode is a global site setting controlled from the admin panel
 * (Site Settings), not the visitor's OS/browser preference — hence an
 * attribute selector here rather than @media (prefers-color-scheme: dark).
 */
:root[data-theme="dark"] {
  --text: #ededed;
  --text-muted: #9a9a9a;
  --bg: #0d0d0d;
  --border: #2b2b2b;
  --border-strong: #ededed;
}
:root[data-theme="dark"] .hobby-card-image,
:root[data-theme="dark"] .hobby-card-image-placeholder,
:root[data-theme="dark"] .affiliate-item-card img { background: #191919; }

@media (max-width: 640px) {
  /* The brand plus a real nav no longer fits on one phone-width row, so
     the header stacks and the nav wraps beneath it. */
  .site-header-inner {
    padding: 14px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .brand { font-size: 1.25rem; }
  .main-nav { width: 100%; }
  .main-nav-list { flex-wrap: wrap; gap: 8px 18px; }

  /* Absolute dropdowns overflow a narrow viewport; open them inline
     instead, indented under their parent. */
  .main-nav-item.has-children { width: 100%; }
  .main-nav-submenu {
    position: static;
    border: 0;
    padding: 4px 0 0;
    min-width: 0;
  }
  .main-nav-item.has-children:hover > .main-nav-submenu { display: none; }
  .main-nav-item.is-open > .main-nav-submenu { display: block; }
  .main-nav-submenu a { padding: 5px 0 5px 16px; }
  .main-nav-submenu a:hover { background: none; }
  .main-content { padding: 26px 20px 48px; }
  .hero { padding: 16px 0 26px; }
  .hero h1 { font-size: 1.8rem; }
  .hobby-detail-section, .link-section { margin: 24px 0; }

  /* Sixteen bordered pills stack into seven tall rows on a phone, so the
     category list drops its boxes and becomes a two-column text list. */
  .tag-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 14px;
  }
  .tag-list a {
    border: none;
    padding: 3px 0;
    font-size: 0.9rem;
  }
  .tag-list a:hover { text-decoration: underline; }
}
