/* ==========================================================================
   app.css — URLDecoder.dev additions on top of the compiled design system.
   base.css is the compiled Tailwind design system reused verbatim, so
   typography, colours, spacing and shadows stay identical to the reference
   look. Only the tool-specific components that utilities cannot express live
   here. Every colour is a design-system token so light/dark both work.
   ========================================================================== */

/* ---------- small layout helpers ---------- */

.hero {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  text-align: center;
}

@media (min-width: 640px) {
  .hero {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
}

.hero-title {
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
}

.hero-sub {
  margin-top: 0.375rem;
  margin-left: auto;
  margin-right: auto;
  max-width: 46rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
}

@media (min-width: 640px) {
  .hero-title {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }

  .hero-sub {
    font-size: 1rem;
    line-height: 1.5rem;
  }
}

/* On phones the subtitle is the tallest part of the first screen, so it is
   allowed to be slightly tighter there. */
@media (max-width: 420px) {
  .hero-sub {
    max-width: 21rem;
  }
}


.shell {
  max-width: 78rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 1024px) {
  .shell {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* ---------- workspace card ---------- */

.ws {
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  background: hsl(var(--card));
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  padding: 0.75rem;
}

@media (min-width: 640px) {
  .ws {
    padding: 1rem;
  }
}

.ws-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.ws-tools {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.toolbar-note {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* ---------- segmented mode switch ---------- */

.seg {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  padding: 0.25rem;
  border-radius: 0.625rem;
  background: hsl(var(--muted));
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: hsl(var(--muted-foreground));
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.seg-btn:hover {
  color: hsl(var(--foreground));
}

.seg-btn[aria-selected='true'] {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.1);
}

.seg-btn svg {
  width: 1rem;
  height: 1rem;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.btn:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* Touch devices have no hover, so every action needs a pressed state. */
.btn,
.seg-btn,
.icon-btn,
.nav-link {
  -webkit-tap-highlight-color: transparent;
}

.btn:active:not([disabled]),
.seg-btn:active,
.icon-btn:active,
.nav-link:active {
  transform: translateY(1px);
}

.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.08);
}

.btn-primary:hover {
  background: hsl(var(--primary) / 0.9);
}

.btn-ghost {
  border-color: hsl(var(--input));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04);
}

.btn-ghost:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.btn-quiet {
  color: hsl(var(--muted-foreground));
}

.btn-quiet:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.btn-sm {
  min-height: 2.75rem;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  min-height: 3rem;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
}

/* ---------- input / output panes ---------- */

.ws-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

@media (min-width: 1024px) {
  .ws-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem;
  }
}

.io-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.io-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.125rem 0.75rem;
  margin-bottom: 0.375rem;
}

.io-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.io-stat {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Size warnings: amber once live mode pauses, red once the hard limit is hit. */
.io-stat.is-warn {
  color: hsl(var(--destructive));
  font-weight: 500;
}

.io-stat.is-alert {
  color: hsl(var(--destructive));
  font-weight: 600;
}

.io-field {
  width: 100%;
  height: 12.5rem;
  padding: 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  resize: none;
  overflow: auto;
  overflow-wrap: anywhere;
  tab-size: 2;
}

.io-field::placeholder {
  color: hsl(var(--muted-foreground));
}

.io-field:focus {
  outline: none;
  border-color: transparent;
  box-shadow: 0 0 0 2px rgb(59 130 246 / 0.55);
}

.io-field[readonly] {
  background: hsl(var(--card));
  cursor: default;
}

.break-all {
  word-break: break-all;
}

.io-field.is-invalid {
  border-color: rgb(220 38 38 / 0.6);
}

/* Editor and result panes share one height per breakpoint, so the two columns
   line up and the writing area keeps the reference proportions (300px on
   desktop, the same value the original tool used). */
.io-field,
.results-pane {
  height: 12.5rem;
}

@media (min-width: 640px) {
  .io-field,
  .results-pane {
    height: 15rem;
  }
}

/* Tablet portrait: more room than a phone, still one column. */
@media (min-width: 768px) {
  .io-field,
  .results-pane {
    height: 16.25rem;
  }
}

@media (min-width: 1024px) {
  .io-field,
  .results-pane {
    height: 18.75rem;
  }
}

/* Landscape phones and other very short windows: a 300px editor would push the
   primary action off-screen, so shrink the editor instead of the page. */
@media (max-height: 480px) {
  .io-field,
  .results-pane {
    height: 8rem;
  }
}

.io-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.625rem;
}

.io-actions .btn-primary {
  flex: 1 1 auto;
}

@media (min-width: 640px) {
  .io-actions .btn-primary {
    flex: 0 0 auto;
    min-width: 11rem;
  }
}

/* Results pane on the batch page: same frame as an editor, but normal text
   instead of monospace chrome. */
.results-pane {
  overflow-y: auto;
  padding: 0.625rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  background: hsl(var(--card));
}


.io-note {
  font-size: 0.75rem;
  line-height: 1.4;
  color: hsl(var(--muted-foreground));
}

.io-note strong {
  color: hsl(var(--foreground));
  font-weight: 600;
}

.io-note code,
.adv-help code,
.prose-copy code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.88em;
  padding: 0.05rem 0.22rem;
  border-radius: 0.25rem;
  background: hsl(var(--muted));
  white-space: nowrap;
}

/* ---------- issues / hints ---------- */

.issues {
  margin-top: 0.75rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid rgb(220 38 38 / 0.35);
  border-radius: 0.5rem;
  background: rgb(220 38 38 / 0.06);
  color: #b91c1c;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.dark .issues {
  border-color: rgb(248 113 113 / 0.4);
  background: rgb(248 113 113 / 0.1);
  color: #fecaca;
}

.issues[data-tone='info'] {
  border-color: hsl(var(--border));
  background: hsl(var(--muted) / 0.6);
  color: hsl(var(--muted-foreground));
}

.issues h4 {
  margin: 0 0 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

.issues ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.25rem;
}

.issues code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.95em;
  padding: 0 0.2rem;
  border-radius: 0.2rem;
  background: rgb(0 0 0 / 0.06);
}

.dark .issues code {
  background: rgb(255 255 255 / 0.12);
}

/* ---------- advanced panel ---------- */

.adv {
  margin-top: 0.875rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  background: hsl(var(--card));
}

.adv > summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.25rem 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.adv > summary::-webkit-details-marker {
  display: none;
}

.adv > summary:hover {
  background: hsl(var(--accent));
}

.adv > summary:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.adv[open] > summary {
  border-bottom: 1px solid hsl(var(--border));
  border-radius: 0.5rem 0.5rem 0 0;
}

.adv-chev {
  margin-left: auto;
  width: 1rem;
  height: 1rem;
  color: hsl(var(--muted-foreground));
  transition: transform 0.18s ease;
}

.adv[open] .adv-chev {
  transform: rotate(180deg);
}

.adv-body {
  display: grid;
  gap: 0.875rem;
  padding: 0.875rem;
}

.adv-group {
  display: grid;
  gap: 0.625rem;
}

.adv-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

.opt-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .opt-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.opt {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.opt-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.opt-select,
.opt-input {
  min-height: 2.75rem;
  width: 100%;
  padding: 0 0.625rem;
  border: 1px solid hsl(var(--input));
  border-radius: 0.375rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font: inherit;
  font-size: 0.8125rem;
}

.opt-select:focus-visible,
.opt-input:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.opt-help {
  font-size: 0.6875rem;
  line-height: 1.4;
  color: hsl(var(--muted-foreground));
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  min-height: 2.75rem;
  padding: 0.375rem 0;
  cursor: pointer;
}

.check-row input[type='checkbox'] {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: hsl(var(--primary));
  cursor: pointer;
}

.check-text {
  display: grid;
  gap: 0.125rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.check-text span {
  font-size: 0.6875rem;
  font-weight: 400;
  line-height: 1.4;
  color: hsl(var(--muted-foreground));
}

.adv-divider {
  height: 1px;
  background: hsl(var(--border));
}

/* ---------- panels, tables, badges (parser + validator) ---------- */

.panel {
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  background: hsl(var(--background));
  padding: 0.75rem;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.panel-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.panel-empty {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table th,
.data-table td {
  padding: 0.4375rem 0.625rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid hsl(var(--border));
  overflow-wrap: anywhere;
}

.data-table th {
  background: hsl(var(--muted));
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table td.mono,
.kv-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.75rem;
  color: hsl(var(--foreground));
}

.kv {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) minmax(0, 1fr);
  gap: 0.25rem 0.75rem;
  font-size: 0.8125rem;
}

.kv dt {
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.8125rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-pass {
  color: #15803d;
  background: rgb(22 163 74 / 0.1);
  border-color: rgb(22 163 74 / 0.25);
}

.badge-warn {
  color: #a16207;
  background: rgb(234 179 8 / 0.14);
  border-color: rgb(234 179 8 / 0.3);
}

.badge-fail {
  color: #b91c1c;
  background: rgb(220 38 38 / 0.1);
  border-color: rgb(220 38 38 / 0.25);
}

.badge-skip,
.badge-neutral {
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
  border-color: hsl(var(--border));
}

.dark .badge-pass {
  color: #86efac;
}

.dark .badge-warn {
  color: #fde68a;
}

.dark .badge-fail {
  color: #fca5a5;
}

.check-list {
  display: grid;
  gap: 0.375rem;
}

.check-item {
  display: grid;
  gap: 0.15rem;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.check-item dt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.check-item dd {
  margin: 0;
  color: hsl(var(--muted-foreground));
}

/* ---------- batch page ---------- */

.batch-results {
  display: grid;
  gap: 0.5rem;
  align-content: start;
}

.batch-item {
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  background: hsl(var(--background));
  padding: 0.5rem 0.625rem;
}

.batch-item.is-error {
  border-color: rgb(220 38 38 / 0.35);
  background: rgb(220 38 38 / 0.05);
}

.batch-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  font-size: 0.6875rem;
  color: hsl(var(--muted-foreground));
}

.batch-head .btn {
  margin-left: auto;
  padding: 0 0.25rem;
  font-size: 0.75rem;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.batch-index {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.batch-value {
  margin: 0.25rem 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: hsl(var(--foreground));
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.batch-layers {
  margin-top: 0.375rem;
  border-top: 1px dashed hsl(var(--border));
  padding-top: 0.375rem;
  display: grid;
  gap: 0.25rem;
}

.layer-row {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  gap: 0.5rem;
  font-size: 0.75rem;
}

.layer-row span:first-child {
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
}

.layer-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  overflow-wrap: anywhere;
}

.progress {
  height: 0.375rem;
  border-radius: 999px;
  background: hsl(var(--muted));
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: hsl(var(--primary));
  transition: width 0.12s linear;
}

/* ---------- prose blocks used by the info sections ---------- */

.prose-copy {
  color: hsl(var(--muted-foreground));
  font-size: 0.9375rem;
  line-height: 1.7;
}

.prose-copy p {
  margin: 0 0 0.75rem;
}

.prose-copy p:last-child {
  margin-bottom: 0;
}

.prose-copy strong {
  color: hsl(var(--foreground));
  font-weight: 600;
}

.prose-copy a {
  color: hsl(var(--foreground));
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose-copy a:hover {
  color: hsl(var(--primary));
}

.prose-copy ul,
.prose-copy ol {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.3rem;
}

.prose-copy li {
  padding-left: 0.15rem;
}

.prose-copy h3 {
  margin: 0 0 0.375rem;
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.section-title {
  font-size: 1.5rem;
  line-height: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: hsl(var(--foreground));
  text-align: center;
}

.section-sub {
  margin: 0.5rem auto 0;
  max-width: 42rem;
  text-align: center;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: hsl(var(--muted-foreground));
}

@media (min-width: 640px) {
  .section-title {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
}

.section-block {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

@media (min-width: 768px) {
  .section-block {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }
}

.section-card {
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  background: hsl(var(--card));
  padding: 1.25rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

@media (min-width: 640px) {
  .section-card {
    padding: 1.75rem;
  }
}

/* FAQ keeps the reference typography: heading + paragraph in one card. */
.faq-list {
  display: grid;
  gap: 1.25rem;
}

.faq-item h3 {
  margin: 0 0 0.375rem;
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.faq-item p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: hsl(var(--muted-foreground));
}

/* ---------- header tweaks for the 3-link navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background));
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 4rem;
  max-width: 78rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 1024px) {
  .site-header .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  border-radius: 0.375rem;
  color: hsl(var(--foreground));
}

.brand img {
  width: 2.25rem;
  height: 2.25rem;
  display: block;
}

.brand-name {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-name span {
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}

.nav-link[aria-current='page'] {
  color: hsl(var(--foreground));
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

@media (min-width: 768px) {
  .header-actions {
    margin-left: 0.5rem;
  }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: hsl(var(--foreground));
  cursor: pointer;
}

.icon-btn:hover {
  background: hsl(var(--accent));
}

.icon-btn svg {
  width: 1.15rem;
  height: 1.15rem;
}

/* Feedback keeps an icon on phones and shows its label from 768px up. */
.feedback-trigger {
  gap: 0.375rem;
  padding: 0 0.625rem;
  width: auto;
  min-width: 2.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.feedback-trigger-label {
  display: none;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .feedback-trigger-label {
    display: inline;
  }
}

.icon-btn .icon-sun {
  display: block;
}

.icon-btn .icon-moon {
  display: none;
}

.dark .icon-btn .icon-sun {
  display: none;
}

.dark .icon-btn .icon-moon {
  display: block;
}

/* Mobile menu: only the three product links, no nested dropdowns. */
.mobile-menu-btn {
  display: inline-flex;
}

@media (min-width: 768px) {
  .mobile-menu-btn {
    display: none;
  }
}

.mobile-panel {
  display: none;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background));
}

.mobile-panel.is-open {
  display: block;
}

.mobile-panel nav {
  display: grid;
  gap: 0.25rem;
  padding: 0.5rem 1rem 1rem;
}

.mobile-panel .nav-link {
  justify-content: flex-start;
  width: 100%;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--background));
}

.footer-grid {
  display: grid;
  gap: 2rem;
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 3rem;
  }
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.footer-col b {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--foreground));
}

.footer-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.footer-col a {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.footer-col a:hover {
  color: hsl(var(--foreground));
}

.footer-bottom {
  border-top: 1px solid hsl(var(--border));
  padding-top: 1.25rem;
  padding-bottom: 1.5rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: space-between;
}

/* ---------- toast (same visual language as the reference site) ---------- */

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.toast-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 1.5rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: min(92vw, 34rem);
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.15), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  animation: toast-in 0.2s ease forwards;
}

.toast.is-leaving {
  animation: toast-out 0.18s ease forwards;
}

.toast.is-error {
  border-color: rgb(220 38 38 / 0.45);
}

/* ---------- misc ---------- */

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 0.875rem;
  font-weight: 600;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0.5rem;
}

::selection {
  background: rgb(59 130 246 / 0.22);
}

/* Slim scrollbars inside the editors only. */
.io-field::-webkit-scrollbar,
.results-pane::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.io-field::-webkit-scrollbar-thumb,
.results-pane::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: hsl(var(--border));
  border: 3px solid transparent;
  background-clip: content-box;
}

/* Prevent any accidental horizontal scroll from long unbroken strings. */
html,
body {
  overflow-x: hidden;
}

/* Anchor jumps (FAQ, Related tools, footer links) land below the sticky
   header instead of underneath it. */
html {
  scroll-padding-top: 5rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- touch / small-screen overrides (last, so they win) ---------- */

/* Phone first-screen budget: 390x844 must show the input, the primary button
   and the first line of the result without scrolling, even with Safari's
   toolbars eating ~100px. Every rule below removes height that carries no
   information on a phone. */
@media (max-width: 768px) {
  /* 64px -> 48px header; 8px above and below a 32px mark. The icon buttons
     stay 44px tall, which fixes the floor for this bar. */
  .site-header .container {
    height: 3rem;
    padding: 0 1rem;
  }

  .brand svg {
    width: 2rem;
    height: 2rem;
  }

  .brand-name {
    font-size: 1rem;
  }

  .hero {
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
  }

  /* 30px -> 28px still reads as a page title and saves a line box. */
  .hero-title {
    font-size: 1.75rem;
    line-height: 1.2;
  }

  /* 15px/1.5 -> 14px/1.4 keeps the full required copy, just tighter. */
  .hero-sub {
    font-size: 0.875rem;
    line-height: 1.4;
  }

  /* Toolbar stays on one row (52px) instead of two (104px). The switch and
     both labelled actions fit from ~380px up; narrower phones wrap on their
     own, so nothing is ever clipped. */
  .ws-toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
  }

  .seg {
    width: auto;
    flex: 0 0 auto;
  }

  .seg-btn {
    flex: 0 0 auto;
    padding: 0 0.7rem;
    font-size: 0.8125rem;
  }

  .ws-tools {
    flex: 0 0 auto;
    margin-left: auto;
  }

  .ws-tools .btn {
    padding: 0 0.5rem;
    font-size: 0.75rem;
  }

  .toolbar-note {
    display: none;
  }

  /* The debounce note repeats what Advanced options already says. */
  #input-note {
    display: none;
  }
}

/* Anything below 16px makes iOS Safari zoom the whole page on focus, which
   breaks the layout mid-tap. Keep form controls at 16px on touch-sized
   viewports instead. */
@media (max-width: 820px) {
  .io-field,
  .opt-select,
  .opt-input {
    font-size: 1rem;
  }
}

/* ---------- print ---------- */

@media print {
  .site-header,
  .site-footer,
  .ws-toolbar,
  .adv,
  .toast-host {
    display: none !important;
  }
}
