/* Styles for the Copic Sketch storage system blog post.
 *
 * Scoped under .copic-storage to avoid conflicts with the blog's own
 * styles. Variables bridge the storage page's token names to the blog's
 * --mx-* design tokens so JS-generated markup (which references --border,
 * --text, etc.) works without modification. */

/* The overlay elements (tooltip, modal, radar popup) are injected via
 * raw_after_content, outside the .copic-storage div — they need the same
 * variable bridge, hence the extra selectors. */
.copic-storage,
#map-modal,
#radar-pop,
#hex-tooltip {
  --bg: var(--mx-background);
  --surface: var(--mx-surface-card);
  --text: var(--mx-text);
  --muted: var(--mx-text-muted);
  --border: var(--mx-border);
  --accent: var(--mx-primary);
  --empty: var(--mx-surface-muted);
  --case-line: var(--mx-border-strong);
}

/* Section containers */

.copic-section {
  margin-bottom: 2.5rem;
}

/* Hex pot panel */

.copic-storage .hex-wrap {
  overflow: auto;
  padding: 20px 0;
}

.copic-storage .hex-grid {
  position: relative;
}

.copic-storage .hex-pot {
  position: absolute;
  width: 104px;
  height: 90.067px;
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: transform 0.1s;
}

.copic-storage .hex-pot-inner {
  position: absolute;
  inset: 3px;
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #e0e0e0;
}

.copic-storage .hex-pot:hover {
  transform: scale(1.08);
  z-index: 10;
}

.copic-storage .hex-pot-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--mx-text);
  white-space: nowrap;
  margin-bottom: 2px;
}

.copic-storage .hex-pot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  max-width: 70px;
}

.copic-storage .hex-pot-chip {
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  cursor: default;
}

.copic-storage .hex-pot-count {
  font-size: 12px;
  color: var(--mx-text-muted);
  margin-top: 2px;
}

/* Tooltip (fixed, outside article flow) */

#hex-tooltip {
  display: none;
  position: fixed;
  background: #1a1a1e;
  color: #f0f0ee;
  font-size: 0.95rem;
  padding: 8px 14px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
  font-family: var(--mx-font-monospace);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Category reference cards */

.copic-storage .cat-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 18px;
  align-items: start;
  padding: 18px 0;
}

.copic-storage .cat-card + .cat-card {
  border-top: 1px solid var(--mx-border);
}

.copic-storage .cat-text {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.copic-storage .cat-title {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.copic-storage .cat-count {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--mx-text-muted);
}

.copic-storage .cat-desc {
  font-size: 0.85rem;
  color: var(--mx-text-muted);
  line-height: 1.5;
  margin-top: 4px;
}

.copic-storage .cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.copic-storage .cat-chip {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.copic-storage .cat-chip span {
  font-size: 14px;
  font-family: var(--mx-font-monospace);
  background: rgba(255, 255, 255, 0.82);
  color: #111;
  border-radius: 3px;
  padding: 1px 4px;
  margin-bottom: 4px;
}

/* a*b opponent-plane mini maps — overflow hidden so axis lines clip */

.copic-storage .cat-map,
#map-modal .cat-map {
  background: var(--mx-background);
  border: 1px solid var(--mx-border);
  border-radius: 8px;
}

.copic-storage .cat-map {
  cursor: zoom-in;
  transition: border-color 0.1s;
}

.copic-storage .cat-map:hover {
  border-color: var(--mx-primary);
}

/* Map zoom modal */

#map-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 300;
  align-items: center;
  justify-content: center;
}

#map-modal.open {
  display: flex;
}

/* min-content: the square map sets the box width; header text wraps to it */
#map-modal .box {
  width: min-content;
  background: var(--mx-background);
  border: 1px solid var(--mx-border);
  border-radius: 12px;
  padding: 20px;
  cursor: default;
}

#map-modal .box h3 {
  margin: 0 0 4px;
  font-size: 1.4rem;
}

#map-modal .box .sub {
  font-size: 0.95rem;
  color: var(--mx-text-muted);
  margin-bottom: 12px;
}

#map-modal .box svg {
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* Radar popup (click-to-identify overlay on modal map) */

#radar-pop {
  display: none;
  position: fixed;
  z-index: 320;
  background: var(--mx-surface-card);
  border: 1px solid var(--mx-border);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  max-width: 300px;
}

#radar-pop .row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  font-size: 0.95rem;
}

#radar-pop .sw {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  flex: none;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

#radar-pop .cd {
  font-family: var(--mx-font-monospace);
  font-weight: 600;
  flex: none;
}

/* Naming vocabulary details toggle */

.copic-storage details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--mx-text);
}

.copic-storage details div {
  line-height: 1.6;
}

/* ── OkLCH picker widget ─────────────────────────────────── *
 * Hue wheel + swatch chart, injected into #oklch-picker
 * (outside .copic-storage — uses --mx-* tokens directly).
 * The chart is a 16-column CSS grid spanning the full text
 * column: lightness across, chroma increasing downward. */

#oklch-picker {
  margin: 2rem 0;
}

#oklch-picker .oklch-figure {
  margin: 0;
}

/* Panel: same visual treatment as the blog's figure images — rounded,
 * shadowed block — with the caption as its own block below. */
#oklch-picker .oklch-panel {
  border: 1px solid var(--mx-border);
  border-radius: 0.5rem;
  box-shadow: var(--mx-shadow-card);
  padding: 1.75rem;
  background: var(--mx-surface-card);
}

/* Hue wheel */

#oklch-picker canvas.oklch-wheel {
  display: block;
  width: 360px;
  height: 360px;
  margin: 0 auto 1.75rem;
  cursor: pointer;
  touch-action: none;
  border-radius: 50%;
}

#oklch-picker canvas.oklch-wheel:focus-visible {
  outline: 3px solid var(--mx-primary);
  outline-offset: 4px;
}

/* Swatch chart — square cells fill the column width */

#oklch-picker .oklch-chart {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 3px;
  margin-top: 0.5rem;
}

#oklch-picker .oklch-figure figcaption {
  margin-top: 0.75rem;
}

/* margin: 0 overrides the site framework's default button margins */
#oklch-picker .oklch-cell {
  aspect-ratio: 1;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 3px;
  cursor: pointer;
}

#oklch-picker button.oklch-cell:hover {
  outline: 2px solid var(--mx-border-strong);
  outline-offset: 1px;
}

#oklch-picker button.oklch-cell:focus-visible {
  outline: 2px solid var(--mx-primary);
  outline-offset: 1px;
}

#oklch-picker .oklch-cell.selected {
  outline: 2px solid var(--mx-contrast);
  outline-offset: 1px;
}

#oklch-picker .oklch-cell.oklch-empty {
  visibility: hidden;
}

/* A selected empty cell stays visible: the blank IS the point */
#oklch-picker .oklch-cell.oklch-empty.selected {
  visibility: visible;
  background: transparent;
  border: 1px dashed var(--mx-border-strong);
}

@media (width < 420px) {
  #oklch-picker canvas.oklch-wheel {
    width: 300px;
    height: 300px;
  }
}
