/* ── Fonts ── */
@font-face {
  font-family: 'HALTimezone';
  src: url('https://cdn.shopify.com/s/files/1/0853/9045/8914/files/HALTimezone-Regular.woff2?v=1778589895') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'HALTimezone';
  src: url('https://cdn.shopify.com/s/files/1/0853/9045/8914/files/HALTimezone-RegularItalic.woff2?v=1778589896') format('woff2');
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'OpenintoMono';
  src: url('https://cdn.shopify.com/s/files/1/0853/9045/8914/files/OpenintoMono-600Light.woff2?v=1777040832') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'OpenintoMono';
  src: url('https://cdn.shopify.com/s/files/1/0853/9045/8914/files/OpenintoMono-600Regular.woff2?v=1777040832') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

:root {
  --cream: #F5F0E8;
  --cream-dark: #EDE7D9;
  --ink: #1A1714;
  --ink-mid: #4A4540;
  --ink-light: #8A837A;
  --rule: rgba(26,23,20,0.18);
  --sidebar-w: 240px;

  /* Font families — matching O+A Shopify conventions */
  --custom-font-headings:   'HALTimezone', Georgia, serif;
  --custom-font-em:         'HALTimezone', Georgia, serif;  /* italic weight */
  --custom-font-p:          'OpenintoMono', 'Courier New', monospace;
  --captions-font-family:   'OpenintoMono', 'Courier New', monospace;

  /* Type scale */
  --font-size-h1:           2.2rem;
  --font-size-h2:           1.6rem;
  --font-size-p:            0.9rem;
  --font-size-p-mobile:     0.85rem;
  --font-size-captions:     0.72rem;
  --line-height-heading:    1.1;
  --line-height-paragraph:  1.65;
  --letter-spacing-heading: 0.02em;
  --letter-spacing-paragraph: 0;
  --captions-letter-spacing: 1.5px;
  --font-body-scale:        1;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

@media screen and (min-width: 1600px) {
  html { font-size: 18px; }
}

@media screen and (min-width: 2200px) {
  html { font-size: 20px; }
}

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--custom-font-p);
  font-weight: 300;
  min-height: 100vh;
}

/* ── Type hierarchy — matches Shopify global ── */
h1 {
  font-family: var(--custom-font-headings);
  font-size: var(--font-size-h1);
  font-weight: normal;
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-heading);
  -webkit-font-smoothing: antialiased;
}

h2 {
  font-family: var(--custom-font-headings);
  font-size: var(--font-size-h2);
  font-weight: normal;
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-heading);
  -webkit-font-smoothing: antialiased;
}

p, li {
  font-family: var(--custom-font-p);
  font-size: var(--font-size-p);
  font-weight: 300;
  line-height: var(--line-height-paragraph);
  letter-spacing: var(--letter-spacing-paragraph);
  -webkit-font-smoothing: antialiased;
}

em {
  font-family: var(--custom-font-em);
  font-style: italic;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  opacity: 0.6;
}

/* ── Header ── */
.site-header {
  border-bottom: 1px solid var(--ink);
  padding: 28px 40px 24px;
  position: sticky;
  top: 0;
  background: var(--cream);
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.site-title {
  font-family: var(--custom-font-headings);
  font-weight: normal;
  font-size: 22px;
  letter-spacing: 0.02em;
  line-height: 1;
}

.site-subtitle {
  font-family: var(--captions-font-family);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-top: 5px;
}

.search-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  padding: 5px 0;
  font-family: var(--captions-font-family);
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink);
  outline: none;
  width: 320px;
  transition: border-color 0.15s ease;
}

.search-input::placeholder {
  color: var(--ink-light);
}

.search-input:focus {
  border-bottom-color: var(--ink);
}

/* ── App layout ── */
.app-layout {
  display: flex;
  min-height: calc(100vh - 89px);
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--ink);
  padding: 28px 24px 40px;
  position: sticky;
  top: 89px;
  height: calc(100vh - 89px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--rule); }

.sidebar-count {
  font-family: var(--captions-font-family);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-light);
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0;
}

/* Filter groups */
.filter-group {
  border-bottom: 1px solid var(--rule);
  padding: 20px 0;
}

.filter-group:last-of-type {
  border-bottom: none;
}

.filter-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-family: var(--custom-font-headings);
  font-size: 0.8rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink);
  list-style: none;
  user-select: none;
  margin-bottom: 0;
}

.filter-heading::-webkit-details-marker { display: none; }

details[open] .filter-heading {
  margin-bottom: 16px;
}

.filter-toggle {
  font-size: 14px;
  line-height: 1;
  color: var(--ink-light);
}

.filter-toggle::before {
  content: '+';
  font-family: var(--custom-font-headings);
}

details[open] .filter-toggle::before {
  content: '−';
}

.filter-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s ease;
}

.filter-option:hover { opacity: 0.6; }
.filter-option.active { opacity: 1; }

.filter-check {
  width: 11px;
  height: 11px;
  border: 1px solid var(--ink);
  flex-shrink: 0;
  position: relative;
  transition: background 0.12s ease;
}

.filter-option.active .filter-check {
  background: var(--ink);
}

.filter-option.active .filter-check::before,
.filter-option.active .filter-check::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 1px;
  background: var(--cream);
}

.filter-option.active .filter-check::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.filter-option.active .filter-check::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.filter-option:not(.active) { opacity: 0.45; }

.hue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.filter-label {
  font-family: var(--captions-font-family);
  font-size: 0.8rem;
  letter-spacing: 1px;
  color: var(--ink);
  flex: 1;
}

.filter-count {
  font-family: var(--captions-font-family);
  font-size: 0.7rem;
  letter-spacing: 0;
  color: var(--ink-light);
}

.clear-btn {
  font-family: var(--captions-font-family);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-light);
  background: none;
  border: none;
  padding: 16px 0 0;
  cursor: pointer;
  text-decoration: underline;
  text-align: left;
  transition: color 0.15s ease;
}

.clear-btn:hover { color: var(--ink); }

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

.attribution {
  font-family: var(--captions-font-family);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-light);
  margin-bottom: 10px;
  line-height: 1.5;
}

.open-source-note {
  font-family: var(--captions-font-family);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--ink-light);
  line-height: 1.6;
  margin-bottom: 14px;
}

.donate-btn {
  display: inline-block;
  font-family: var(--captions-font-family);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 7px 14px;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.donate-btn:hover {
  background: var(--ink);
  color: var(--cream);
  opacity: 1;
}

/* ── Main content ── */
.main-content {
  flex: 1;
  padding: 28px 36px;
  min-width: 0;
}

.grid-meta {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.grid-count {
  font-family: var(--captions-font-family);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-light);
}

/* ── Color grid ── */
#color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  border-left: 1px solid var(--ink);
Border-top: 1px solid var(--ink);
  box-sizing: border-box;
}

/* ── Color card ── */
.color-card {
  position: relative;
  cursor: default;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  overflow: visible;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 3 / 2;
  display: block;
  cursor: pointer;
  transition: opacity 0.15s ease;
  box-sizing: border-box;
  padding: 6px;
  background-clip: content-box;
}

.color-swatch:hover {
  opacity: 0.85;
}

.color-card__info {
  padding: 7px 9px 9px;
  border-top: 1px solid var(--ink);
}

.color-card__name {
  font-family: var(--custom-font-em);
  font-style: italic;
  font-size: 0.9rem;
  letter-spacing: 0;
  line-height: 1.3;
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
}

.color-card__source {
  font-family: var(--custom-font-headings);
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink);
  display: block;
  opacity: 0.6;
}

/* ── Tooltip — triggers on swatch hover ── */
.color-card .color-tooltip {
  position: absolute;
  bottom: calc(100% - 52px + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  background: var(--ink);
  color: var(--cream);
  padding: 12px 14px 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  z-index: 100;
  font-family: var(--captions-font-family);
  font-size: 9.5px;
  line-height: 1.55;
  letter-spacing: 0.5px;
}

.color-swatch:hover ~ .color-tooltip {
  opacity: 1;
}

.color-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--ink);
}

.color-card.flip-tooltip .color-tooltip {
  bottom: auto;
  top: calc(100% - 52px + 10px);
}

.color-card.flip-tooltip .color-tooltip::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--ink);
}

/* ── Neutrals divider ── */
.color-divider {
  grid-column: 1 / -1;
  padding: 24px 0 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.color-divider::before,
.color-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.color-divider span {
  font-family: var(--captions-font-family);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-light);
  white-space: nowrap;
}

/* ── Empty state ── */
.empty-state {
  grid-column: 1 / -1;
  padding: 80px 0;
  text-align: center;
  font-family: var(--captions-font-family);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-light);
}

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: var(--cream);
  padding: 9px 18px;
  font-family: var(--captions-font-family);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0;
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 999;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Mobile ── */
@media (max-width: 900px) {
  .site-header {
    padding: 20px 20px 16px;
    position: static;
  }

  .header-inner {
    flex-direction: column;
    gap: 12px;
  }

  .search-input {
    width: 100%;
  }

  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--ink);
    padding: 20px;
  }

  .main-content {
    padding: 20px;
  }

  #color-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 500px) {
  #color-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
