/* daily.dev-aligned tokens. Orange/coral primary on a dark base. */

:root {
  --bg: #0e1217;
  --bg-elev: #161b22;
  --fg: #e6e9ef;
  --fg-muted: #99a3b3;
  --accent: #ff7300;
  --accent-hover: #ff8a26;
  --accent-ink: #1a0e00;
  --border: #2a313c;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

header { margin-bottom: 2rem; }

h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.tagline {
  font-size: 1.05rem;
  color: var(--fg-muted);
  margin: 0;
}

code {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

label {
  font-size: 0.95rem;
  color: var(--fg-muted);
}

input[type="text"] {
  padding: 0.7rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 1rem;
  font-family: inherit;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  padding: 0.7rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover { background: var(--accent-hover); }

.examples {
  margin-top: 2rem;
  font-size: 0.95rem;
  color: var(--fg-muted);
}

.examples a {
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.examples a:hover {
  border-color: var(--accent);
}

footer {
  margin-top: 3rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-align: center;
}

footer a {
  color: var(--fg-muted);
}

/* Pack page */

main.pack {
  max-width: 760px;
}

main.pack h1 {
  font-size: 1.8rem;
  margin: 0;
}

main.pack h1 a {
  color: var(--accent);
  text-decoration: none;
}

main.pack h2 {
  font-size: 1.15rem;
  margin: 2rem 0 0.75rem;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.tagline {
  color: var(--fg-muted);
  margin: 0.25rem 0 1rem;
  font-size: 0.95rem;
}

.chips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--fg);
}

.chip a {
  color: var(--accent);
  text-decoration: none;
}

.chip .count {
  color: var(--fg-muted);
  font-size: 0.75rem;
}

.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.article {
  padding: 1rem 1.2rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.article h3 {
  font-size: 1rem;
  margin: 0 0 0.4rem;
  font-weight: 600;
}

.article h3 a {
  color: var(--fg);
  text-decoration: none;
}

.article h3 a:hover {
  color: var(--accent);
}

.article .summary {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.4;
}

.article .meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.article .meta .freq {
  color: var(--accent);
}

.article .meta .source a {
  color: var(--fg-muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
}

.degraded {
  padding: 1rem 1.2rem;
  background: var(--bg-elev);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.degraded h2 {
  margin-top: 0;
}

/* Streaming-render loading placeholder. A <style>.loading-pack{display:none}
   </style> chunk is appended once the daily.dev data arrives, hiding this
   placeholder retroactively. No JS needed. */
.loading-pack {
  margin: 1.5rem 0;
  padding: 0.9rem 1.2rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.loading-pack-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: loading-pack-spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes loading-pack-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .loading-pack-spinner { animation: none; }
}

/* Client-rendered section stagger. Each <section> added by pack.js gets
   .fade-in; CSS nth-child delays create a "loading one by one" cascade. */

.fade-in {
  animation: fade-in 0.35s ease-out backwards;
}

[data-pack-content] > .fade-in:nth-child(1) { animation-delay: 0ms; }
[data-pack-content] > .fade-in:nth-child(2) { animation-delay: 120ms; }
[data-pack-content] > .fade-in:nth-child(3) { animation-delay: 240ms; }
[data-pack-content] > .fade-in:nth-child(4) { animation-delay: 360ms; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in { animation: none; }
}

.apply {
  margin-top: 2.5rem;
  padding: 1.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.apply form {
  background: transparent;
  border: none;
  padding: 0;
  margin: 1rem 0 0.5rem;
}

.apply input[type="password"] {
  padding: 0.6rem 0.8rem;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.apply input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
}

.apply .note {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin: 0.5rem 0 0;
}

.apply .note a {
  color: var(--fg-muted);
}

/* Apply-result page — /pack/<u>/apply response */

main.apply-result {
  max-width: 640px;
}

main.apply-result .pack-header {
  margin-bottom: 1rem;
}

main.apply-result h1 {
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

main.apply-result > p {
  color: var(--fg-muted);
  font-size: 0.95rem;
  margin: 0 0 1.5rem;
}

main.apply-result > p a {
  color: var(--accent);
  text-decoration: none;
}

main.apply-result > p a:hover {
  text-decoration: underline;
}

.step-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.step-list li {
  padding: 0.6rem 0.9rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font-mono);
}

.step-list li.ok {
  border-left-color: var(--accent);
  color: var(--fg);
}

.step-list li.fail {
  border-left-color: #d8513a;
  color: var(--fg-muted);
}

.step-list .mark {
  display: inline-block;
  width: 1.2em;
  font-weight: 700;
}

.step-list li.ok .mark { color: var(--accent); }
.step-list li.fail .mark { color: #d8513a; }

.step-list .reason {
  color: var(--fg-muted);
  font-size: 0.8rem;
  margin-left: 0.4rem;
  word-break: break-word;
}

.back-link {
  margin: 0;
  font-size: 0.9rem;
}

.back-link a {
  color: var(--accent);
  text-decoration: none;
}

.back-link a:hover {
  text-decoration: underline;
}
