:root {
  color-scheme: light;
  --ink: #18211d;
  --muted: #66736c;
  --paper: #f4f5ef;
  --surface: #ffffff;
  --line: #cfd6d0;
  --line-strong: #9eaaa3;
  --accent: #006b57;
  --accent-dark: #004f41;
  --accent-soft: #dcefe8;
  --signal: #d5a11e;
  --danger: #a03a32;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(0, 107, 87, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(0, 107, 87, 0.045) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font-family: "Aptos", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
textarea { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; }

.site-header,
main,
footer {
  width: min(1240px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  min-height: 76px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid var(--line-strong);
}

.brand {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  color: var(--accent);
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 1px;
}

nav { display: flex; align-items: stretch; gap: 28px; align-self: stretch; }

nav a {
  display: grid;
  place-items: center;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

nav a:hover,
nav a.active { color: var(--ink); border-bottom-color: var(--accent); }

.service-state {
  display: flex;
  justify-content: end;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border: 1px solid var(--muted);
  border-radius: 50%;
  background: transparent;
}

.status-dot.online { border-color: var(--accent); background: var(--accent); }
.status-dot.offline { border-color: var(--danger); background: var(--danger); }

.intro {
  min-height: 170px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  padding-block: 34px 24px;
}

h1,
p { margin: 0; }

h1 {
  font-family: Georgia, serif;
  font-size: clamp(3rem, 7vw, 5.6rem);
  font-weight: 500;
  line-height: 0.95;
}

.eyebrow,
.detail-label {
  margin-bottom: 9px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.intro-note { color: var(--muted); font-size: 0.82rem; }

.translator {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: 8px 8px 0 var(--accent-soft);
}

.language-bar {
  min-height: 58px;
  display: grid;
  grid-template-columns: 1fr 58px 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.language-label {
  padding-inline: 22px;
  font-family: Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
}

.language-label-right { text-align: right; }

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink);
  background: var(--surface);
  font-size: 1.2rem;
  cursor: pointer;
}

.icon-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.icon-button:disabled { cursor: not-allowed; opacity: 0.35; }

.swap-button { justify-self: center; }

.editor-grid { display: grid; grid-template-columns: 1fr 1fr; }

.editor-pane { min-width: 0; }
.source-pane { border-right: 1px solid var(--line); }
.output-pane { background: #fbfcfa; }

textarea {
  width: 100%;
  height: 235px;
  min-height: 235px;
  display: block;
  resize: vertical;
  border: 0;
  padding: 25px 24px;
  color: var(--ink);
  background: transparent;
  font-size: 1.15rem;
  line-height: 1.65;
  outline: 0;
}

#output-text {
  font-family: Georgia, "Times New Roman", serif;
  overflow-wrap: anywhere;
}

textarea::placeholder { color: #929d96; }
textarea:focus { box-shadow: inset 0 0 0 2px var(--accent); }

.pane-footer {
  min-height: 55px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 14px 9px 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
}

.action-row {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 16px 14px 22px;
  border-top: 1px solid var(--line-strong);
}

.diagnostic { color: var(--muted); font-size: 0.86rem; line-height: 1.4; }
.diagnostic.warning { color: #775806; }
.diagnostic.error { color: var(--danger); }

.primary-button {
  min-width: 142px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.primary-button:hover:not(:disabled) { border-color: var(--accent-dark); background: var(--accent-dark); }
.primary-button:disabled { cursor: wait; opacity: 0.7; }

button:focus-visible,
a:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }

.details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 34px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.details > div { min-width: 0; padding: 22px 0; }
.details > div + div { padding-left: 24px; border-left: 1px solid var(--line); }
.details p:last-child { overflow-wrap: anywhere; font-size: 0.9rem; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-block: 28px 42px;
  color: var(--muted);
  font-size: 0.8rem;
}

footer a { text-underline-offset: 3px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .site-header,
  main,
  footer { width: min(100% - 24px, 1240px); }

  .site-header {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  nav { display: none; }
  .intro { min-height: 170px; padding-block: 34px 24px; }
  .intro-note { display: none; }
  .translator { box-shadow: 5px 5px 0 var(--accent-soft); }
  .editor-grid { grid-template-columns: 1fr; }
  .source-pane { border-right: 0; border-bottom: 1px solid var(--line-strong); }
  textarea { height: 140px; min-height: 140px; }
  .action-row { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .details { grid-template-columns: 1fr; }
  .details > div + div { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .translator { animation: enter 320ms ease-out both; }
  @keyframes enter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

.output-actions { display: flex; gap: 8px; }