/* word-counter — site-specific styles. Base chrome (variables, buttons,
 * footer, FAQ, explainer, sister-sites) is provided by /_chrome.css.
 * Anything not below is inherited from the shared chrome.
 */

main.wc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  padding: 12px 16px 0;
  max-width: 1240px;
  margin: 0 auto;
  align-items: start;
}

@media (max-width: 920px) {
  main.wc-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.pane {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-pane);
}

.wc-sidebar > * + * {
  margin-top: 12px;
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.pane-head label,
.pane-head .pane-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
}

.wc-counts > .pane-title {
  margin: 10px 12px 0;
}

/* ---------- editor ---------- */

.wc-editor {
  display: flex;
  flex-direction: column;
}

#text {
  flex: 1;
  width: 100%;
  min-height: 360px;
  resize: vertical;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

@media (min-height: 900px) {
  #text {
    min-height: 480px;
  }
}

#text::placeholder {
  color: var(--fg-mute);
  opacity: 0.7;
}

.wc-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg-mute);
}

.wc-meta-sep {
  opacity: 0.5;
}

.wc-save {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-mute);
}

/* ---------- counts ---------- */

.wc-stats {
  margin: 0;
  padding: 8px 4px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}

.wc-stat {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  border-radius: 6px;
  min-width: 0;
}

.wc-stat dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--fg-mute);
  margin: 0;
}

.wc-stat-hint {
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.7;
  margin-left: 4px;
  font-size: 10px;
}

.wc-stat dd {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  word-break: break-word;
}

.wc-stat-hero {
  grid-column: span 2;
  background: rgba(110, 168, 255, 0.08);
  border: 1px solid rgba(110, 168, 255, 0.18);
}

.wc-stat-hero dd {
  font-size: 32px;
  font-weight: 600;
}

/* ---------- goal ---------- */

.wc-goal-toggle,
.wc-density-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-mute);
  cursor: pointer;
  user-select: none;
}

.wc-goal-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 6px;
}

.wc-goal-label {
  font-size: 12px;
  color: var(--fg-mute);
}

#goal-target {
  flex: 1;
  font-family: var(--mono);
  font-size: 14px;
  padding: 6px 8px;
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 0;
}

#goal-target:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.wc-progress {
  padding: 4px 12px 12px;
}

.wc-progress-track {
  height: 8px;
  background: var(--bg-elev);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.wc-progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent-strong);
  transition: width 200ms ease;
}

.wc-progress-bar.over {
  background: var(--ok);
}

.wc-progress-text {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--fg-mute);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- keyword density ---------- */

.wc-density-list {
  list-style: none;
  margin: 0;
  padding: 6px 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wc-density-empty {
  padding: 14px 12px;
  color: var(--fg-mute);
  font-size: 12px;
  text-align: center;
}

.wc-density-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 60px auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--fg);
  font-family: var(--sans);
  text-align: left;
}

.wc-density-row:hover {
  border-color: var(--border);
  background: var(--bg-elev);
}

.wc-density-row.active {
  border-color: var(--accent);
  background: rgba(110, 168, 255, 0.10);
}

.wc-density-rank {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-mute);
  text-align: right;
}

.wc-density-word {
  font-weight: 500;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wc-density-bar {
  display: block;
  height: 6px;
  width: 60px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.wc-density-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
}

.wc-density-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-mute);
  white-space: nowrap;
}

/* ---------- ad slots ---------- */
/* Reserve heights so ads do not push content around when they load. */

.ad {
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-pane);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: var(--fg-mute);
  font-size: 12px;
  padding: 14px;
}

.ad-label {
  display: inline-block;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.ad-below {
  margin: 12px;
  min-height: 100px; /* reserve space — keeps CLS at 0 */
}

.ad-side {
  min-height: 250px; /* 300x250 MPU shape */
}

/* Affiliate strip below the fold */

.wc-affiliate {
  max-width: 1240px;
  margin: 24px auto 0;
  padding: 0 16px;
}

.wc-affiliate-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin: 0 0 10px;
}

.wc-affiliate-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.wc-affiliate-list .ad-affiliate {
  text-decoration: none;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 4px;
  padding: 16px;
  border-style: solid;
  background: linear-gradient(135deg, var(--bg-pane), var(--bg-elev));
  color: var(--fg);
}

.wc-affiliate-list .ad-affiliate:hover {
  border-color: var(--accent);
}

.ad-cta-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--fg-mute);
}

.ad-cta-headline {
  font-size: 16px;
  font-weight: 600;
}

.ad-cta-sub {
  font-size: 12px;
  color: var(--fg-mute);
}

.ad-cta-go {
  margin-top: 6px;
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 600px) {
  main.wc-layout {
    padding: 8px 12px 0;
  }
  .wc-stat-hero dd {
    font-size: 26px;
  }
  #text {
    font-size: 15px;
    min-height: 280px;
  }
}
