/* brief.darlison.com — minimal, readable, dark-mode-friendly */

:root {
  --bg: #fafaf7;
  --fg: #1a1a1a;
  --muted: #666;
  --border: #e0ddd5;
  --accent: #b95837;
  --section-bg: #ffffff;
  --button-bg: #1a1a1a;
  --button-fg: #ffffff;
  --button-hover: #b95837;
  /* Status colors are also used by the .target-green/.target-yellow/.target-red
     classes — they need to read as obviously colored text on white. */
  --status-green: #15803d;
  --status-yellow: #b45309;
  --status-red: #b91c1c;
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
  --radius: 6px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --fg: #e8e6e0;
    --muted: #999;
    --border: #333;
    --section-bg: #242424;
    --button-bg: #e8e6e0;
    --button-fg: #1a1a1a;
    --button-hover: #b95837;
    --status-green: #4ade80;
    --status-yellow: #facc15;
    --status-red: #f87171;
  }
}

* { box-sizing: border-box; }

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

.brief-header {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.brief-header h1 {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.byline {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
}

.brief-section {
  background: var(--section-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.section-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.regen-btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  background: var(--button-bg);
  color: var(--button-fg);
  border: none;
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.regen-btn:hover { background: var(--button-hover); color: #fff; }
.regen-btn:disabled { opacity: 0.5; cursor: wait; }

.section-body { padding: 20px; }

.section-body p,
.section-body ul,
.section-body ol { margin: 0 0 12px; }

.section-body p:last-child,
.section-body ul:last-child { margin-bottom: 0; }

.section-body ul,
.section-body ol { padding-left: 22px; }

.section-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 14px;
}

.section-body th,
.section-body td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.section-body th {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section-body td.right,
.section-body th.right { text-align: right; }

.section-body code,
.section-body kbd {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.placeholder {
  color: var(--muted);
  font-style: italic;
}

.htmx-indicator {
  display: none;
  padding: 4px 20px 0;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

.htmx-request .htmx-indicator { display: block; }
.htmx-request.htmx-indicator { display: block; }

.brief-footer {
  max-width: 980px;
  margin: 32px auto 24px;
  padding: 16px 24px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.muted { color: var(--muted); }

.error {
  color: var(--status-red);
  background: rgba(176, 48, 48, 0.06);
  border: 1px solid var(--status-red);
  padding: 12px;
  border-radius: var(--radius);
}

.cache-meta {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-size: 12px;
}

.cache-meta small { font-size: inherit; }

/* Section header: title + actions on the right. */
.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* "＋ Log" button next to Regenerate. Slightly smaller / lighter so the
   primary Regenerate action stays visually dominant. */
.log-btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.log-btn:hover {
  background: var(--section-bg);
  border-color: var(--accent);
  color: var(--accent);
}

/* Native <dialog> styling. Backdrop dims the page; box centers automatically. */
#log-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--section-bg);
  color: var(--fg);
  padding: 24px;
  max-width: 600px;
  width: calc(100% - 32px);
  max-height: 85vh;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  overflow: auto;
}

#log-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

#log-dialog .dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

#log-dialog h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

#log-dialog .log-help {
  margin: 4px 0 14px;
  font-size: 13px;
}

#log-dialog .log-tip {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
}

#log-dialog .log-tip kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

.dialog-close {
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}

.dialog-close:hover { color: var(--fg); }

/* Photo thumbnails inside the dialog. */
.photo-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.photo-thumb {
  position: relative;
  width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.photo-thumb img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.photo-thumb .photo-caption {
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  width: 100%;
}

/* The 📷 button shares styles with .voice-btn but doesn't get the
   listening animation. */
.photo-btn { font-size: 16px; }

#log-form textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  resize: vertical;
  box-sizing: border-box;
}

#log-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.log-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.log-controls .spacer { flex: 1; }

.voice-btn {
  font-family: var(--font-body);
  font-size: 18px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s ease;
  min-width: 40px;
  height: 32px;
}

.voice-btn:hover { background: var(--section-bg); }
.voice-btn.listening {
  background: var(--status-red);
  color: #fff;
  border-color: var(--status-red);
  font-size: 12px;
}
.voice-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.voice-status {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.log-spinner { font-size: 13px; color: var(--muted); }

#log-status:empty { display: none; }

.log-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  border: 1px solid;
}

.log-status.log-ok {
  color: var(--status-green);
  background: rgba(21, 128, 61, 0.06);
  border-color: var(--status-green);
}

.log-status.log-empty {
  color: var(--muted);
  background: rgba(0, 0, 0, 0.02);
  border-color: var(--border);
}

.log-status.log-err {
  color: var(--status-red);
  background: rgba(185, 28, 28, 0.06);
  border-color: var(--status-red);
}

.log-status ul {
  margin: 6px 0 0;
  padding-left: 22px;
}

.log-status li { margin: 2px 0; }

/* Scoreboard: status emoji prepended to the metric cell, smaller and slightly
   muted so the metric name is the dominant element. */
.section-body .status {
  font-size: 0.78em;
  margin-right: 5px;
  opacity: 0.9;
  vertical-align: 1px;
}

/* Scoreboard: target thresholds colored to match the green/yellow/red bands
   they describe — replaces the 🟢/🟡/🔴 emoji prefixes from the source.
   !important guards against any other rule that might set color on td. */
.section-body td .target-green,
.section-body .target-green  { color: var(--status-green)  !important; font-weight: 600; }
.section-body td .target-yellow,
.section-body .target-yellow { color: var(--status-yellow) !important; font-weight: 600; }
.section-body td .target-red,
.section-body .target-red    { color: var(--status-red)    !important; font-weight: 600; }
