/* ---------------------------------------------------------------
   Design tokens
   Light, editorial, system-native — modeled after Apple Support's
   language: white surfaces, a single blue accent, and type doing
   almost all of the work.
------------------------------------------------------------------ */
:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --surface-sunken: #f5f5f7;
  --border: #d2d2d7;
  --border-soft: #e8e8ed;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-wash: #f0f7ff;
  --danger: #ff3b30;
  --success: #1c8a3e;

  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius-pill: 980px;
  --radius-card: 18px;
  --radius-control: 12px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.06), 0 16px 32px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---------------------------------------------------------------
   Nav
------------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  height: 52px;
  background: rgba(251, 251, 253, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-soft);
}

.site-header .brand {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.site-header .brand:hover { text-decoration: none; }

.site-header nav { display: flex; align-items: center; gap: 1.5rem; }
.site-header nav a { color: var(--text-secondary); font-size: 0.85rem; }
.site-header nav a:hover { color: var(--text); text-decoration: none; }

/* ---------------------------------------------------------------
   Layout
------------------------------------------------------------------ */
.container {
  max-width: 692px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.wide { max-width: 980px; }

/* ---------------------------------------------------------------
   Hero + search (forum home)
------------------------------------------------------------------ */
.hero {
  text-align: center;
  padding: 4.5rem 1.5rem 3.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.eyebrow {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.5rem, 5.5vw, 3.75rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 1.75rem;
}

.search-form { max-width: 560px; margin: 0 auto; position: relative; }

.search-form input[type="search"] {
  width: 100%;
  padding: 1.05rem 1.5rem 1.05rem 3.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1.05rem;
  color: var(--text);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.search-form input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
}

.search-form svg {
  position: absolute;
  left: 1.3rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  pointer-events: none;
}

/* ---------------------------------------------------------------
   Article cards / grid
------------------------------------------------------------------ */
.section-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  margin: 0 0 1.5rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.article-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border);
}

.article-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.6rem;
  letter-spacing: -0.005em;
}

.article-card .same-problem-count {
  display: block;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 3rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
}

/* ---------------------------------------------------------------
   Article detail
------------------------------------------------------------------ */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }

.article-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 0.75rem;
}

.article-meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border-soft);
}

.article-body { font-size: 1.05rem; line-height: 1.7; }
.article-body h2 { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; margin: 2.2rem 0 0.9rem; letter-spacing: -0.01em; }
.article-body h3 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; margin: 1.8rem 0 0.7rem; }
.article-body p { margin: 0 0 1.1rem; }
.article-body ul, .article-body ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
.article-body li { margin-bottom: 0.4rem; }
.article-body code {
  font-family: var(--font-mono);
  background: var(--surface-sunken);
  padding: 0.15em 0.4em;
  border-radius: 5px;
  font-size: 0.88em;
}
.article-body pre {
  background: #1d1d1f;
  color: #f5f5f7;
  padding: 1.25rem;
  border-radius: var(--radius-control);
  overflow-x: auto;
  margin: 0 0 1.25rem;
}
.article-body pre code { background: none; padding: 0; color: inherit; }
.article-body blockquote {
  margin: 0 0 1.1rem;
  padding-left: 1rem;
  border-left: 3px solid var(--border);
  color: var(--text-secondary);
}

/* ---------------------------------------------------------------
   CTA cards (same-problem / discord)
------------------------------------------------------------------ */
.cta-stack { display: grid; gap: 1rem; margin-top: 3rem; }

.cta-card {
  background: var(--surface-sunken);
  border-radius: var(--radius-card);
  padding: 1.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.cta-card.accent { background: var(--accent-wash); }

.cta-card h4 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.3rem;
}

.cta-card p { margin: 0; color: var(--text-secondary); font-size: 0.92rem; }
.cta-card .cta-copy { flex: 1; min-width: 220px; }

.success-banner {
  background: #eafaf0;
  color: var(--success);
  border-radius: var(--radius-control);
  padding: 0.9rem 1.25rem;
  font-size: 0.92rem;
  margin-bottom: 1.5rem;
}

/* ---------------------------------------------------------------
   Buttons & forms (shared by forum + admin)
------------------------------------------------------------------ */
.button, button, input[type="submit"] {
  font-family: var(--font-body);
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.button:hover, button:hover, input[type="submit"]:hover { background: var(--accent-hover); text-decoration: none; }
.button:active, button:active { transform: scale(0.98); }

.button.secondary, button.secondary {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
}
.button.secondary:hover, button.secondary:hover { background: var(--accent-wash); }

button.danger { background: var(--danger); }
button:disabled { background: var(--border); color: var(--text-secondary); cursor: not-allowed; }

label {
  display: block;
  margin-bottom: 1.1rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 500;
}

input[type="text"], input[type="number"], textarea {
  width: 100%;
  margin-top: 0.4rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 0.65rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
}

input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

/* ---------------------------------------------------------------
   Admin
------------------------------------------------------------------ */
.admin-nav { display: flex; gap: 0.75rem; margin: 1.5rem 0 2.5rem; }
.admin-nav a {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  padding: 0.5rem 1.1rem;
  font-size: 0.88rem;
  color: var(--text);
}
.admin-nav a:hover { border-color: var(--accent); text-decoration: none; }

.back-link { display: inline-block; margin-bottom: 1.25rem; font-size: 0.88rem; }

.toolbar-row { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 1.5rem; }

.strip-identity-form { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--accent); }

.page-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2rem;
  letter-spacing: -0.015em;
  margin: 0 0 0.5rem;
}

.status-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
}

.list-plain { list-style: none; padding: 0; margin: 0 0 2.5rem; }
.list-plain li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.95rem;
}
.list-plain li:last-child { border-bottom: none; }
.list-plain .meta-inline { color: var(--text-secondary); font-size: 0.85rem; white-space: nowrap; }

.row-actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.row-actions form { display: inline-block; }
.button.small, button.small { padding: 0.4rem 0.9rem; font-size: 0.82rem; }

fieldset {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}
legend { padding: 0 0.5rem; color: var(--text); font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; }

.hint-text { color: var(--text-secondary); font-size: 0.85rem; margin: -0.75rem 0 1rem; }

.transcript { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: 0.9rem; }
.transcript-message {
  position: relative;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 1.1rem 1.25rem 1.1rem 2.5rem;
  background: var(--surface);
}
.transcript-message.deleted { opacity: 0.5; }
.transcript-message.dragging { opacity: 0.35; border-style: dashed; }
.transcript-message .meta { display: flex; gap: 0.75rem; align-items: baseline; color: var(--text-secondary); font-size: 0.8rem; margin-bottom: 0.75rem; }

.drag-handle {
  position: absolute;
  left: 0.6rem;
  top: 1.15rem;
  color: var(--text-secondary);
  cursor: grab;
  font-size: 1.1rem;
  line-height: 1;
  user-select: none;
}
.drag-handle:active { cursor: grabbing; }

.manual-tag {
  background: var(--accent-wash);
  color: var(--accent);
  border-radius: var(--radius-pill);
  padding: 0.1rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
}

.insert-message-form {
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
  padding: 1.25rem;
  margin-bottom: 2.5rem;
  display: grid;
  gap: 0.6rem;
}
.edit-message-form { display: grid; gap: 0.6rem; margin-bottom: 0.6rem; }
.edit-message-form .name-row { display: flex; gap: 0.6rem; align-items: center; }
.edit-message-form .name-row input { margin-top: 0; }
.edit-message-form .name-row label { margin: 0; white-space: nowrap; font-size: 0.8rem; }
.transcript-message > form.inline { display: inline-block; }
.transcript-actions { display: flex; gap: 0.6rem; }
.deleted-notice { color: var(--text-secondary); font-style: italic; margin: 0; }

.publish-form, .settings-form { margin-top: 1rem; }

.error { color: var(--danger); }
.success { color: var(--success); }

/* ---------------------------------------------------------------
   Discord-style conversation preview (admin only)
------------------------------------------------------------------ */
.discord-shell {
  background: #313338;
  min-height: 100vh;
  font-family: "gg sans", var(--font-body);
  color: #dbdee1;
}

.discord-shell .discord-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #26282c;
  background: #313338;
  position: sticky;
  top: 0;
}

.discord-shell .discord-header .hash { color: #80848e; font-size: 1.4rem; font-weight: 600; }
.discord-shell .discord-header .chan-name { color: #f2f3f5; font-weight: 600; font-size: 1rem; }
.discord-shell .discord-header a { color: #949ba4; font-size: 0.82rem; margin-left: auto; }

.discord-log { max-width: 780px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

.discord-msg {
  display: flex;
  gap: 1rem;
  padding: 0.15rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.1rem;
}
.discord-msg:hover { background: #2e3035; }

.discord-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: 0 0 40px;
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: white;
  object-fit: cover;
}

.discord-body { min-width: 0; }
.discord-meta { display: flex; align-items: baseline; gap: 0.55rem; }
.discord-username { font-weight: 600; font-size: 0.98rem; color: #f2f3f5; }
.discord-timestamp { font-size: 0.72rem; color: #949ba4; }
.discord-edited { font-size: 0.68rem; color: #949ba4; }

.discord-content { font-size: 0.98rem; line-height: 1.45; color: #dbdee1; white-space: pre-wrap; word-wrap: break-word; }

.discord-msg.deleted-msg .discord-content {
  color: #80848e;
  font-style: italic;
}

.discord-attachments { margin-top: 0.4rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }

.discord-attachment-image {
  max-width: 360px;
  max-height: 300px;
  border-radius: 8px;
  display: block;
  border: 1px solid #26282c;
}

.discord-attachment-file {
  display: inline-block;
  color: #00a8fc;
  background: #2b2d31;
  border: 1px solid #3f4248;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
}
.discord-attachment-file:hover { text-decoration: none; background: #34363b; }

/* ---------------------------------------------------------------
   Discord conversation modal
------------------------------------------------------------------ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.modal-overlay.open { display: flex; }

.modal-panel {
  background: #313338;
  border-radius: 14px;
  width: min(880px, 100%);
  height: min(640px, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.modal-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.1rem;
  padding: 0.6rem 0.9rem;
  background: #2b2d31;
  border-bottom: 1px solid #26282c;
  flex: 0 0 auto;
}

.modal-newtab { color: #949ba4; font-size: 0.82rem; }
.modal-newtab:hover { color: #f2f3f5; text-decoration: none; }

.modal-close {
  background: none;
  border: none;
  color: #949ba4;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.5rem;
  border-radius: 6px;
}
.modal-close:hover { background: #3f4248; color: #f2f3f5; }

.modal-iframe { border: none; flex: 1; width: 100%; }

@media (max-width: 640px) {
  .hero { padding: 3rem 1rem 2.5rem; }
  .container { padding: 2rem 1.25rem 3.5rem; }
}
