/* Branding. Theme the kit by overriding its --tsw-* tokens here, in the :root
   block loaded after theme.css (and tokens.css). Component rules below use var(--tsw-...) and
   never hard-code a colour, font, or spacing value, so a new site rebrands by
   editing this block only.

   Accent pair contrast (WCAG AA, 4.5:1 for normal text):
     light: #4338ca on #ffffff = 7.90 (--tsw-accent-ink on page background)
            #ffffff on #4338ca = 7.90 (--tsw-accent-on on --tsw-accent-bg)
     dark:  #a5b4fc on #0a0c10 = 9.82
            #ffffff on #4338ca = 7.90 (accent background keeps its light value)
   The ink value differs by colour scheme because no single indigo clears 4.5:1
   as small text on both a white and a near-black background. */
:root {
  color-scheme: light dark;

  /* Brand fonts. The kit defaults to the system UI stack; override to load a
     brand typeface (and update the @font-face / <link> in index.html). */
  /* --tsw-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; */
  /* --tsw-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; */

  --tsw-accent-bg: #4338ca;
  --tsw-accent-on: #ffffff;
  --tsw-accent-ink: #4338ca;
  --tsw-accent-soft: #e0e7ff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tsw-accent-ink: #a5b4fc;
    --tsw-accent-soft: #312e81;
  }
}

.tsw-grid {
  display: grid;
  gap: var(--tsw-space-lg);
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.tsw-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--tsw-space-xs);
  list-style: none;
  padding: 0;
  margin: 0;
}

.tsw-pill-list li {
  padding: var(--tsw-space-2xs) var(--tsw-space-md);
  border: var(--tsw-border-w) solid var(--tsw-border);
  border-radius: var(--tsw-radius-full);
  background: var(--tsw-surface);
  font-size: var(--tsw-text-sm);
  color: var(--tsw-text-muted);
}

tsw-hero dl {
  display: contents;
}

tsw-hero dl > div {
  display: grid;
  gap: var(--tsw-space-3xs);
}

tsw-hero dt {
  font-family: var(--tsw-font-mono);
  font-size: var(--tsw-text-2xs);
  letter-spacing: var(--tsw-tracking-wider);
  text-transform: uppercase;
}

tsw-hero dd {
  margin: 0;
  font-weight: 600;
}

/* Form fields for the split tool. */
.tsw-field {
  display: grid;
  gap: var(--tsw-space-2xs);
  margin-block-end: var(--tsw-space-md);
}

.tsw-field label {
  font-weight: 600;
  color: var(--tsw-text);
}

.tsw-field input,
.tsw-field textarea {
  padding: var(--tsw-space-xs) var(--tsw-space-sm);
  border: var(--tsw-border-w) solid var(--tsw-border);
  border-radius: var(--tsw-radius-sm);
  background: var(--tsw-surface);
  color: var(--tsw-text);
  font: inherit;
}

.tsw-field textarea {
  resize: vertical;
}

.tsw-field input:focus-visible {
  outline: 2px solid var(--tsw-accent-bg);
  outline-offset: 2px;
}

.tsw-help {
  font-size: var(--tsw-text-sm);
  color: var(--tsw-text-muted);
}

.tsw-help code {
  font-family: var(--tsw-font-mono);
}

.tsw-status {
  color: var(--tsw-text-muted);
  min-block-size: 1.5em;
}

.tsw-status[data-tone='error'] {
  color: var(--tsw-danger-ink);
}

.tsw-status[data-tone='success'] {
  color: #15803d;
}

.tsw-drop-zone {
  display: grid;
  gap: var(--tsw-space-sm);
  padding: var(--tsw-space-lg);
  border: var(--tsw-border-w) dashed var(--tsw-border);
  border-radius: var(--tsw-radius-md);
  background: var(--tsw-surface);
  text-align: center;
}

.tsw-drop-zone.is-dragover {
  border-color: var(--tsw-accent-bg);
  background: var(--tsw-accent-soft);
}

progress {
  inline-size: 100%;
  block-size: 0.5rem;
  margin-block-end: var(--tsw-space-sm);
}

/* Safe areas on notched devices. */
body {
  padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
  padding-block-end: env(safe-area-inset-bottom, 0px);
}

/* Touch targets. */
.tsw-btn,
.tsw-button,
.tsw-drop-zone,
.tsw-field input,
.tsw-field textarea {
  min-block-size: 2.75rem;
}

.tsw-drop-zone {
  min-block-size: 6rem;
}

.tsw-drop-zone:focus-visible {
  outline: 2px solid var(--tsw-accent-bg);
  outline-offset: 2px;
}

.tsw-field textarea:focus-visible,
.tsw-field input:focus-visible {
  outline: 2px solid var(--tsw-accent-bg);
  outline-offset: 2px;
}

.tsw-status[role='alert'] {
  color: var(--tsw-danger-ink);
}

.tsw-status[data-tone='success'] {
  color: light-dark(#15803d, #4ade80);
}

/* Keep primary button hover accessible (kit hover amber fails 4.5:1). */
.tsw-btn--primary:hover {
  background: var(--tsw-accent-bg);
}

@media (prefers-reduced-motion: reduce) {
  .tsw-drop-zone,
  .tsw-btn {
    transition: none;
  }
}

/* Component and layout rules below use the tokens above; they carry no brand
   values of their own. */
