/* Fonts (OFL) — see fonts/LICENSE.md */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/InterVariable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'iA Writer Mono';
  src: url('../fonts/iAWriterMonoS-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'iA Writer Mono';
  src: url('../fonts/iAWriterMonoS-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper:        #F7F7F7;
  --card:         #FFFFFF;
  --rule:         #EAEAEA;
  --rule-soft:    #F0F0F0;
  --ink:          #222222;
  --ink-muted:    #555555;
  --ink-subtle:   #888888;
  --accent:       #0080FF;
  --accent-label: #00A3FF;
  --accent-bg:    #E8F2FF;
  --accent-ring:  rgba(0, 128, 255, 0.18);

  --shadow-card:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.04),
    0 12px 32px rgba(0, 0, 0, 0.04);

  --r-sm: 6px;
  --r-md: 8px;
  --r-pill: 999px;

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'iA Writer Mono', ui-monospace, 'SF Mono', Menlo, Monaco, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 450;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 24px;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.page-header {
  margin-bottom: 24px;
  flex-shrink: 0;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent-label);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.page-header h1 {
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.4px;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 10px;
}


/* Single full-width workspace */
.container {
  display: flex;
  flex: 1;
  min-height: 0;
}

.box {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 22px;
  margin-bottom: 12px;
}

.section-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent-label);
  text-transform: uppercase;
}

.copy-flash {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 2px 10px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: var(--r-pill);
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Card chrome — the whole surface is the drop target */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Output pane — iA Writer Mono, the writing surface */
.output-content {
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 24px 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  background: transparent;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
}

/* Empty state fills the surface so it reads as a big drop zone. */
.output-content:empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.output-content:empty::before {
  content: 'Paste anywhere · ⌘V';
  color: var(--ink-subtle);
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* Footer */
.page-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--ink-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.page-footer a {
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.page-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.page-footer .dot {
  color: var(--ink-subtle);
}

/* Responsive — single column on narrow viewports */
@media (max-width: 720px) {
  .page {
    padding: 24px 18px 18px;
  }

  .page-header {
    margin-bottom: 18px;
  }

  .page-header h1 {
    font-size: 24px;
  }


  .output-content:empty::before {
    font-size: 15px;
  }
}

/* From / To selectors: one row each, hint right after the pills. */
.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

/* Each row is its own grid, so a long hint wraps beside its pills. */
.control-row {
  display: grid;
  grid-template-columns: 36px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 14px;
}

.control-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent-label);
  text-transform: uppercase;
  min-width: 36px;
}

.pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
}

.pill {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 550;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  border-radius: var(--r-pill);
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.pill:hover { color: var(--ink); }

.pill[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

.pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.hint {
  font-size: 13px;
  color: var(--ink-subtle);
}

/* "From" is automatic and secondary: a soft tint instead of solid blue,
   dimmed until there is a paste to re-read. */
.pills-from .pill[aria-pressed="true"] {
  background: var(--accent-bg);
  color: var(--accent);
}

.pill:disabled {
  cursor: default;
  opacity: 0.45;
}

.pill:disabled:hover { color: var(--ink-muted); }

/* Rich text preview renders like a Gmail compose body. */
.output-content.is-rich {
  font-family: Arial, Helvetica, sans-serif;
  font-size: small;
  line-height: normal;
  white-space: normal;
  color: #222;
}

.output-content.is-rich a { color: #1155CC; }
.output-content.is-rich :is(h1, h2, h3, h4, h5, h6) { margin: 0.8em 0 0.3em; line-height: 1.25; }
.output-content.is-rich > :is(h1, h2, h3, h4, h5, h6):first-child { margin-top: 0; }
.output-content.is-rich ul,
.output-content.is-rich ol { padding-left: 40px; }
.output-content.is-rich table { border-collapse: collapse; }
.output-content.is-rich td,
.output-content.is-rich th { padding: 6px; }

.output-content.is-text {
  font-family: var(--font-sans);
  font-size: 14px;
}

@media (max-width: 720px) {
  .controls { margin-bottom: 16px; }
  .pill { padding: 6px 11px; }
}

.copy-flash.is-error {
  background: #FFECEC;
  color: #C0392B;
}

.copy-flash { white-space: nowrap; }

@media (max-width: 480px) {
  /* Labels sit above full-width pill groups: From in three columns, To in a 2×2 grid. */
  .controls { gap: 14px; }
  .control-row { grid-template-columns: 1fr; gap: 6px; }
  .pills {
    display: grid;
    border-radius: 18px;
  }
  .pills-from,
  .pills:not(.pills-from) { grid-template-columns: repeat(3, 1fr); }
  .pill { padding: 6px 8px; }
  .page-footer .dot { display: none; }
}

/* On short or narrow screens the header and controls leave too little room for
   a fixed-height card, so let the page scroll and give the card a usable height. */
@media (max-width: 480px), (max-height: 600px) {
  html, body { overflow: auto; }
  .page { height: auto; min-height: 100vh; }
  .card { min-height: 60vh; flex: none; }
}
