/* ============================================================
   Triton Converter — design tokens
   ============================================================ */
:root {
  --bg-base:        #0f1117;
  --bg-panel:       #171a23;
  --bg-panel-raised:#1e2230;
  --bg-input:       #12141c;

  --border:         #272c3a;
  --border-soft:    #1e222e;

  --text:           #e7e9f0;
  --text-muted:     #8790a3;
  --text-faint:     #565f74;

  --source:         #45e0c4; /* input / source language */
  --source-dim:     #1f4a44;
  --target:         #b98cf2; /* output / triton format */
  --target-dim:     #3c2f52;

  --warn:           #f2a154;
  --danger:         #f2716a;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-display: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;
  --font-body:    "IBM Plex Sans", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   Reset & base
   ============================================================ */
* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;

  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
}

a {
  color: var(--source);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

button {
  font-family: var(--font-display);
}

input, select, textarea, button {
  color: inherit;
}

::selection {
  background: var(--source-dim);
  color: var(--text);
}

/* Consistent, visible focus ring everywhere */
:focus-visible {
  outline: 2px solid var(--source);
  outline-offset: 2px;
}

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

/* ============================================================
   Shell
   ============================================================ */
.shell {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.75rem 2.5rem;

  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
  min-height: 0;
}

/* ============================================================
   Header
   ============================================================ */
.app-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-soft);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--source-dim), var(--target-dim));
  border: 1px solid var(--border);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.app-header h1 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.eyebrow {
  margin: 0.15rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.eyebrow .arrow {
  color: var(--source);
}

/* ============================================================
   Config cards
   ============================================================ */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 1rem;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--source);
  flex-shrink: 0;
}

.card:nth-of-type(2) .card-title .dot {
  background: var(--target);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.field:last-of-type {
  margin-bottom: 0;
}

.field label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1rem;
  margin-bottom: 1.1rem;
}

.field-wide {
  grid-column: 1 / -1;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  width: 100%;
  transition: border-color 0.15s ease;
}

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

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

input:focus-visible {
  border-color: var(--source);
}

/* Args (placeholder tokens) */
.args {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 2.5rem;
  align-content: flex-start;
}

.args:empty::before {
  content: "No arguments yet — type one above and press Enter";
  font-size: 0.78rem;
  color: var(--text-faint);
  font-style: italic;
  padding-top: 0.4rem;
}

.arg {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.55rem 0.3rem 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--source);
  width: fit-content;
  height: fit-content;
  line-height: 1;
}

.delete-arg {
  color: var(--text-faint);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  padding: 0.1rem 0.15rem;
  border-radius: 50%;
  transition: color 0.15s ease, background 0.15s ease;
}

.delete-arg:hover {
  color: var(--danger);
  background: rgba(242, 113, 106, 0.12);
}

/* Buttons */
.actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.1rem;
}

.btn {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
  background: var(--bg-input);
  color: var(--text);
}

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

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--source-dim), var(--target-dim));
  border-color: transparent;
  color: var(--text);
}

.btn-primary:hover {
  filter: brightness(1.15);
}

.btn-ghost {
  background: transparent;
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--target);
  color: var(--target);
}

/* ============================================================
   Converter
   ============================================================ */
.converter {
  flex: 1;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.converter-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.converter-bar .field {
  margin-bottom: 0;
  min-width: 180px;
}

.converter-bar-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

select.lang-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  width: 100%;
}

select.lang-select:focus-visible {
  border-color: var(--source);
}

.panes {
  flex: 1;
  min-height: 340px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: stretch;
}

.pane {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  min-height: 100%;
}

.pane-source {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  border-right: none;
}

.pane-target {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  border-left: none;
}

.pane-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-soft);
}

.pane-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

.pane-source .pane-tag {
  background: var(--source-dim);
  color: var(--source);
}

.pane-target .pane-tag {
  background: var(--target-dim);
  color: var(--target);
}

.pane textarea {
  flex: 1;
  width: 100%;
  min-height: 260px;
  background: var(--bg-input);
  border: none;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
  resize: none;
}

.pane-source textarea {
  border-radius: 0 0 0 var(--radius-lg);
}

.pane-target textarea {
  border-radius: 0 0 var(--radius-lg) 0;
}

.pane textarea:disabled {
  color: var(--text-muted);
  cursor: default;
}

.pane textarea::placeholder {
  color: var(--text-faint);
}

/* Connector — the signature element: literal transform indicator between panes */
.connector {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  align-self: center;
  position: relative;
}

.connector-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.connector-badge svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-muted);
  transition: stroke 0.3s ease;
}

.connector::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(180deg, var(--source-dim), var(--target-dim));
  transform: translateX(-50%);
}

.connector.pulse .connector-badge {
  border-color: var(--source);
  box-shadow: 0 0 0 4px var(--source-dim);
}

.connector.pulse .connector-badge svg {
  stroke: var(--source);
}

/* ============================================================
   Footer
   ============================================================ */
.app-footer {
  text-align: center;
  padding: 1rem 0 0;
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .config-grid {
    grid-template-columns: 1fr;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .panes {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto 1fr;
  }

  .connector {
    width: 100%;
    height: 34px;
  }

  .connector::before {
    top: 50%;
    left: 0;
    right: 0;
    bottom: auto;
    width: auto;
    height: 1px;
    background: linear-gradient(90deg, var(--source-dim), var(--target-dim));
    transform: translateY(-50%);
  }

  .pane-source, .pane-target {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
  }

  .pane textarea {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

  .shell {
    padding: 1.25rem 1rem 2rem;
  }
}

@media (max-width: 560px) {
  .app-header {
    flex-wrap: wrap;
  }

  .converter-bar {
    flex-direction: column;
    align-items: stretch;
  }
}
