/* Hallmark · almanac · genre editorial · hero: counter · nav: masthead rule, a wordmark and a language picker · footer: colophon, one line and a year · job convert */
/* Hallmark · pre-emit critique: P5 H4 E4 S5 R5 V4 · weakest E: the tool is the only ornament, which is the point */
/* Hallmark · nav: a wordmark and a language picker, nothing else · footer: one line and a year */
/* Hallmark · dismissed 77 · three sections, each with one job: the converter, three facts, three collapsed questions */
/* Hallmark · waive 44c · the painted column ends at 580px of a 900px window · the Markdown note lands beside the drop zone, so the converter stays above the fold */
/* Hallmark · waive 59 · the questions start 54px under the facts row · they are footnotes to the Markdown tool, not a second act */
/* Hallmark · waive 77 · three collapsed Markdown questions end the page · a taller band would add paper, not information */

:root {
  --paper: oklch(84% 0.012 245);
  --paper-2: oklch(88% 0.012 245);
  --sheet: oklch(94% 0.008 245);
  --ink: oklch(16% 0.020 245);
  --ink-2: oklch(42% 0.020 245);
  --rule: oklch(68% 0.014 245);
  --field-line: oklch(52% 0.020 245);
  --accent: oklch(45% 0.180 350);
  --accent-ink: oklch(97% 0.006 245);
  --shadow: 0 12px 30px -24px oklch(16% 0.02 245 / 0.5);
  --font-display: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Newsreader", ui-serif, Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
}

img, svg { max-width: 100%; height: auto; }

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

.skip {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus {
  position: fixed;
  left: 12px;
  top: 12px;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  z-index: 9;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: 13px;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- bar */

.bar {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}

.bar-in {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.lang {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang select {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--field-line);
  border-radius: 2px;
  min-height: 44px;
  padding: 0 12px;
  max-width: 46vw;
}

/* ---------------------------------------------------------------- tool */

.tool {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 8px;
}

h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 7vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
  margin: 0 0 12px;
}

.sub {
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(1rem, 3.4vw, 1.15rem);
  color: var(--ink-2);
  margin: 0 0 24px;
}

.card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 8px 16px 16px;
  box-shadow: 0 1px 0 var(--rule), var(--shadow);
}

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--rule);
  margin: 0 -16px 16px;
  padding: 0 12px;
}

.tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 16px 12px;
  min-height: 44px;
  cursor: pointer;
  white-space: nowrap;
}

.tabs button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.tabs button:active { color: var(--accent); }

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 172px;
  padding: 24px;
  border: 1px dashed var(--rule);
  border-radius: 2px;
  background: var(--paper);
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.drop:hover,
.drop.is-over {
  border-color: var(--accent);
  background: var(--paper-2);
}

.drop:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.drop:active { border-color: var(--accent); }

.drop strong {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.drop span {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-2);
}

.status {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-2);
  min-height: 20px;
  margin: 16px 0 0;
}

.status.is-error { color: var(--accent); }

.meter {
  height: 2px;
  background: var(--rule);
  margin-top: 12px;
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 400ms ease;
}

textarea {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 12px;
  resize: vertical;
}

.btn {
  appearance: none;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  padding: 0 16px;
  min-height: 44px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--accent-ink);
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}

.btn:active { color: var(--accent); }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.paste-row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.result {
  margin-top: 16px;
  border-top: 1px solid var(--rule);
  padding-top: 16px;
}

.result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.result-name {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-2);
}

.acts { display: flex; gap: 8px; }

pre {
  margin: 0;
  max-height: 340px;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------------------------------------------------------------- facts + faq */

.facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 16px 0 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-2);
}

.facts li::before {
  content: "·";
  color: var(--accent);
  margin-inline-end: 8px;
}

.faq {
  max-width: 760px;
  margin: 48px auto 0;
  padding: 0 20px 32px;
}

.faq details {
  border-top: 1px solid var(--rule);
  padding: 4px 0;
}

.faq details:last-of-type { border-bottom: 1px solid var(--rule); }

@media (min-width: 640px) {
  .faq {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 24px;
  }
  .faq details {
    border-bottom: 1px solid var(--rule);
    padding-bottom: 8px;
  }
}

.faq summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.98rem;
  padding: 12px 0;
  min-height: 44px;
  list-style: none;
}

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

.faq summary::after {
  content: "+";
  float: inline-end;
  font-family: var(--font-display);
  color: var(--accent);
}

.faq details[open] summary::after { content: "−"; }

.faq p {
  margin: 0 0 16px;
  font-size: 0.95rem;
  color: var(--ink-2);
  max-width: 58ch;
}

/* ---------------------------------------------------------------- foot */

.foot {
  border-top: 1px solid var(--rule);
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 20px 40px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-2);
}

.foot p { margin: 0; }

/* ---------------------------------------------------------------- rtl */

html[dir="rtl"] { --font-display: "Noto Naskh Arabic", "Segoe UI", sans-serif; --font-body: "Noto Naskh Arabic", "Segoe UI", serif; }
html[dir="rtl"] body { line-height: 1.8; }
html[dir="rtl"] .meter i { transform-origin: right center; }

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

@media (max-width: 560px) {
  .tool { padding-top: 28px; }
  .card { padding: 4px 12px 12px; }
  .tabs { margin-inline: -12px; }
  .facts { font-size: 13px; gap: 8px 12px; }
  .foot { flex-direction: column; gap: 8px; }
}
