/* ============================================================
   INKBLOT — style.css
   Global design system: tokens, typography, layout, components
   ============================================================ */

/* ────────────────────────────────────────────────────────────
   0. GOOGLE FONTS IMPORT
   Display: Playfair Display (editorial, ink-press personality)
   Body:    Inter (clean, readable at small sizes)
   ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600&family=Inter:wght@300;400;500;600&display=swap');

/* ────────────────────────────────────────────────────────────
   1. DESIGN TOKENS
   ──────────────────────────────────────────────────────────── */
:root {
  /* Palette */
  --ink-0:   #0a0a0b;   /* deepest background        */
  --ink-1:   #111113;   /* card / surface background  */
  --ink-2:   #1a1a1e;   /* elevated surface           */
  --ink-3:   #242428;   /* input / subtle bg          */
  --ink-4:   #313136;   /* borders                    */
  --ink-5:   #48484f;   /* muted borders              */
  --ink-6:   #6e6e78;   /* placeholder / disabled     */
  --ink-7:   #9d9da8;   /* secondary text             */
  --ink-8:   #c8c8d4;   /* body text                  */
  --ink-9:   #f0efe8;   /* primary text (warm white)  */

  /* Accent — amber ink */
  --amber:       #e8a020;
  --amber-light: #f5bc4a;
  --amber-dim:   rgba(232, 160, 32, 0.12);
  --amber-glow:  rgba(232, 160, 32, 0.25);

  /* Semantic */
  --bg:          var(--ink-0);
  --surface:     var(--ink-1);
  --surface-2:   var(--ink-2);
  --border:      var(--ink-4);
  --border-sub:  var(--ink-5);
  --text:        var(--ink-9);
  --text-sub:    var(--ink-7);
  --text-muted:  var(--ink-6);

  /* Status */
  --green:   #3ecf8e;
  --red:     #f04e4e;
  --red-dim: rgba(240, 78, 78, 0.12);

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  /* Type scale */
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   17px;
  --text-lg:   20px;
  --text-xl:   24px;
  --text-2xl:  30px;
  --text-3xl:  38px;

  /* Spacing */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Radius */
  --r-sm:   6px;
  --r-md:   12px;
  --r-lg:   18px;
  --r-xl:   24px;
  --r-full: 9999px;

  /* Transitions */
  --t-fast:   0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --t-base:   0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --t-spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.6);

  /* Nav */
  --nav-h: 60px;
  --bottom-nav-h: 64px;

  /* Safe area for iOS */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ────────────────────────────────────────────────────────────
   2. RESET & BASE
   ──────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea {
  font-family: var(--font-body);
  font-size: var(--text-base);
}

img {
  display: block;
  max-width: 100%;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-4); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-5); }

::selection {
  background: var(--amber-dim);
  color: var(--amber-light);
}

/* ────────────────────────────────────────────────────────────
   3. LAYOUT WRAPPERS
   ──────────────────────────────────────────────────────────── */
.page {
  min-height: 100dvh;
  padding-top: var(--nav-h);
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
}

.page--no-bottom {
  padding-bottom: 0;
}

.page--no-top {
  padding-top: 0;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

/* ────────────────────────────────────────────────────────────
   4. TOP NAV BAR
   ──────────────────────────────────────────────────────────── */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: rgba(10, 10, 11, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-4);
  z-index: 100;
  gap: var(--sp-3);
}

.top-nav__wordmark {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  flex: 1;
}

.top-nav__wordmark span {
  color: var(--amber);
}

.top-nav__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ────────────────────────────────────────────────────────────
   5. BOTTOM NAV BAR
   ──────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(10, 10, 11, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  padding-top: var(--sp-2);
  z-index: 100;
}

.bottom-nav__items {
  display: flex;
  width: 100%;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: var(--sp-2) var(--sp-4);
  color: var(--text-muted);
  transition: color var(--t-fast);
  position: relative;
  min-width: 52px;
}

.bottom-nav__item svg {
  width: 22px;
  height: 22px;
  transition: transform var(--t-spring);
}

.bottom-nav__item--active {
  color: var(--amber);
}

.bottom-nav__item--active svg {
  transform: scale(1.1);
}

.bottom-nav__dot {
  position: absolute;
  top: 6px;
  right: calc(50% - 16px);
  width: 6px;
  height: 6px;
  background: var(--amber);
  border-radius: 50%;
  border: 1.5px solid var(--bg);
}

.bottom-nav__fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--amber);
  border-radius: var(--r-full);
  color: var(--ink-0);
  box-shadow: 0 4px 16px var(--amber-glow);
  transition: transform var(--t-spring), box-shadow var(--t-fast);
  margin-top: -10px;
}

.bottom-nav__fab:active {
  transform: scale(0.93);
  box-shadow: 0 2px 8px var(--amber-glow);
}

.bottom-nav__fab svg {
  width: 20px;
  height: 20px;
}

/* ────────────────────────────────────────────────────────────
   6. ICON BUTTON
   ──────────────────────────────────────────────────────────── */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-full);
  color: var(--text-sub);
  background: transparent;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-spring);
  position: relative;
  flex-shrink: 0;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: var(--ink-3);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.88);
}

.icon-btn--active {
  color: var(--amber);
}

.icon-btn--danger:hover {
  background: var(--red-dim);
  color: var(--red);
}

/* Badge on icon btn */
.icon-btn__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--amber);
  color: var(--ink-0);
  font-size: 9px;
  font-weight: 600;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg);
  line-height: 1;
}

/* ────────────────────────────────────────────────────────────
   7. BUTTONS
   ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 42px;
  padding: 0 var(--sp-5);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background var(--t-fast), color var(--t-fast),
              transform var(--t-spring), box-shadow var(--t-fast);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:active { transform: scale(0.95); }

.btn--primary {
  background: var(--amber);
  color: var(--ink-0);
  box-shadow: 0 2px 12px var(--amber-glow);
  font-weight: 600;
}
.btn--primary:hover { background: var(--amber-light); }

.btn--ghost {
  background: var(--ink-3);
  color: var(--text);
}
.btn--ghost:hover { background: var(--ink-4); }

.btn--outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--outline:hover { background: var(--ink-3); }

.btn--follow {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(232,160,32,0.3);
  height: 34px;
  padding: 0 var(--sp-4);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.btn--follow:hover { background: var(--amber); color: var(--ink-0); }

.btn--following {
  background: var(--ink-3);
  color: var(--text-sub);
  border: 1px solid var(--border);
  height: 34px;
  padding: 0 var(--sp-4);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn--sm {
  height: 34px;
  padding: 0 var(--sp-4);
  font-size: var(--text-xs);
}

.btn--danger {
  background: var(--red-dim);
  color: var(--red);
}
.btn--danger:hover { background: var(--red); color: #fff; }

.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

/* ────────────────────────────────────────────────────────────
   8. BLOG CARD
   ──────────────────────────────────────────────────────────── */
.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t-base), transform var(--t-base), box-shadow var(--t-base);
  cursor: pointer;
  display: block;
}

.blog-card:active {
  transform: scale(0.985);
  box-shadow: var(--shadow-md);
}

/* Cover image */
.blog-card__cover {
  width: 100%;
  aspect-ratio: 16 / 8;
  object-fit: cover;
  background: var(--ink-3);
  display: block;
}

.blog-card__cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ink-2) 0%, var(--ink-3) 100%);
}

.blog-card__cover--placeholder svg {
  width: 32px;
  height: 32px;
  color: var(--ink-5);
}

/* Body */
.blog-card__body {
  padding: var(--sp-4);
}

/* Author row */
.blog-card__author {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.blog-card__avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  overflow: hidden;
  background: var(--ink-3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--amber);
  border: 1.5px solid var(--border);
}

.blog-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-card__author-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blog-card__time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Title */
.blog-card__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: var(--sp-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Excerpt */
.blog-card__excerpt {
  font-size: var(--text-sm);
  color: var(--text-sub);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--sp-3);
}

/* Tags */
.blog-card__tags {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--sp-2);
  background: var(--ink-3);
  color: var(--text-sub);
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background var(--t-fast), color var(--t-fast);
  cursor: pointer;
}

.tag:hover, .tag--active {
  background: var(--amber-dim);
  color: var(--amber);
}

/* Footer */
.blog-card__footer {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  margin-top: var(--sp-3);
}

.blog-card__action {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast), transform var(--t-spring);
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: var(--font-body);
}

.blog-card__action svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.blog-card__action:hover {
  color: var(--text);
  background: var(--ink-3);
}

.blog-card__action:active {
  transform: scale(0.9);
}

.blog-card__action--liked {
  color: var(--red);
}

.blog-card__action--liked:hover {
  background: var(--red-dim);
  color: var(--red);
}

.blog-card__action--bookmarked {
  color: var(--amber);
}

.blog-card__spacer {
  flex: 1;
}

/* Read time pill */
.read-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.read-time svg {
  width: 12px;
  height: 12px;
}

/* ────────────────────────────────────────────────────────────
   9. AVATAR
   ──────────────────────────────────────────────────────────── */
.avatar {
  border-radius: var(--r-full);
  overflow: hidden;
  background: var(--ink-3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--amber);
  border: 1.5px solid var(--border);
  user-select: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--xs  { width: 28px;  height: 28px;  font-size: 11px; }
.avatar--sm  { width: 36px;  height: 36px;  font-size: 13px; }
.avatar--md  { width: 48px;  height: 48px;  font-size: 17px; }
.avatar--lg  { width: 72px;  height: 72px;  font-size: 24px; }
.avatar--xl  { width: 96px;  height: 96px;  font-size: 30px; }

/* ────────────────────────────────────────────────────────────
   10. FORM ELEMENTS
   ──────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  height: 48px;
  padding: 0 var(--sp-4);
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: var(--text-base);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}

.input::placeholder { color: var(--text-muted); }

.input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}

.input--error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-dim);
}

.textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-height: 100px;
}

.textarea::placeholder { color: var(--text-muted); }

.textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-sub);
  letter-spacing: 0.02em;
}

.form-error {
  font-size: var(--text-xs);
  color: var(--red);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

/* ────────────────────────────────────────────────────────────
   11. SECTION TABS (horizontal scrollable pill tabs)
   ──────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--nav-h);
  background: rgba(10,10,11,0.92);
  backdrop-filter: blur(16px);
  z-index: 10;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-sub);
  background: var(--ink-3);
  white-space: nowrap;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  transition: background var(--t-fast), color var(--t-fast);
  flex-shrink: 0;
}

.tab svg { width: 14px; height: 14px; }

.tab:hover { color: var(--text); background: var(--ink-4); }

.tab--active {
  background: var(--amber);
  color: var(--ink-0);
  font-weight: 600;
}

/* ────────────────────────────────────────────────────────────
   12. SKELETON LOADER
   ──────────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--ink-2) 25%,
    var(--ink-3) 50%,
    var(--ink-2) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: var(--r-sm);
}

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  padding: var(--sp-4);
}

.skeleton-cover {
  width: 100%;
  aspect-ratio: 16/8;
  border-radius: var(--r-md);
  margin-bottom: var(--sp-3);
}

.skeleton-line {
  height: 14px;
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-2);
}

.skeleton-line--title { height: 20px; width: 80%; }
.skeleton-line--sub   { width: 60%; }
.skeleton-line--short { width: 40%; }

/* ────────────────────────────────────────────────────────────
   13. EMPTY STATE
   ──────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-8);
  text-align: center;
  gap: var(--sp-4);
}

.empty-state__icon {
  width: 56px;
  height: 56px;
  background: var(--ink-3);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.empty-state__icon svg { width: 26px; height: 26px; }

.empty-state__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text);
}

.empty-state__sub {
  font-size: var(--text-sm);
  color: var(--text-sub);
  line-height: 1.6;
  max-width: 260px;
}

/* ────────────────────────────────────────────────────────────
   14. TOAST NOTIFICATION
   ──────────────────────────────────────────────────────────── */
.ib-toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink-2);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  z-index: 9999;
  opacity: 0;
  transition: opacity var(--t-base), transform var(--t-spring);
  pointer-events: none;
  max-width: calc(100vw - 32px);
  text-overflow: ellipsis;
  overflow: hidden;
}

.ib-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ib-toast--error  { border-color: var(--red);   color: var(--red); }
.ib-toast--success{ border-color: var(--green);  color: var(--green); }

/* ────────────────────────────────────────────────────────────
   15. DIVIDER
   ──────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-4) 0;
}

/* ────────────────────────────────────────────────────────────
   16. FEED LIST
   ──────────────────────────────────────────────────────────── */
.feed {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
}

/* ────────────────────────────────────────────────────────────
   17. BOTTOM SHEET  (comments, share, etc.)
   ──────────────────────────────────────────────────────────── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
}

.sheet-overlay--open {
  opacity: 1;
  pointer-events: all;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--ink-2);
  border-top-left-radius: var(--r-xl);
  border-top-right-radius: var(--r-xl);
  border-top: 1px solid var(--border);
  z-index: 201;
  transform: translateY(100%);
  transition: transform var(--t-spring);
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--sp-6) + var(--safe-bottom));
}

.bottom-sheet--open {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--ink-5);
  border-radius: 2px;
  margin: var(--sp-3) auto var(--sp-2);
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  padding: var(--sp-2) var(--sp-4) var(--sp-3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: var(--sp-3);
}

.sheet-title {
  flex: 1;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
}

.sheet-body {
  overflow-y: auto;
  flex: 1;
  padding: var(--sp-3) var(--sp-4);
  overscroll-behavior: contain;
}

/* ────────────────────────────────────────────────────────────
   18. COMMENT ITEM
   ──────────────────────────────────────────────────────────── */
.comment {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}

.comment:last-child { border-bottom: none; }

.comment__body { flex: 1; min-width: 0; }

.comment__header {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: 4px;
}

.comment__name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.comment__time {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.comment__text {
  font-size: var(--text-sm);
  color: var(--ink-8);
  line-height: 1.55;
  word-break: break-word;
}

.comment__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

.comment__action {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-body);
  transition: color var(--t-fast);
  padding: 2px 4px;
  border-radius: var(--r-sm);
}

.comment__action svg { width: 13px; height: 13px; }
.comment__action:hover { color: var(--text); }
.comment__action--liked { color: var(--red); }

/* Reply indentation */
.comment--reply {
  padding-left: var(--sp-5);
  border-left: 1.5px solid var(--border);
  margin-left: calc(28px + var(--sp-3));
}

/* Comment input row */
.comment-input-row {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-end;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
  background: var(--ink-2);
  flex-shrink: 0;
}

.comment-input-row .textarea {
  min-height: 44px;
  max-height: 120px;
  resize: none;
  flex: 1;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  line-height: 1.5;
  background: var(--ink-3);
}

/* ────────────────────────────────────────────────────────────
   19. SEARCH BAR
   ──────────────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: 46px;
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 0 var(--sp-4);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.search-bar:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}

.search-bar svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: var(--text-base);
}

.search-bar input::placeholder { color: var(--text-muted); }

/* ────────────────────────────────────────────────────────────
   20. PROFILE HEADER
   ──────────────────────────────────────────────────────────── */
.profile-header {
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.profile-header__top {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
}

.profile-header__info { flex: 1; min-width: 0; }

.profile-header__name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.profile-header__username {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

.profile-header__bio {
  font-size: var(--text-sm);
  color: var(--text-sub);
  line-height: 1.6;
  margin-top: var(--sp-2);
}

.profile-header__stats {
  display: flex;
  gap: var(--sp-5);
}

.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.profile-stat__value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.profile-stat__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ────────────────────────────────────────────────────────────
   21. BLOG READ VIEW
   ──────────────────────────────────────────────────────────── */
.blog-cover {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: var(--ink-3);
}

.blog-meta {
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
}

.blog-meta__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: var(--sp-3);
}

.blog-meta__subtitle {
  font-size: var(--text-md);
  color: var(--text-sub);
  line-height: 1.5;
  font-style: italic;
  font-family: var(--font-display);
  margin-bottom: var(--sp-4);
}

.blog-meta__author-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.blog-meta__author-info { flex: 1; }

.blog-meta__author-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
}

.blog-meta__author-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 1px;
}

/* Blog content prose */
.blog-content {
  padding: var(--sp-5) var(--sp-4);
  font-size: var(--text-md);
  line-height: 1.75;
  color: var(--ink-8);
}

.blog-content h1,
.blog-content h2,
.blog-content h3 {
  font-family: var(--font-display);
  color: var(--text);
  margin: var(--sp-6) 0 var(--sp-3);
  line-height: 1.3;
}

.blog-content h1 { font-size: var(--text-2xl); }
.blog-content h2 { font-size: var(--text-xl); }
.blog-content h3 { font-size: var(--text-lg); }

.blog-content p { margin-bottom: var(--sp-4); }

.blog-content a { color: var(--amber); text-decoration: underline; }

.blog-content blockquote {
  border-left: 3px solid var(--amber);
  padding-left: var(--sp-4);
  margin: var(--sp-5) 0;
  color: var(--text-sub);
  font-style: italic;
  font-family: var(--font-display);
  font-size: var(--text-lg);
}

.blog-content code {
  background: var(--ink-3);
  color: var(--amber-light);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  font-size: 0.9em;
}

.blog-content pre {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  overflow-x: auto;
  margin: var(--sp-4) 0;
}

.blog-content pre code {
  background: none;
  padding: 0;
  color: var(--ink-8);
}

.blog-content ul,
.blog-content ol {
  padding-left: var(--sp-5);
  margin-bottom: var(--sp-4);
}

.blog-content li { margin-bottom: var(--sp-2); }

.blog-content img {
  width: 100%;
  border-radius: var(--r-md);
  margin: var(--sp-4) 0;
}

.blog-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp-8) 0;
}

/* Floating action bar on blog read */
.blog-action-bar {
  position: sticky;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + var(--sp-3));
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: rgba(26, 26, 30, 0.92);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: var(--sp-2) var(--sp-3);
  margin: 0 var(--sp-4) var(--sp-4);
  box-shadow: var(--shadow-lg);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  z-index: 50;
}

.blog-action-bar .blog-card__action {
  padding: var(--sp-2) var(--sp-3);
}

/* ────────────────────────────────────────────────────────────
   22. NOTIFICATION ITEM
   ──────────────────────────────────────────────────────────── */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
  cursor: pointer;
}

.notif-item--unread { background: rgba(232,160,32,0.04); }

.notif-item:hover { background: var(--ink-2); }

.notif-item__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--ink-3);
}

.notif-item__icon svg { width: 16px; height: 16px; }

.notif-item__icon--like    { color: var(--red);   background: var(--red-dim); }
.notif-item__icon--comment { color: var(--amber);  background: var(--amber-dim); }
.notif-item__icon--follow  { color: var(--green);  background: rgba(62,207,142,0.1); }

.notif-item__body { flex: 1; min-width: 0; }

.notif-item__text {
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.4;
}

.notif-item__text strong { font-weight: 600; }

.notif-item__time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.notif-item__unread-dot {
  width: 7px;
  height: 7px;
  background: var(--amber);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

/* ────────────────────────────────────────────────────────────
   23. EDITOR (write page)
   ──────────────────────────────────────────────────────────── */
.editor-cover-upload {
  width: 100%;
  aspect-ratio: 16/7;
  background: var(--ink-3);
  border: 1.5px dashed var(--border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
  overflow: hidden;
  position: relative;
}

.editor-cover-upload:hover {
  border-color: var(--amber);
  background: var(--amber-dim);
}

.editor-cover-upload__icon { color: var(--text-muted); }
.editor-cover-upload__icon svg { width: 28px; height: 28px; }

.editor-cover-upload__label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.editor-cover-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.editor-title {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  padding: var(--sp-4) var(--sp-4) 0;
  resize: none;
  overflow: hidden;
}

.editor-title::placeholder { color: var(--ink-5); }

.editor-subtitle {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-style: italic;
  color: var(--text-sub);
  line-height: 1.5;
  padding: var(--sp-2) var(--sp-4) 0;
  resize: none;
}

.editor-subtitle::placeholder { color: var(--ink-5); }

.editor-body {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  font-size: var(--text-md);
  color: var(--ink-8);
  line-height: 1.75;
  padding: var(--sp-4);
  resize: none;
  min-height: 300px;
}

.editor-body::placeholder { color: var(--ink-5); }

/* Editor toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--ink-1);
  position: sticky;
  top: var(--nav-h);
  z-index: 5;
}

.editor-toolbar::-webkit-scrollbar { display: none; }

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  color: var(--text-sub);
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  flex-shrink: 0;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
}

.toolbar-btn svg { width: 16px; height: 16px; }
.toolbar-btn:hover { background: var(--ink-3); color: var(--text); }
.toolbar-btn--active { background: var(--amber-dim); color: var(--amber); }

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 var(--sp-1);
  flex-shrink: 0;
}

/* ────────────────────────────────────────────────────────────
   24. PULL-TO-REFRESH INDICATOR
   ──────────────────────────────────────────────────────────── */
.pull-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  gap: var(--sp-2);
  overflow: hidden;
  transition: height var(--t-base);
}

.pull-indicator svg {
  width: 16px;
  height: 16px;
  transition: transform var(--t-spring);
}

.pull-indicator--ready svg {
  transform: rotate(180deg);
  color: var(--amber);
}

/* ────────────────────────────────────────────────────────────
   25. MISC
   ──────────────────────────────────────────────────────────── */
.text-amber   { color: var(--amber); }
.text-muted   { color: var(--text-muted); }
.text-sub     { color: var(--text-sub); }
.text-display { font-family: var(--font-display); }
.font-bold    { font-weight: 700; }
.font-semi    { font-weight: 600; }

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2        { gap: var(--sp-2); }
.gap-3        { gap: var(--sp-3); }
.gap-4        { gap: var(--sp-4); }
.flex-1       { flex: 1; }
.w-full       { width: 100%; }
.min-w-0      { min-width: 0; }

.p-4          { padding: var(--sp-4); }
.px-4         { padding-left: var(--sp-4); padding-right: var(--sp-4); }
.py-3         { padding-top: var(--sp-3); padding-bottom: var(--sp-3); }
.mt-2         { margin-top: var(--sp-2); }
.mt-4         { margin-top: var(--sp-4); }
.mt-6         { margin-top: var(--sp-6); }
.mb-4         { margin-bottom: var(--sp-4); }

/* Spin animation for loaders */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spin { animation: spin 0.8s linear infinite; }

/* Fade in for page content */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.3s var(--t-base) both; }

/* Pulse for unread dot */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.pulse { animation: pulse 2s ease-in-out infinite; }

/* Scale in for modals/sheets */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
.scale-in { animation: scaleIn 0.2s var(--t-spring) both; }

/* ────────────────────────────────────────────────────────────
   26. PAGE TRANSITION (prevents flash/FOUC between pages)
   ──────────────────────────────────────────────────────────── */
html {
  /* Prevents the raw HTML from showing before CSS loads */
  visibility: hidden;
}

html.ready {
  visibility: visible;
}

/* Fade-in on load */
@keyframes pageEnter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

body {
  animation: pageEnter 0.18s ease-out both;
}

/* Fade-out on navigate-away */
/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}


