/* README Roast — dark, terminal, "2am" theme (from Claude Design v2). */

/* committed dark: the "2am" identity is dark for everyone, regardless of the
   OS light/dark preference (no auto-switch to light). */
:root {
  color-scheme: dark;
  --bg: #0c0b0a;
  --bg-2: #10130f;
  --bg-3: #161a14;
  --fg: #e6ebe3;
  --muted: #7f8a7c;
  --border: #232a20;

  /* ===== THEME ACCENT — swap these two to change the whole vibe =====
     terminal green (current):  #3fe06b  /  rgba(63,224,107,.12)
     ember orange (previous):   #ff7a2f  /  rgba(255,122,47,.12)
     to revert to orange: put the orange values back here AND in the
     favicon fill in index.html (%233fe06b -> %23ff7a2f). that's the change. */
  --accent: #3fe06b;
  --accent-weak: rgba(63,224,107,.12);

  --danger: #ff6b6b;
  --btn-fg: #0b120c;            /* text on the accent button */
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 12px;
}

/* optional light theme — opt-in via the toggle (default stays dark). */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7f3;
  --bg-2: #ffffff;
  --bg-3: #edf0ea;
  --fg: #14180f;
  --muted: #5c6656;
  --border: #d9dfd3;
  --accent: #1f9d4d;           /* darker green, readable on light */
  --accent-weak: rgba(31,157,77,.12);
  --btn-fg: #ffffff;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0; min-height: 100vh;
  background:
    radial-gradient(900px 420px at 50% -8%, var(--accent-weak), transparent 70%),
    var(--bg);
  color: var(--fg); font-family: var(--mono); line-height: 1.55;
  padding: clamp(28px, 6vw, 72px) 20px 40px; display: flex; justify-content: center;
  text-transform: lowercase;
}
main { width: 100%; max-width: 680px; display: flex; flex-direction: column; }

/* ---- hero: terminal prompt ---- */
.prompt { color: var(--muted); font-size: 0.85rem; margin: 0 0 10px; }
.prompt .accent { color: var(--accent); }
h1 {
  margin: 0; font-family: var(--mono); font-size: clamp(2.1rem, 7.5vw, 3.2rem);
  font-weight: 700; letter-spacing: 0; line-height: 1.05;
}
.tagline { margin: 12px 0 0; font-size: 0.98rem; color: var(--accent); }
.tagline .cursor {
  display: inline-block; width: 0.55ch; background: var(--accent);
  margin-left: 1px; animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.blurb { margin: 14px 0 26px; max-width: 54ch; color: var(--muted); font-size: 0.95rem; }
.blurb em { font-style: normal; color: var(--fg); }

/* ---- input as hero ---- */
.bar {
  display: flex; align-items: stretch; gap: 0;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: border-color .15s, box-shadow .15s;
}
.bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.bar .caret { display: flex; align-items: center; padding: 0 4px 0 16px; color: var(--accent); font-weight: 700; }
#url {
  flex: 1 1 auto; min-width: 0; padding: 16px 12px; font-size: 1rem; font-family: var(--mono);
  color: var(--fg); background: transparent; border: none; outline: none; text-transform: lowercase;
}
#url::placeholder { color: var(--muted); }
#submit {
  padding: 0 24px; font-weight: 700; border: none; cursor: pointer; color: var(--btn-fg);
  background: var(--accent); font-family: var(--mono); font-size: 0.95rem; text-transform: lowercase;
  transition: filter .15s, opacity .15s;
}
#submit:hover { filter: brightness(1.06); }
#submit:disabled { opacity: .55; cursor: default; }

/* ---- collapsible options ---- */
.options { margin-top: 14px; }
.options > summary {
  display: inline-flex; align-items: center; gap: 6px; width: max-content; cursor: pointer;
  list-style: none; font-size: 0.8rem; color: var(--muted); user-select: none;
}
.options > summary::-webkit-details-marker { display: none; }
.options > summary::before { content: "▸"; font-size: 0.8em; transition: transform .15s; }
.options[open] > summary::before { transform: rotate(90deg); }
.options > summary:hover { color: var(--accent); }
.controls { display: flex; flex-wrap: wrap; gap: 20px 40px; margin-top: 14px; }
.ctrl { flex: 1 1 230px; display: flex; flex-direction: column; gap: 8px; }
.ctrl-head { font-size: 0.8rem; color: var(--muted); }
.ctrl-head b { color: var(--accent); font-weight: 700; }
.ctrl input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 3px; border-radius: 999px;
  background: var(--border); cursor: pointer;
}
.ctrl input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
}
.ctrl input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.ctrl input[type="range"]:focus { outline: none; }
.ctrl input[type="range"]:focus::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent-weak); }
.ticks { display: flex; justify-content: space-between; font-size: 0.68rem; color: var(--muted); }

/* ---- status ---- */
.status { margin: 18px 2px 0; color: var(--muted); font-size: 0.88rem; }
.status.error { color: var(--danger); }
.status.loading::after {
  content: ""; animation: dots 1.4s steps(4, end) infinite;
}
@keyframes dots {
  0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; }
}

/* ---- result: styled like a README.md file ---- */
#result { margin-top: 30px; }
.file { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.file-tab {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--bg-3); border-bottom: 1px solid var(--border);
}
.dots { display: flex; gap: 6px; flex: 0 0 auto; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.filename { font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filename .repo { color: var(--fg); }
.file-actions { margin-left: auto; display: flex; gap: 8px; flex: 0 0 auto; }
.ghost {
  padding: 5px 11px; font-size: 0.78rem; color: var(--accent); background: transparent;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-family: var(--mono);
  text-transform: lowercase; white-space: nowrap;
}
.ghost:hover { background: var(--accent-weak); }
.ghost[aria-pressed="true"] { background: var(--accent-weak); }

/* original markdown, revealed below the roast inside the same file card */
.original {
  margin: 0; padding: 18px 22px; border-top: 1px dashed var(--border);
  background: var(--bg); color: var(--muted); font-family: var(--mono);
  font-size: 0.85rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
  text-transform: none;
}

/* ---- rendered markdown (roasted output) ---- */
.rendered { padding: 22px; font-family: var(--sans); font-size: 1rem; line-height: 1.62; text-transform: none; }
.rendered > :first-child { margin-top: 0; }
.rendered > :last-child { margin-bottom: 0; }
.rendered h1, .rendered h2, .rendered h3, .rendered h4 { line-height: 1.25; letter-spacing: -0.01em; margin: 1.4em 0 0.5em; font-family: var(--sans); }
.rendered h1 { font-size: 1.6rem; }
.rendered h2 { font-size: 1.25rem; padding-bottom: 0.2em; border-bottom: 1px solid var(--border); }
.rendered h3 { font-size: 1.08rem; }
.rendered h4 { font-size: 1rem; }
.rendered p { margin: 0.7em 0; }
.rendered ul, .rendered ol { margin: 0.7em 0; padding-left: 1.4em; }
.rendered li { margin: 0.25em 0; }
.rendered a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.rendered strong { font-weight: 700; }
.rendered em { font-style: italic; }
.rendered code { font-family: var(--mono); font-size: 0.88em; background: var(--accent-weak); padding: 0.12em 0.4em; border-radius: 5px; }
.rendered pre.code { margin: 0.9em 0; padding: 14px 16px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; }
.rendered pre.code code { background: none; padding: 0; font-size: 0.85rem; line-height: 1.5; }
.rendered blockquote { margin: 0.9em 0; padding: 0.2em 0 0.2em 1em; border-left: 3px solid var(--border); color: var(--muted); }
.rendered hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }
.rendered img { max-width: 100%; vertical-align: middle; }

/* ---- footer ---- */
footer { margin-top: 42px; color: var(--muted); font-size: 0.76rem; }
footer .accent { color: var(--accent); }

/* ---- theme toggle ---- */
.theme-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 10;
  padding: 6px 12px; font-family: var(--mono); font-size: 0.78rem; text-transform: lowercase;
  color: var(--muted); background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer; transition: color .15s, border-color .15s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
