/* ==========================================================================
   ZINBO Design System — Specimen Detail Styles (specimen.css)
   Detail header, section nav, type tester, sliders, glyphs matrix, & styles stack.
   ========================================================================== */

/* --- Detail Header Nav & Back Button --- */
.back-nav-unit {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  margin-left: -10px;
  border-radius: 8px;
  transition: background 0.15s;
  color: var(--text-main);
  text-decoration: none;
}

.back-nav-unit:hover {
  background: var(--bg-subtle);
}

.back-nav-unit .back-arrow-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.back-nav-unit:hover .back-arrow-icon {
  transform: translateX(-2px);
}

.back-nav-unit .active-font-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.back-btn {
  background: none;
  border: none;
  font-size: 1.35rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.back-btn:hover {
  background: var(--bg-subtle);
}

/* Detail Section Jump Nav (In-Header) */
.section-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 32px;
}

.section-link {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 4px;
  position: relative;
  transition: color 0.15s;
}

.section-link:hover, .section-link.active {
  color: var(--text-main);
}

.section-link.active::after {
  content: '';
  position: absolute;
  bottom: 0px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text-main);
}

/* --- Specimen Continuous Scroll Sections --- */
.specimen-section {
  margin-bottom: 24px;
  scroll-margin-top: 96px;
}

.specimen-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--card-radius);
  padding: 24px 32px 36px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  transition: border-color 0.2s;
}

.specimen-card:hover {
  border-color: #cacaca;
}

[data-theme="dark"] .specimen-card:hover {
  border-color: #3e3e46;
}

/* Card Controls Bar */
.card-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border-light);
  gap: 20px;
}

.card-controls.tester-card-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: flex-end;
}

.tester-card-controls .font-label {
  justify-self: start;
  margin-bottom: 2px;
}

.tester-card-controls .slider-group {
  justify-self: center;
  width: 320px;
  max-width: 360px;
}

.tester-card-controls .weight-control-unit {
  justify-self: end;
}

.card-controls.multi-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

.card-controls.multi-controls .control-unit {
  flex: 1;
  min-width: 0;
}

.card-controls.multi-controls .select-wrapper {
  flex-shrink: 0;
  margin-bottom: 2px;
}

.font-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.weight-control-unit {
  width: 170px;
  max-width: 180px;
  flex: 0 0 170px;
}

.control-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.control-label-row label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.2;
}

.slider-val-inline {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.range-slider:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.range-slider:disabled::-webkit-slider-thumb {
  cursor: not-allowed;
  border-color: var(--border-light);
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 380px;
}

.slider-val, .slider-limit {
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  min-width: 38px;
}

.slider-limit {
  text-align: right;
}

.control-unit {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-unit label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Range Sliders */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--border-light);
  outline: none;
  border-radius: 2px;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--text-main);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  transition: transform 0.12s;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.range-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--text-main);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  transition: transform 0.12s;
}

/* Minimal Dropdowns */
.select-wrapper {
  position: relative;
}

.minimal-select {
  appearance: none;
  background: transparent;
  border: none;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-main);
  padding: 4px 22px 4px 8px;
  cursor: pointer;
  border-radius: 4px;
  outline: none;
}

.minimal-select:hover {
  background: var(--bg-subtle);
}

.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Text Stages */
.text-stage {
  min-height: 80px;
  display: flex;
  align-items: center;
}

.editable-text {
  font-family: var(--font-specimen);
  color: var(--text-main);
  outline: none;
  width: 100%;
  word-break: break-word;
  line-height: 1.45;
  cursor: text;
}

.editable-text.single-line {
  font-size: 42px;
  font-weight: 400;
  white-space: normal;
  text-align: left;
}

.editable-text.headline-text {
  font-size: 38px;
  font-weight: 400;
  line-height: 1.4;
}

/* Paragraph Columns */
.paragraph-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: flex-start;
}

.para-col {
  font-family: var(--font-specimen);
  font-size: 20px;
  line-height: 2.1;
  letter-spacing: normal;
  color: var(--text-main);
  outline: none;
  text-align: left;
}

/* Styles Section */
.section-divider {
  margin: 32px 0 20px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.styles-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.style-row-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--card-radius);
  padding: 24px 32px;
  transition: border-color 0.15s;
}

.style-row-card:hover {
  border-color: #bebebe;
}

.style-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.style-row-card .style-preview {
  font-family: var(--font-specimen);
  font-size: 32px;
  outline: none;
}

.style-thin .style-preview { font-weight: 100; }
.style-regular .style-preview { font-weight: 400; }
.style-bold .style-preview { font-weight: 700; }

/* Glyphs Section */
.glyphs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.glyph-filters {
  display: flex;
  align-items: center;
  gap: 24px;
}

.glyph-lined-tabs {
  display: flex;
  align-items: center;
  gap: 20px;
}

.glyph-tab-btn {
  background: none;
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 0;
  position: relative;
  cursor: pointer;
  transition: color 0.15s;
}

.glyph-tab-btn:hover, .glyph-tab-btn.active {
  color: var(--text-main);
}

.glyph-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text-main);
}

.glyphs-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.glyph-inspector-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--card-radius);
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 380px;
}

.glyph-big-display {
  font-family: var(--font-specimen);
  font-size: 140px;
  font-weight: 400;
  line-height: 1;
  color: var(--text-main);
  margin-bottom: 28px;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.glyph-meta-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.glyph-char-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  text-align: center;
  letter-spacing: 0.02em;
}

.glyph-unicode {
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--text-muted);
}

.glyph-grid-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--card-radius);
  padding: 24px;
}

.glyph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 12px;
}

.glyph-cell {
  aspect-ratio: 1;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-specimen);
  font-size: 26px;
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.glyph-cell:hover {
  border-color: var(--text-main);
  transform: translateY(-2px);
}

.glyph-cell.active {
  border-color: var(--text-main);
  background: var(--text-main);
  color: var(--accent-contrast);
}

/* Info & Unified License Block */
.specimen-footer-cards {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.font-info-unified-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.info-block-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-divider-line {
  height: 1px;
  background: var(--border-light);
  width: 100%;
  margin: 24px 0 24px;
}

.unified-block-title {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  margin: 0;
}

.unified-block-text {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--text-muted);
  margin: 0;
}

.unified-licenses-bullets {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.unified-licenses-bullets li {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-muted);
  position: relative;
  padding-left: 18px;
}

.unified-licenses-bullets li::before {
  content: "•";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 1.1rem;
  color: var(--text-main);
}

.unified-licenses-bullets li strong {
  color: var(--text-main);
  font-weight: 600;
}

.license-cta-row {
  margin-top: 8px;
}

.specimen-info-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.font-buy-cta {
  background: var(--text-main);
  border: 1px solid var(--text-main);
  color: var(--accent-contrast);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0 28px;
  height: 42px;
  border-radius: var(--btn-radius);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
  width: fit-content;
  cursor: pointer;
}

.font-buy-cta:hover {
  opacity: 0.88;
  background: var(--text-main);
  color: var(--accent-contrast);
  border-color: var(--text-main);
}

.license-redirect-btn {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0 24px;
  height: 42px;
  border-radius: var(--btn-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  width: fit-content;
  border: 1px solid var(--border-light);
  color: var(--text-main);
  background: transparent;
}

.license-redirect-btn:hover {
  border-color: var(--text-main);
  background: var(--bg-subtle);
  color: var(--text-main);
}

@media (max-width: 600px) {
  .specimen-info-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .specimen-info-actions .font-buy-cta,
  .specimen-info-actions .license-redirect-btn {
    width: 100%;
    justify-content: center;
  }
}

.unified-licenses-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 4px;
}

.unified-license-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.unified-license-col .license-name {
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
}

/* =========================================================================
   Specimen Responsive Breakpoints
   ========================================================================= */
@media (max-width: 1024px) {
  .section-nav {
    gap: 16px;
  }
  .section-link {
    font-size: 0.85rem;
  }
  .glyphs-layout {
    grid-template-columns: 240px 1fr;
  }
}

@media (max-width: 768px) {
  .section-nav {
    display: none;
  }
  .specimen-section {
    margin-bottom: 28px;
  }
  .specimen-card {
    padding: 24px 22px 28px;
    height: auto !important;
    min-height: 0 !important;
    display: block !important;
  }
  .card-controls,
  .card-controls.tester-card-controls,
  .card-controls.multi-controls {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    margin-bottom: 24px !important;
    padding-bottom: 20px !important;
    gap: 18px !important;
    height: auto !important;
    min-height: 0 !important;
    grid-template-columns: none !important;
  }
  .card-controls .font-label,
  .tester-card-controls .font-label {
    justify-self: auto !important;
    margin-bottom: 0 !important;
  }
  .card-controls .slider-group,
  .card-controls .weight-control-unit,
  .card-controls .control-unit,
  .tester-card-controls .slider-group,
  .tester-card-controls .weight-control-unit {
    justify-self: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    height: auto !important;
    min-height: 0 !important;
  }
  .text-stage {
    min-height: auto !important;
    padding: 8px 0 6px !important;
  }
  .editable-text.single-line {
    font-size: 34px;
  }
  .editable-text.headline-text {
    font-size: 26px;
  }
  .paragraph-columns {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .para-col {
    font-size: 17px;
    line-height: 1.95;
    text-align: left;
  }
  .glyphs-layout {
    grid-template-columns: 1fr;
  }
  .glyph-inspector-card {
    min-height: 220px;
    padding: 24px 20px;
  }
  .glyph-big-display {
    font-size: 96px;
    margin-bottom: 16px;
  }
  .glyph-grid-wrapper {
    padding: 14px;
  }
  .glyph-grid {
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    gap: 8px;
  }
  .glyph-cell {
    font-size: 20px;
    border-radius: 8px;
  }
  .glyphs-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .glyph-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .glyph-lined-tabs {
    overflow-x: auto;
    white-space: nowrap;
    gap: 16px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .glyph-lined-tabs::-webkit-scrollbar {
    display: none;
  }
  .glyphs-header .weight-control-unit {
    width: 100%;
    max-width: 100%;
    flex: none;
  }

  /* Detail Header Mobile Layout */
  #detailHeader .theme-toggle {
    display: none;
  }
  #detailHeader .buy-label-full {
    display: none;
  }
  #detailHeader .buy-label-short {
    display: inline;
  }
  #detailHeader .header-right {
    gap: 0;
  }
  #detailHeader .back-nav-unit {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #detailHeader .back-nav-unit .active-font-name {
    font-size: 0.95rem;
  }
  #detailHeader #detailHeaderBuyBtn {
    padding: 7px 18px;
    font-size: 0.88rem;
    flex-shrink: 0;
  }

  .unified-licenses-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .style-row-card {
    padding: 20px 20px;
  }
  .style-row-card .style-preview {
    font-size: 26px;
  }
}

@media (max-width: 480px) {
  .editable-text.single-line {
    font-size: 32px;
  }
  #detailHeader .back-nav-unit {
    max-width: 175px;
  }
  .specimen-card {
    padding: 16px 14px 20px;
  }
}
