/**
 * Site-Specific Custom Styles (Layer 5)
 * =====================================
 * Site 012: Graph Paper
 *
 * CSS Cascade Layers:
 * 1. main.css           -> Platform base (header, footer, buttons)
 * 2. base-structure.css -> Page layout (grids, sections, cards)
 * 3. tokens.css         -> Design tokens (blueprint blue palette)
 * 4. skin.css           -> Theme skin (blueprint aesthetic)
 * 5. site.css           -> Site-specific (THIS FILE)
 *
 * Graph paper site: interaction component styles + print polish.
 * All colors reference tokens.css — zero hardcoded hex.
 */

/* ── Sheet Preview Enhancements ── */

.sheet-preview {
  aspect-ratio: auto;
  max-width: 100%;
  overflow: auto;
}

/* Grid SVG: crisp lines at all DPI */
.sheet-grid-svg,
.sheet-dots-svg {
  shape-rendering: crispEdges;
}

/* Print / Download buttons: center-stage prominence */
.btn-print,
.btn-download {
  font-size: 1.05rem;
  padding: 0.7rem 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* ── Page Size Badge ── */
.page-size-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--site-primary);
  background: var(--site-primary-light);
  border: 1px solid var(--site-primary-border);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.55rem;
  font-family: var(--font-heading);
}

/* ── Orientation Label ── */
.orientation-label {
  font-size: 0.8rem;
  color: var(--site-text-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ════════════════════════════════════════════════
   GRAPH PAPER INTERACTION COMPONENTS
   Blueprint Blue token system
   ════════════════════════════════════════════════ */

/* ── Parameter Panel ── */
.gp-param-panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  padding: 1rem;
  background: var(--site-primary-light);
  border: 1px solid var(--site-primary-border);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
}

.gp-param-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.gp-param-group__label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--site-primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-heading);
}

.gp-param-group__input {
  padding: 0.4rem 0.7rem;
  font-size: 0.9rem;
  border: 1.5px solid var(--site-border-dark);
  border-radius: var(--radius-sm);
  background: var(--site-surface);
  color: var(--site-text);
  min-height: 44px;
  font-family: var(--font-body);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.gp-param-group__input:focus {
  border-color: var(--site-primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--site-primary-border);
}

/* ── Grid Type Selector ── */
.gp-type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.gp-type-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1.5px solid var(--site-border);
  border-radius: var(--radius-card);
  background: var(--site-surface);
  color: var(--site-text);
  cursor: pointer;
  min-height: 44px;
  min-width: 80px;
  text-align: center;
  font-family: var(--font-heading);
  transition:
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.gp-type-btn:hover {
  border-color: var(--site-primary);
  background: var(--site-primary-light);
}

.gp-type-btn.is-active {
  border-color: var(--site-primary);
  background: var(--site-primary-light);
  color: var(--site-primary-dark);
  box-shadow: 0 0 0 2px var(--site-primary-border);
}

.gp-type-btn__icon { font-size: 1.25rem; }

/* ── Live Preview Container ── */
.gp-preview {
  position: relative;
  border: 1.5px solid var(--site-primary-border);
  border-radius: var(--radius-card);
  background: var(--site-surface);
  padding: 1rem;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.gp-preview__updating {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.75rem;
  color: var(--site-text-muted);
  padding: 0.2rem 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--site-border);
  border-radius: var(--radius-sm);
}

/* ── Recent Presets ── */
.gp-presets {
  padding: 0.75rem;
  background: var(--site-primary-light);
  border: 1px solid var(--site-primary-border);
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
}

.gp-presets__title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--site-primary-dark);
  margin-bottom: 0.5rem;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gp-presets__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.gp-preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--site-primary-border);
  border-radius: var(--radius-pill);
  background: var(--site-surface);
  color: var(--site-primary);
  cursor: pointer;
  min-height: 32px;
  font-family: var(--font-heading);
  transition:
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}

.gp-preset-chip:hover {
  border-color: var(--site-primary);
  background: var(--site-primary-light);
}

.gp-preset-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  color: var(--site-text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  transition: background var(--dur-fast) var(--ease);
}

.gp-preset-chip__remove:hover {
  background: var(--site-primary-border);
  color: var(--site-primary-dark);
}

/* ── Download Flow ── */
.gp-download-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

.gp-next-suggest {
  padding: 0.5rem 0.875rem;
  background: var(--site-primary-light);
  border: 1px solid var(--site-primary-border);
  border-radius: var(--radius-card);
  font-size: 0.85rem;
  color: var(--site-primary-dark);
  font-family: var(--font-heading);
}

/* ── Print Overrides ── */
@media print {
  .sheet-preview {
    page-break-inside: avoid;
    break-inside: avoid;
    margin: 0;
    padding: 0;
    box-shadow: none !important;
    border: 1pt solid #ccc !important;
    transform: none !important;
  }

  .sheet-grid-svg,
  .sheet-dots-svg {
    max-width: 100%;
    height: auto;
    border: none !important;
  }

  .gp-param-panel,
  .gp-type-selector,
  .gp-presets,
  .gp-download-flow,
  .gp-next-suggest,
  .gp-preview__updating {
    display: none !important;
  }

  .page-size-badge,
  .orientation-label {
    display: none !important;
  }
}

/* ── Dark Mode: interaction components ── */
@media (prefers-color-scheme: dark) {
  .gp-param-panel {
    background: #0f1f3d;
    border-color: #1e3a5f;
  }

  .gp-param-group__label {
    color: #93c5fd;
  }

  .gp-param-group__input {
    background: #071224;
    border-color: #1e3a5f;
    color: #e2e8f0;
  }

  .gp-param-group__input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.20);
  }

  .gp-type-btn {
    background: #071224;
    border-color: #1e3a5f;
    color: #e2e8f0;
  }

  .gp-type-btn:hover {
    border-color: #3b82f6;
    background: #0f1f3d;
  }

  .gp-type-btn.is-active {
    border-color: #3b82f6;
    background: #0f1f3d;
    color: #dbeafe;
    box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.25);
  }

  .gp-preview {
    background: #071224;
    border-color: #1e3a5f;
  }

  .gp-preview__updating {
    background: rgba(7, 18, 36, 0.92);
    border-color: #1e3a5f;
    color: #94a3b8;
  }

  .gp-presets {
    background: #0f1f3d;
    border-color: #1e3a5f;
  }

  .gp-presets__title { color: #93c5fd; }

  .gp-preset-chip {
    background: #071224;
    border-color: #1e3a5f;
    color: #60a5fa;
  }

  .gp-preset-chip:hover {
    border-color: #3b82f6;
    background: #0f1f3d;
  }

  .gp-preset-chip__remove { color: #64748b; }
  .gp-preset-chip__remove:hover { background: rgba(29, 78, 216, 0.20); color: #93c5fd; }

  .gp-next-suggest {
    background: #0f1f3d;
    border-color: #1e3a5f;
    color: #93c5fd;
  }

  .page-size-badge {
    background: rgba(29, 78, 216, 0.15);
    border-color: #1e3a5f;
    color: #60a5fa;
  }
}
