/* ================================================================
   FontDrop — tool.css
   Tool pages: input, font cards, favorites, shortcuts, toast
   ================================================================ */

/* ── Page wrapper ── */
.tool-page {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 12px var(--sp-4);
}

.tool-main {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Page title ── */
.tool-title {
  text-align: center;
  margin-bottom: 4px;
}

.tool-title h1 {
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text);
  line-height: 1.2;
}

.tool-title p {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-soft);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Sticky input field ── */
.sticky-sentinel {
  height: 0;
}

.sticky-field {
  position: sticky;
  top: 0;
  z-index: 60;
  padding: 8px 0;
  background: var(--bg);
  transition: background var(--t), box-shadow 200ms ease;
}

.sticky-field.is-stuck {
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
}

html.dark .sticky-field.is-stuck {
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

.input-row {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-faint);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.input-icon svg {
  width: 18px;
  height: 18px;
}

.tool-input {
  width: 100%;
  padding: 11px 42px;
  font-size: 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
  outline: none;
  transition: border-color var(--t), background var(--t);
}

.tool-input:focus {
  border-color: var(--accent);
}

.tool-input::placeholder {
  color: var(--text-faint);
}

.clear-btn {
  position: absolute;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--text-faint);
  transition: color var(--t), background var(--t);
}

.clear-btn:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.clear-btn.hidden {
  display: none;
}

.clear-btn svg {
  width: 18px;
  height: 18px;
}

/* ── Toolbar row (shortcuts + size slider) ── */
.tool-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: -4px;
}

@media (min-width: 768px) {
  .tool-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* Shortcut chips wrapper */
.shortcut-wrap {
  min-width: 0;
  flex: 1;
}

.shortcut-list {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.shortcut-list::-webkit-scrollbar {
  display: none;
}

/* Individual chip */
.chip {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 5px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--t), background var(--t), border-color var(--t);
  text-decoration: none;
}

.chip:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

.chip.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.chip.hidden {
  display: none;
}

/* Preview size control */
.size-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  justify-content: flex-end;
  font-weight: 500;
}

.size-slider {
  width: 96px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ── Section heading (inside results area) ── */
.section-heading {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
  margin-top: 8px;
  margin-bottom: 2px;
  grid-column: 1 / -1;
}

/* ── Results area ── */
.results-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 24px;
}

/* ── Font card ── */
.font-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 14px 12px 14px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  content-visibility: auto;
  contain-intrinsic-size: auto 80px;
}

.font-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.font-card:active {
  background: var(--accent-subtle);
}

/* Card actions — float right so text wraps under them */
.card-actions {
  float: right;
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 12px;
  margin-bottom: 6px;
}

/* Buttons inside a card */
.card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  color: var(--text-faint);
  transition: color var(--t), background var(--t);
}

.card-btn:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.card-btn svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* Favorite button active state */
.btn-fav.faved {
  color: var(--danger);
}

/* Card content */
.card-body {
  min-width: 0;
  overflow: hidden;
}

.card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-text {
  font-size: var(--preview-size, 18px);
  color: var(--text);
  word-break: break-word;
  line-height: 1.5;
}

/* Clearfix */
.card-clear {
  clear: both;
}

/* ── Favorites section ── */
.favs-section {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.favs-section.visible {
  display: flex;
}

.favs-heading {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  margin-bottom: 2px;
}

.favs-heading svg {
  width: 16px;
  height: 16px;
  color: var(--danger);
  fill: var(--danger);
  flex-shrink: 0;
}

/* ── Quick results (filter/recent chips) ── */
.quick-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-results.hidden {
  display: none;
}

/* legacy alias */
.quick-section {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.quick-section.visible {
  display: flex;
}

/* Hidden mixed fonts (revealed by Load More) */
.font-card.mixed-hidden {
  display: none;
}

/* ── Load more button ── */
.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 4px;
  margin-bottom: 8px;
}

.btn-load-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-full);
  transition: background var(--t), transform 150ms ease, box-shadow 150ms ease;
  cursor: pointer;
}

.btn-load-more:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-load-more:active {
  transform: translateY(0);
}

.btn-load-more svg {
  width: 15px;
  height: 15px;
}

/* ── Toast notification ── */
.toast-box {
  position: fixed;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: var(--bg);
  padding: 8px 16px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-md);
  animation: toast-enter 150ms ease forwards;
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── Responsive ── */
@media (min-width: 640px) {
  .tool-page { padding: 12px 24px; }
  .tool-input { padding: 12px 44px; font-size: 17px; }
}

@media (min-width: 1024px) {
  .tool-page { padding: 12px 32px; }
}

/* ── Chip icon helpers ── */
.chip-icon {
  font-size: 13px;
  margin-right: 3px;
}

.chip-icon-svg {
  width: 13px;
  height: 13px;
  margin-right: 3px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   INFO WRAP (features + article — homepage only)
════════════════════════════════════════════════════════════ */
.info-wrap {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-4) 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 640px)  { .info-wrap { padding-left: 24px; padding-right: 24px; } }
@media (min-width: 1024px) { .info-wrap { padding-left: 32px; padding-right: 32px; } }

/* ── Features section ── */
.features-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px var(--sp-4);
  transition: background var(--t), border-color var(--t);
}

@media (min-width: 640px) { .features-section { padding: 28px 36px; } }
@media (min-width: 1024px) { .features-section { padding: 32px 44px; } }

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 640px) {
  .features-grid { grid-template-columns: 1fr 1fr; gap: 28px 36px; }
}

.feature-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.feature-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--accent-subtle);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-icon svg {
  width: 18px;
  height: 18px;
}

.feature-item h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}

.feature-item p {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.65;
  margin: 0;
}

.feature-item a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Article section ── */
.article-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px var(--sp-4) 32px;
  transition: background var(--t), border-color var(--t);
}

@media (min-width: 640px)  { .article-section { padding: 32px 36px 40px; } }
@media (min-width: 1024px) { .article-section { padding: 40px 52px 52px; } }

.article-prose {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 15px;
  color: var(--text-soft);
  line-height: 1.75;
}

.article-prose h2 {
  font-size: clamp(18px, 3vw, 22px);
  font-weight: 700;
  color: var(--text);
  margin: 20px 0 4px;
}

.article-prose h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 16px 0 2px;
}

.article-prose h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 12px 0 2px;
}

.article-prose p { margin: 0; }

.article-prose strong { color: var(--text); font-weight: 700; }

.article-prose u {
  text-underline-offset: 3px;
}

.article-prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-center { text-align: center; }

.article-divider {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-top: 16px !important;
}

.article-lead {
  font-weight: 600;
  color: var(--text) !important;
}

/* Article hero: text + image side by side on wide screens */
.article-hero {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 768px) {
  .article-hero {
    flex-direction: row;
    gap: 36px;
    align-items: flex-start;
  }
  .article-hero-text { flex: 1; }
  .article-hero-img  { width: 340px; flex-shrink: 0; }
}

@media (min-width: 1024px) {
  .article-hero-img { width: 400px; }
}

.article-hero-img {
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--surface-alt);
}

.article-hero-img img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.article-hero-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* How-to steps */
.article-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.article-steps li {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.article-steps strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.article-steps p { margin: 0; }

/* Font example grid in tabs */
.example-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

@media (min-width: 480px) {
  .example-grid { grid-template-columns: 1fr 1fr; }
}

.example-cell {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  text-align: center;
  font-size: 18px;
  color: var(--text);
  transition: background var(--t), border-color var(--t);
}

/* ── Tabs ── */
.tab-ui {
  margin-top: 20px;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

@media (min-width: 640px) {
  .tab-list { flex-wrap: nowrap; overflow-x: auto; }
}

.tab-btn {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: var(--r-lg);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  background: transparent;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.tab-panel { display: flex; flex-direction: column; gap: 12px; }
.tab-panel.hidden { display: none; }

/* ── FAQ accordion ── */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.faq-item {
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t);
}

.faq-item:hover {
  border-color: var(--text-faint);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

/* Hide native arrow in all browsers */
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { display: none; }

.faq-item summary h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.faq-chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-faint);
  transition: transform 200ms ease;
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
}

.faq-body {
  padding: 0 16px 14px;
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.7;
}
