﻿/* ============================================================
   NOOKS — Main Stylesheet
   Theme: Google-ish Light
   Fonts: Roboto Slab + Roboto
   ============================================================ */

/* Google Fonts removed — using system fonts */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:          #f8f9fa;
  --bg-surface:  #ffffff;
  --bg-raised:   #f1f3f4;
  --bg-hover:    #e8eaed;
  --border:      #dadce0;
  --text:        #202124;
  --text-muted:  #5f6368;
  --text-dim:    #80868b;
  --accent:      #1a73e8;
  --accent-dim:  #1557b0;
  --accent-light:#e8f0fe;
  --accent-glow: rgba(26,115,232,0.12);
  --danger:      #d93025;
  --success:     #1e8e3e;
  --warning:     #f9ab00;
  --radius:      8px;
  --radius-sm:   4px;
  --shadow:      0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md:   0 2px 6px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.10);
  --shadow-sm:   0 1px 2px rgba(0,0,0,0.10);
  --sidebar-w:   220px;
  --right-w:     220px;
  --header-h:    64px;
  --font-head:   Georgia, 'Times New Roman', serif;
  --font-body:   system-ui, -apple-system, 'Segoe UI', sans-serif;
  --transition:  0.15s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; overflow-x: hidden; height: 100%; max-width: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100%;
  overflow-x: hidden;
  max-width: 100%;
}
/* Lock scroll on pages using app-shell layout */
body.has-app-shell { height: 100%; overflow: hidden; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-dim); text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea {
  font-family: var(--font-body);
  font-size: 14px;
  color: inherit;
}
button { cursor: pointer; }
h1,h2,h3,h4 { font-family: var(--font-head); line-height: 1.3; color: var(--text); }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #bdc1c6; border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #9aa0a6; background-clip: padding-box; }

/* ══════════════════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════════════════ */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  z-index: 1000;
  box-sizing: border-box;
  width: 100%;
}
.header-logo {
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-search {
  flex: 1;
  min-width: 0;
  max-width: 480px;
  position: relative;
  margin: 0 8px;
}
.header-search input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 9px 16px 9px 40px;
  color: var(--text);
  font-size: 14px;
  transition: all var(--transition);
  outline: none;
}
.header-search input:focus {
  background: var(--bg-surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.header-search input:hover:not(:focus) { border-color: #bdc1c6; }
.header-search input::placeholder { color: var(--text-dim); }
.header-search .search-icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 16px;
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.btn-create {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.25px;
  transition: background var(--transition), box-shadow var(--transition);
  box-shadow: 0 1px 2px rgba(26,115,232,0.3);
}
.btn-create:hover { background: var(--accent-dim); color: #fff; text-decoration: none; box-shadow: 0 2px 4px rgba(26,115,232,0.4); }

.icon-btn {
  background: none;
  border: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
  position: relative;
  transition: background var(--transition);
}
.icon-btn:hover { background: var(--bg-raised); }
.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid #fff;
}
.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 24px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition);
  border: 1px solid var(--border);
  background: none;
}
.user-menu:hover { background: var(--bg-raised); }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Search results dropdown ─────────────────────────────────── */
.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: none;
  z-index: 200;
  overflow: hidden;
}
.search-results.active { display: block; }
.search-result-group { padding: 6px 0; border-bottom: 1px solid var(--border); }
.search-result-group:last-child { border-bottom: none; }
.search-result-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 4px 14px;
  font-weight: 500;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text);
  transition: background var(--transition);
}
.search-result-item:hover { background: var(--bg-raised); text-decoration: none; }
.search-result-item small { color: var(--text-dim); font-size: 12px; margin-left: auto; }

/* ══════════════════════════════════════════════════════════════
   WEATHER ALERT BANNER
══════════════════════════════════════════════════════════════ */
.weather-banner {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  background: #fce8e6;
  color: #c5221f;
  border-bottom: 1px solid #f5c6c2;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  z-index: 99;
  animation: slideDown 0.25s ease;
}
@keyframes slideDown { from { transform: translateY(-100%); opacity: 0; } }
.weather-banner .alert-icon { font-size: 16px; flex-shrink: 0; }
.weather-banner .alert-text { flex: 1; }
.weather-banner .alert-dismiss {
  background: none; border: none;
  color: #c5221f; font-size: 20px;
  cursor: pointer; padding: 0 4px;
  opacity: 0.7; line-height: 1;
  transition: opacity var(--transition);
}
.weather-banner .alert-dismiss:hover { opacity: 1; }
.weather-banner.severity-Moderate { background: #fef7e0; border-color: #fde68a; color: #b45309; }

/* ══════════════════════════════════════════════════════════════
   LAYOUT SHELL
══════════════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  margin-top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}
.app-shell.has-alert { margin-top: calc(var(--header-h) + 38px); height: calc(100vh - var(--header-h) - 38px); }

/* ── Left Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 12px 0;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar-section { margin-bottom: 4px; }
.sidebar-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 8px 16px 4px;
  font-weight: 500;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 400;
  border-radius: 0 24px 24px 0;
  margin-right: 12px;
  transition: background var(--transition), color var(--transition);
}
.sidebar-link:hover { background: var(--bg-raised); color: var(--text); text-decoration: none; }
.sidebar-link.active { color: var(--accent); background: var(--accent-light); font-weight: 500; }
.sidebar-link .nook-dot { width: 8px; height: 8px; border-radius: 50%; background: #bdc1c6; flex-shrink: 0; }
.sidebar-link.active .nook-dot { background: var(--accent); }
.sidebar-link .nook-count { margin-left: auto; font-size: 11px; color: var(--text-dim); }
.sidebar-divider { border: none; border-top: 1px solid var(--border); margin: 8px 0; }

/* ── Main Feed ───────────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 24px;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Right Panel ─────────────────────────────────────────────── */
.right-panel {
  width: var(--right-w);
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 16px 12px;
  border-left: 1px solid var(--border);
  background: var(--bg-surface);
}
.right-panel::-webkit-scrollbar { display: none; }
.panel-widget {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.panel-widget-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 10px;
}
.panel-nook-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.panel-nook-item:last-child { border-bottom: none; }
.panel-nook-item .count { margin-left: auto; color: var(--text-dim); font-size: 12px; }
.panel-weather { background: #fce8e6; border-color: #f5c6c2; }
.panel-weather .severity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--danger);
  color: #fff;
  margin-bottom: 6px;
}
.panel-weather p { font-size: 13px; color: #c5221f; margin-top: 4px; }

/* ══════════════════════════════════════════════════════════════
   CRANNY CARDS
══════════════════════════════════════════════════════════════ */
.cranny-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: box-shadow var(--transition);
  animation: fadeUp 0.25s ease both;
}
.cranny-card:hover { box-shadow: var(--shadow-md); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cranny-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.cranny-nook-tag {
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.cranny-nook-tag:hover { text-decoration: none; background: #d2e3fc; }
.cranny-bot-tag {
  background: #e6f4ea;
  color: var(--success);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.cranny-card h2, .cranny-card h3 {
  font-family: var(--font-head);
  font-size: 17px;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.35;
}
.cranny-card h2 a, .cranny-card h3 a { color: inherit; }
.cranny-card h2 a:hover, .cranny-card h3 a:hover { color: var(--accent); text-decoration: none; }
.cranny-body { font-size: 14px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.6; }

.link-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 10px 0;
  display: flex;
  transition: box-shadow var(--transition);
  background: var(--bg-raised);
}
.link-preview:hover { box-shadow: var(--shadow-sm); text-decoration: none; }
.link-preview img { width: 96px; object-fit: cover; flex-shrink: 0; }
.link-preview-info { padding: 10px 12px; flex: 1; min-width: 0; }
.link-preview-info .lp-title {
  font-size: 14px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.link-preview-info .lp-url { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

.cranny-image {
  display: block;
  border-radius: var(--radius-sm);
  max-height: 400px;
  object-fit: contain;
  width: 100%;
  margin: 10px 0;
  border: 1px solid var(--border);
  background: var(--bg-raised);
}
.cranny-actions {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: none;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.action-btn:hover { background: var(--bg-raised); color: var(--text); text-decoration: none; }
.action-btn.saved { color: var(--accent); }
.action-btn.danger:hover { color: var(--danger); }

/* ══════════════════════════════════════════════════════════════
   COMPOSE BOX
══════════════════════════════════════════════════════════════ */
.compose-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
  transition: box-shadow var(--transition);
}
.compose-box:focus-within { box-shadow: var(--shadow-md); }
.compose-box textarea {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  resize: vertical;
  min-height: 72px;
  outline: none;
  transition: border-color var(--transition);
}
.compose-box textarea:focus { border-color: var(--accent); }
.compose-box textarea::placeholder { color: var(--text-dim); }
.compose-box input[type="text"], .compose-box input[type="url"] {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text);
  outline: none;
  margin-bottom: 8px;
  transition: border-color var(--transition);
}
.compose-box input:focus { border-color: var(--accent); }
.compose-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }

/* ══════════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: none;
  transition: all var(--transition);
  cursor: pointer;
  letter-spacing: 0.25px;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(26,115,232,0.3); }
.btn-primary:hover { background: var(--accent-dim); color: #fff; text-decoration: none; box-shadow: 0 2px 4px rgba(26,115,232,0.4); }
.btn-secondary { background: var(--bg-surface); border: 1px solid var(--border); color: var(--accent); }
.btn-secondary:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b31c12; }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--text-muted); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

/* ══════════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.3px; }
.form-control {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  outline: none;
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.form-control:hover:not(:focus) { border-color: #bdc1c6; }
.form-control::placeholder { color: var(--text-dim); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%235f6368' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  appearance: none;
}
.form-hint { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.radio-group { display: flex; gap: 20px; margin-top: 6px; flex-wrap: wrap; }
.radio-option { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; color: var(--text-muted); }
.radio-option input[type="radio"] { accent-color: var(--accent); }

/* ══════════════════════════════════════════════════════════════
   FLASH MESSAGES
══════════════════════════════════════════════════════════════ */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeUp 0.25s ease;
}
.flash-success { background: #e6f4ea; border: 1px solid #b7dfbf; color: var(--success); }
.flash-error   { background: #fce8e6; border: 1px solid #f5c6c2; color: var(--danger); }

/* ══════════════════════════════════════════════════════════════
   NOOK HERO
══════════════════════════════════════════════════════════════ */
.nook-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.nook-hero h1 { font-size: 24px; color: var(--text); margin-bottom: 4px; }
.nook-hero p { color: var(--text-muted); font-size: 14px; }
.nook-hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.nook-hero-meta .stat strong { color: var(--accent); font-weight: 500; }

/* ══════════════════════════════════════════════════════════════
   COMMENTS
══════════════════════════════════════════════════════════════ */
.comments-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 16px;
}
.comments-title { font-family: var(--font-head); font-size: 17px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.comment { padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.comment-author { color: var(--text); font-weight: 500; }
.comment-body { font-size: 14px; color: var(--text); line-height: 1.55; }
.comment-replies { margin-left: 24px; border-left: 2px solid var(--border); padding-left: 14px; margin-top: 6px; }
.comment-reply-btn {
  background: none; border: none;
  font-size: 12px; font-weight: 500;
  color: var(--text-dim); cursor: pointer;
  margin-top: 6px; padding: 0;
  letter-spacing: 0.2px;
  transition: color var(--transition);
}
.comment-reply-btn:hover { color: var(--accent); }
.comment-form textarea {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  resize: vertical;
  min-height: 64px;
  outline: none;
  margin-bottom: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color var(--transition);
}
.comment-form textarea:focus { border-color: var(--accent); }

/* ══════════════════════════════════════════════════════════════
   PUBLIC HOMEPAGE
══════════════════════════════════════════════════════════════ */
.home-hero {
  background: linear-gradient(135deg, #e8f0fe 0%, #f3e8ff 50%, #e8f5e9 100%);
  padding: 72px 40px;
  padding-top: calc(var(--header-h) + 48px);
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.home-hero h1 { font-size: clamp(26px, 6vw, 54px); color: #202124; margin-bottom: 14px; font-weight: 700; line-height: 1.2; }
.home-hero h1 em { color: var(--accent); font-style: normal; }
.home-hero p { color: var(--text-muted); font-size: clamp(14px, 4vw, 18px); max-width: 520px; margin: 0 auto 28px; }

.hero-search {
  max-width: 500px;
  margin: 0 auto 20px;
  display: flex;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.hero-search input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 24px 0 0 24px;
  padding: 14px 20px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.hero-search input::placeholder { color: var(--text-dim); }
.hero-search button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 0 24px 24px 0;
  padding: 0 24px;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.25px;
  transition: background var(--transition);
}
.hero-search button:hover { background: var(--accent-dim); }
.hero-cta-links { display: flex; justify-content: center; gap: 20px; }
.hero-cta-links a { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.hero-cta-links a:hover { color: var(--accent); }

.nook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 12px;
  margin: 16px 0;
}
.nook-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: box-shadow var(--transition);
}
.nook-card:hover { box-shadow: var(--shadow-md); }
.nook-card h3 { font-size: 16px; margin-bottom: 4px; font-weight: 600; }
.nook-card h3 a { color: var(--text); }
.nook-card h3 a:hover { color: var(--accent); text-decoration: none; }
.nook-card p { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.45; }
.nook-card-meta { font-size: 12px; color: var(--text-dim); }
.nook-card-meta .mem { color: var(--accent); font-weight: 500; }
.nook-latest { font-size: 12px; color: var(--text-dim); margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════
   AUTH PAGES
══════════════════════════════════════════════════════════════ */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: var(--bg); }
.auth-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 48px; width: 100%; max-width: 420px; box-shadow: var(--shadow-md); }
.auth-logo { font-family: var(--font-body); font-size: 24px; font-weight: 400; text-align: center; margin-bottom: 8px; letter-spacing: -0.3px; }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 15px; margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-dim); }
.tos-check { margin: 16px 0 20px; }
.tos-label { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text-dim); cursor: pointer; line-height: 1.5; }
.tos-label input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.tos-label a { color: var(--accent); text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════
   PAGE HEADER
══════════════════════════════════════════════════════════════ */
.page-header { margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.page-header h1 { font-size: 24px; color: var(--text); font-weight: 600; }
.page-header p { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* ══════════════════════════════════════════════════════════════
   EXPLORE
══════════════════════════════════════════════════════════════ */
.topic-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.topic-pill {
  padding: 6px 16px;
  border-radius: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  transition: all var(--transition);
}
.topic-pill:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); text-decoration: none; }

/* ══════════════════════════════════════════════════════════════
   NOTIFICATIONS
══════════════════════════════════════════════════════════════ */
.notif-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: none; }
.notif-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-raised); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.notif-content .notif-title { font-size: 14px; font-weight: 500; color: var(--text); }
.notif-content .notif-body  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.notif-content .notif-time  { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.notif-unread { background: var(--accent-light); border-radius: var(--radius-sm); padding: 8px 10px; margin: -2px -8px; }

/* ══════════════════════════════════════════════════════════════
   LIVE INDICATOR
══════════════════════════════════════════════════════════════ */
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--success);
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.live-dot::before {
  content: '';
  width: 7px; height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}

/* ══════════════════════════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════════════════════════ */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-dim); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 14px; opacity: 0.45; }
.empty-state h3 { font-size: 18px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.empty-state p { font-size: 14px; }

/* ══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS (Material Snackbar style)
══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  align-items: center;
}
.toast {
  background: #323232;
  color: #fff;
  border-radius: 4px;
  padding: 12px 20px;
  min-width: 250px;
  max-width: 400px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  animation: toastIn 0.25s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
}
.toast.toast-weather { background: #c5221f; }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ══════════════════════════════════════════════════════════════
   RSS LIST
══════════════════════════════════════════════════════════════ */
.rss-list { list-style: none; }
.rss-list li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.rss-list li:last-child { border-bottom: none; }
.rss-icon { color: #f97316; font-size: 14px; }

/* ══════════════════════════════════════════════════════════════
   PWA INSTALL BAR
══════════════════════════════════════════════════════════════ */
.pwa-install-bar { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg-surface); border-top: 1px solid var(--border); padding: 12px 20px; align-items: center; gap: 12px; z-index: 1100; box-shadow: 0 -2px 8px rgba(0,0,0,0.15); }
.pwa-install-bar.show { display: flex; }
.pwa-install-bar p { flex: 1; font-size: 14px; color: var(--text-muted); margin: 0; }
@media (max-width: 768px) { .pwa-install-bar { bottom: 56px; border-radius: 12px 12px 0 0; } }

/* ══════════════════════════════════════════════════════════════
   SECTION TITLE
══════════════════════════════════════════════════════════════ */
.section-title {
  font-family: var(--font-head);
  font-size: 18px;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) { .right-panel { display: none; } }
/* Drive links block: hidden on desktop (right panel shows it), visible on mobile */
.drive-mobile-block { display: none; }
@media (max-width: 1100px) { .drive-mobile-block { display: block; } }

@media (max-width: 768px) {
  body.has-app-shell {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .app-shell {
    height: auto;
    overflow: visible;
    min-height: calc(100vh - var(--header-h));
  }
  .main-content {
    height: auto;
    overflow-y: visible;
    overflow-x: hidden;
    padding: 14px;
    max-width: 100%;
  }
  .sidebar { display: none; }
  .home-hero { padding: calc(var(--header-h) + 24px) 16px 32px; }
  .home-hero h1 { font-size: 26px; }
  .nook-grid { grid-template-columns: 1fr; }
  .header-search { max-width: 180px; }
  .header-logo { font-size: 17px; }
  .header-actions { gap: 4px; }
  .header-actions .btn { padding: 6px 10px; font-size: 12px; }
  .nook-card { word-break: break-word; overflow: hidden; }
  .cranny-card { word-break: break-word; overflow: hidden; }
}

@media (max-width: 540px) {
  .header-search { display: none; }
  .btn-advertise { display: none; }
  .username-label { display: none; }
  .btn-create-label { display: none; }
  .header-actions { gap: 4px; flex-shrink: 0; }
  .header-actions .btn { padding: 7px 12px; font-size: 13px; white-space: nowrap; }
  .user-menu span:last-child { display: none; }
  .main-content { padding: 10px; }
  .home-hero { padding: 32px 16px; }
  .home-hero h1 { font-size: 28px; }
}

/* ══════════════════════════════════════════════════════════════
   UTILITY
══════════════════════════════════════════════════════════════ */
.text-muted   { color: var(--text-muted); }
.text-dim     { color: var(--text-dim); }
.text-accent  { color: var(--accent); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.flex         { display: flex; }
.items-center { align-items: center; }
.gap-8        { gap: 8px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.mb-16        { margin-bottom: 16px; }
.mb-24        { margin-bottom: 24px; }
.sr-only      { position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0); }

/* ══════════════════════════════════════════════════════════════
   USER DROPDOWN
══════════════════════════════════════════════════════════════ */
.user-dropdown-wrap {
  position: relative;
}
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 300;
  overflow: hidden;
  animation: dropDown 0.15s ease;
}
.user-dropdown.open { display: block; }
@keyframes dropDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
  font-family: var(--font-body);
  font-weight: 400;
}
.dropdown-item:hover { background: var(--bg-raised); text-decoration: none; color: var(--text); }
.dropdown-item-danger { color: var(--danger); }
.dropdown-item-danger:hover { background: #fce8e6; }
.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* ══════════════════════════════════════════════════════════════
   AVATAR UPLOAD
══════════════════════════════════════════════════════════════ */
.avatar-upload-wrap {
  position: relative;
  display: inline-block;
}
.avatar-upload-wrap:hover .avatar-overlay {
  opacity: 1;
}
.avatar-large {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
}
.avatar-large-initials {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 32px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--border);
}
.avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  cursor: pointer;
  font-size: 20px;
  color: #fff;
}

/* ══════════════════════════════════════════════════════════════
   MOBILE BOTTOM NAV
══════════════════════════════════════════════════════════════ */
.mobile-bottom-nav {
  display: none;
}
@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 56px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    z-index: 999;
    justify-content: space-around;
    align-items: center;
  }
  .mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 9px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 4px;
    flex: 1;
    text-align: center;
  }
  .mobile-bottom-nav a .nav-icon { font-size: 20px; line-height: 1; }
  .mobile-bottom-nav a.active,
  .mobile-bottom-nav a:hover { color: var(--accent); }
  /* Push page content above bottom nav */
  body { padding-bottom: 80px; }
  .main-content { padding-bottom: 0; }
  /* Spacer pushes content above bottom nav reliably on all browsers */
  .mobile-scroll-spacer { height: 80px; display: block; }
  .home-hero { padding: calc(var(--header-h) + 20px) 16px 28px; }
  .home-hero h1 { font-size: 22px; line-height: 1.3; }
  .home-hero p { font-size: 15px; }
}

/* ── Comment avatars ─────────────────────────────────────────── */
.comment-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  overflow: hidden;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-content { flex: 1; min-width: 0; }
.comment-delete-btn {
  background: none; border: none; color: var(--text-dim);
  font-size: 12px; cursor: pointer; padding: 2px 6px;
  border-radius: 4px;
}
.comment-delete-btn:hover { color: var(--danger); background: #fce8e6; }

/* ── NSFW blur / reveal ─────────────────────────────────────── */
/* ── NSFW details/summary reveal ─────────────────────────────── */
.nsfw-card { }
.nsfw-details { }
.nsfw-details[open] .nsfw-summary .nsfw-hint { display: none; }
.nsfw-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px;
  background: #1a0000;
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.nsfw-summary::-webkit-details-marker { display: none; }
.nsfw-summary:hover { background: #2d0000; }
.nsfw-badge {
  background: #b91c1c; color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 10px;
  letter-spacing: 0.5px;
}
.nsfw-hint {
  color: rgba(255,255,255,0.75);
  font-size: 13px;
}
.nsfw-reblur {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.nsfw-reblur:hover { background: rgba(255,255,255,0.1); }
.nsfw-revealed-content { padding-top: 8px; }

/* ── Mobile RSS Filter ─────────────────────────────────────── */
.mobile-rss-filter { display: none; }
@media (max-width: 768px) {
  .mobile-rss-filter { display: block; }
}


/* ── Compact Ad Bar ──────────────────────────────────────────── */
.ad-bar {
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 8px;
}
.ad-bar-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ad-bar-icon { font-size: 14px; flex-shrink: 0; }
.ad-bar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  background: var(--bg-raised);
  padding: 1px 6px;
  border-radius: 99px;
  flex-shrink: 0;
}
.ad-bar-name {
  flex: 1;
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ad-bar-name strong { color: var(--text); }
.ad-bar-desc {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  display: none; /* hidden on desktop — description is for mobile */
}
.ad-bar-cta {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  text-decoration: none;
}
.ad-bar-cta:hover { text-decoration: underline; }
.ad-bar-more {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.ad-bar-desc-full { display: none; }
@media (max-width: 1100px) {
  /* Show description on tablet and mobile where right panel is hidden */
  .ad-bar-desc { display: block; }
}
@media (max-width: 768px) {
  .ad-bar { padding: 12px 14px; }
  .ad-bar-icon { font-size: 18px; }
  .ad-bar-label { font-size: 11px; padding: 2px 8px; }
  .ad-bar-name { font-size: 14px; }
  .ad-bar-desc { font-size: 13px; margin-top: 6px; }
  .ad-bar-cta  { font-size: 14px; }
}

/* ── Accessibility: Dyslexia-friendly font ───────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;600;700&display=swap');

body.font-dyslexia,
body.font-dyslexia input,
body.font-dyslexia textarea,
body.font-dyslexia select,
body.font-dyslexia button {
  font-family: 'Lexend', sans-serif !important;
  letter-spacing: 0.02em;
  word-spacing: 0.1em;
  line-height: 1.7;
}

body.font-dyslexia .cranny-card,
body.font-dyslexia .compose-box,
body.font-dyslexia article {
  line-height: 1.8;
}

/* ── Mobile cranny card action bar fix ──────────────────────────
   Paste this at the END of your public/css/style.css file
   ─────────────────────────────────────────────────────────────── */

/* Action bar: single scrollable row, never wraps */
.cranny-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  padding-bottom: 2px;
}
.cranny-actions::-webkit-scrollbar { display: none; }

/* RSVP group stays inline */
.rsvp-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Action buttons — compact on mobile */
.action-btn {
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 12px;
  padding: 4px 8px;
}

/* Event date — readable but compact */
.event-date-badge {
  font-size: 12px;
  font-weight: 700;
  color: #1a73e8;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .action-btn {
    font-size: 11px;
    padding: 3px 7px;
  }
  .rsvp-group span {
    display: none; /* Hide "Going?" label on very small screens */
  }
}