[x-cloak] { display: none !important; }

/* ─── Global font rendering ──────────────────────────────────────── */

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ─── FrankenStyle color bridge ──────────────────────────────────── */
/* Zinc palette — replaces variables that fuicore.min.css used to provide */

:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --border: 240 5.9% 90%;
  --primary: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;
  --destructive: 0 84.2% 60.2%;
}

.dark {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --border: 240 3.7% 15.9%;
  --primary: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 15.9%;
  --popover: 240 10% 3.9%;
  --popover-foreground: 0 0% 98%;
  --destructive: 0 62.8% 30.6%;
}

/* ─── Semantic color utilities ───────────────────────────────────── */
/* frankenstyle-kit.min.css covers all standard Tailwind utilities   */
/* but does not generate these semantic token classes. Defined here  */
/* so the project has no dependency on franken-ui/fui-utilities.     */

/* Base text colors */
.text-foreground        { color: hsl(var(--foreground)); }
.text-muted-foreground  { color: hsl(var(--muted-foreground)); }
.text-primary           { color: hsl(var(--primary)); }
.\!text-primary         { color: hsl(var(--primary)) !important; }

/* text-muted-foreground opacity variants */
.text-muted-foreground\/20 { color: hsl(var(--muted-foreground) / 0.20); }
.text-muted-foreground\/25 { color: hsl(var(--muted-foreground) / 0.25); }
.text-muted-foreground\/30 { color: hsl(var(--muted-foreground) / 0.30); }
.text-muted-foreground\/35 { color: hsl(var(--muted-foreground) / 0.35); }
.text-muted-foreground\/40 { color: hsl(var(--muted-foreground) / 0.40); }
.text-muted-foreground\/50 { color: hsl(var(--muted-foreground) / 0.50); }
.text-muted-foreground\/60 { color: hsl(var(--muted-foreground) / 0.60); }
.text-muted-foreground\/70 { color: hsl(var(--muted-foreground) / 0.70); }

/* text-foreground opacity variants */
.text-foreground\/80 { color: hsl(var(--foreground) / 0.80); }
.text-foreground\/90 { color: hsl(var(--foreground) / 0.90); }

/* Base background colors */
.bg-background          { background-color: hsl(var(--background)); }
.bg-muted               { background-color: hsl(var(--muted)); }
.bg-accent              { background-color: hsl(var(--accent)); }

/* bg opacity variants */
.bg-primary\/10         { background-color: hsl(var(--primary) / 0.10); }
.bg-accent\/40          { background-color: hsl(var(--accent)  / 0.40); }
.bg-accent\/50          { background-color: hsl(var(--accent)  / 0.50); }
.bg-muted\/50           { background-color: hsl(var(--muted)   / 0.50); }
.bg-muted\/60           { background-color: hsl(var(--muted)   / 0.60); }
.bg-border\/20          { background-color: hsl(var(--border)  / 0.20); }

/* Base border color */
.border-border          { border-color: hsl(var(--border)); }

/* border opacity variants */
.border-border\/20      { border-color: hsl(var(--border) / 0.20); }
.border-border\/30      { border-color: hsl(var(--border) / 0.30); }
.border-border\/40      { border-color: hsl(var(--border) / 0.40); }
.border-border\/50      { border-color: hsl(var(--border) / 0.50); }

/* hover variants */
.hover\:text-foreground:hover   { color: hsl(var(--foreground)); }
.hover\:bg-accent\/40:hover     { background-color: hsl(var(--accent) / 0.40); }

/* ─── Design tokens ──────────────────────────────────────────────── */

:root {
  --eko-topbar-height: 68px;
  --eko-feed-width: 480px;
}

@media (min-width: 1536px) {
  :root { --eko-feed-width: 520px; }
}

@media (min-width: 1920px) {
  :root { --eko-feed-width: 560px; }
}

/* ─── Glassmorphism utility ──────────────────────────────────────── */

.eko-glass {
  background: hsl(var(--background) / 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ─── Reader top bar (shared across entry/entry-full/loading/error) ─ */
/*
 * Encodes: eko-glass + border-b border-border/20 + shrink-0 + items-center
 * display and responsive visibility (lg:hidden / hidden lg:flex) stay in HTML.
 */

.eko-reader-bar {
  height: var(--eko-topbar-height);
  background: hsl(var(--background) / 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border) / 0.2);
  flex-shrink: 0;
  align-items: center;
}

/* Variant for top-of-screen bars: compensates for device safe area (notch/Dynamic Island) */
.eko-reader-bar--top-safe {
  height: calc(var(--eko-topbar-height) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
}

/* ─── Feed sticky header ──────────────────────────────────────────── */
/* Sticky wrapper for feed panel header; owns z-index so it sits above entries */

.eko-feed-header {
  background: hsl(var(--background) / 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border) / 0.2);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Row inside .eko-feed-header that holds the actual controls (no glass, parent owns it) */
.eko-topbar-row {
  height: var(--eko-topbar-height);
  align-items: center;
  flex-shrink: 0;
}

/* ─── Mobile top bar ─────────────────────────────────────────────── */
/* Outer wrapper: safe-area padding + glass effect (replaces inline safe-area style) */

.eko-mobile-topbar {
  padding-top: env(safe-area-inset-top);
  background: hsl(var(--background) / 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border) / 0.2);
  flex-shrink: 0;
}

/* Inner content row at fixed height (actual controls sit here) */
.eko-mobile-topbar-inner {
  height: var(--eko-topbar-height);
  display: flex;
  align-items: center;
}

/* ─── Reader bottom action bar (mobile-only, fixed) ─────────────── */
/*
 * Encodes: eko-glass + fixed bottom-0 inset-x-0 z-80 + border-t border-border/20
 *          + safe-area padding. Mobile-only enforced here so no lg:hidden needed.
 */

.eko-article-bar {
  background: hsl(var(--background) / 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid hsl(var(--border) / 0.2);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 80;
  display: none;
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

@media (max-width: 1023px) {
  .eko-article-bar {
    display: flex;
  }
}

/* ─── Sidebar: mobile overlay, desktop static column ─────────────── */

#feeds-col {
  width: 256px;
  max-width: 256px;
  overflow-x: hidden;
}

@media (max-width: 1023px) {
  #feeds-col {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    transform: translateX(-100%);
  }

  @media (prefers-reduced-motion: no-preference) {
    #feeds-col {
      transition: transform 0.2s ease-out;
    }
  }

  #feeds-col.sidebar-is-open {
    transform: translateX(0);
  }
}

@media (min-width: 1024px) {
  #feeds-col:not(.sidebar-is-open) {
    display: none;
  }

  #feed-body {
    width: var(--eko-feed-width);
    flex: none;
  }
}

/* ─── Reader pane: mobile full-screen overlay, desktop static column  */

@media (max-width: 1023px) {
  #reader-pane {
    display: none;
  }

  #reader-pane.reader-is-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 70;
    overflow-y: auto;
  }

  @media (prefers-reduced-motion: no-preference) {
    #reader-pane.reader-is-open {
      animation: slideInRight 0.25s ease-out;
    }
  }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

/* ─── Sidebar nav items (macOS-style) ────────────────────────────── */

.eko-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.5rem;
  border-radius: 0.5rem;
  padding: 0.5rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.4;
  color: hsl(var(--foreground) / 0.75);
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
  -webkit-font-smoothing: antialiased;
}

.eko-nav-item:hover {
  background: hsl(var(--accent) / 0.5);
  color: hsl(var(--foreground));
}

@media (max-width: 1023px) {
  .eko-nav-item {
    min-height: 44px;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    font-size: 0.9375rem;
  }
}

/* ─── Unread badge pill ──────────────────────────────────────────── */

.eko-badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  flex-shrink: 0;
}

/* ─── Reader pane article container ─────────────────────────────── */

.eko-reader-article {
  max-width: 75ch;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

@media (min-width: 640px) {
  .eko-reader-article {
    padding: 2.5rem 2rem 4rem;
  }
}

@media (min-width: 1536px) {
  .eko-reader-article {
    max-width: 85ch;
  }
}

@media (min-width: 1920px) {
  .eko-reader-article {
    max-width: 92ch;
  }
}

/* ─── Article header ─────────────────────────────────────────────── */

.eko-article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid hsl(var(--border) / 0.4);
}

.eko-article-title {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

@media (min-width: 1536px) {
  .eko-article-title {
    font-size: clamp(1.875rem, 3vw, 2.5rem);
  }
}

/* ─── Article body typography ────────────────────────────────────── */

.eko-content {
  font-family: Georgia, "Noto Serif", ui-serif, serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1;

  h1, h2, h3, h4 {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  }
  h1 {
    font-size: clamp(1.5rem, 3.5vw, 1.875rem);
    line-height: 1.35;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    text-wrap: balance;
  }
  h2 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    line-height: 1.4;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
    text-wrap: balance;
  }
  h3 {
    font-size: clamp(1.0625rem, 2vw, 1.25rem);
    line-height: 1.45;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.375rem;
    text-wrap: balance;
  }
  h4 {
    font-size: clamp(1rem, 1.5vw, 1.0625rem);
    line-height: 1.5;
    font-weight: 600;
    margin-top: 1.25rem;
    text-wrap: balance;
  }
  p {
    font-size: clamp(1.0625rem, 1.5vw + 0.5rem, 1.125rem);
    line-height: 1.8;
  }
  p:not(:first-child) {
    margin-top: 1.25rem;
  }
  a {
    font-weight: 500;
    text-decoration-line: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
  }
  img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
  }
  blockquote {
    border-left: 3px solid hsl(var(--border));
    padding-left: 1rem;
    margin-left: 0;
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
    color: hsl(var(--muted-foreground));
    font-style: italic;
    font-size: 1.0625em;
  }
  ul, ol {
    padding-left: 1.5rem;
    margin-top: 1rem;
  }
  li {
    margin-top: 0.375rem;
    line-height: 1.75;
  }
  pre, code {
    font-family: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code", monospace;
    font-size: clamp(0.8125rem, 1.5vw, 0.9375rem);
  }
  pre {
    background: hsl(var(--muted));
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin-top: 1rem;
  }
}

/* ─── Reader article bottom padding on mobile (clears fixed action bar) */

@media (max-width: 1023px) {
  #reader-pane .eko-reader-article {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
  }
}

/* ─── Bottom nav active tab indicator ───────────────────────────── */

.eko-nav-btn-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: hsl(var(--primary));
  border-radius: 0 0 2px 2px;
}

/* ─── Unread dot ─────────────────────────────────────────────────── */

.unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.15s ease;
}


/* ─── HTMX loading states ────────────────────────────────────────── */

.htmx-show-on-request {
  display: none;
}
.htmx-request .htmx-show-on-request {
  display: inline-block;
}
.htmx-request .htmx-hide-on-request {
  display: none;
}

/* ─── Keyboard-focused entry ─────────────────────────────────────── */

[data-entry-id].eko-focused {
  background-color: hsl(var(--accent));
  outline: 2px solid hsl(var(--primary));
  outline-offset: -2px;
  border-radius: 0.375rem;
}

/* ─── Toast notifications ────────────────────────────────────────── */
/* Inverted surface (bg/text swap --foreground/--background) so the
   toast always contrasts against the page, in both light and dark. */

.eko-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  border-left: 3px solid hsl(var(--primary));
  box-shadow: 0 10px 30px -6px rgba(0, 0, 0, 0.35), 0 4px 10px -4px rgba(0, 0, 0, 0.2);
  max-width: 360px;
  min-width: 220px;
}

.eko-toast uk-icon {
  flex-shrink: 0;
  margin-top: 0.0625rem;
}

.eko-toast-success {
  border-left-color: hsl(142 71% 45%);
}
.eko-toast-success uk-icon {
  color: hsl(142 71% 45%);
}

.eko-toast-error {
  border-left-color: hsl(var(--destructive));
}
.eko-toast-error uk-icon {
  color: hsl(0 84% 60%);
}

.eko-toast-warning {
  border-left-color: hsl(38 92% 50%);
}
.eko-toast-warning uk-icon {
  color: hsl(38 92% 50%);
}

.eko-toast-info {
  border-left-color: hsl(210 90% 60%);
}
.eko-toast-info uk-icon {
  color: hsl(210 90% 60%);
}

/* ─── Toast container ────────────────────────────────────────────── */
/* <1024px: clear the fixed bottom nav / article bar (~64px + safe-area)
   so toasts don't render underneath them. >=1024px: no bottom chrome. */

#toast-container {
  bottom: calc(64px + env(safe-area-inset-bottom) + 0.75rem);
}

@media (min-width: 1024px) {
  #toast-container {
    bottom: 1rem;
  }
}

/* ─── Keyboard shortcut keys (empty state) ───────────────────────── */

.eko-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  font-family: ui-monospace, monospace;
  font-weight: 500;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
  box-shadow: 0 1px 0 hsl(var(--border)), 0 1px 3px rgba(0,0,0,0.06);
}

/* ─── Topbar action button utilities ─────────────────────────────── */

.eko-icon-btn {
  min-height: 36px;
  min-width: 36px;
  touch-action: manipulation;
}

@media (max-width: 1023px) {
  .eko-icon-btn {
    min-height: 48px;
    min-width: 48px;
  }
}

.eko-action-group {
  display: flex;
  align-items: center;
  background: hsl(var(--muted) / 0.5);
  border-radius: 0.5rem;
  padding: 2px;
  gap: 1px;
}

/* ─── Feed view toggle (Unread / All segmented control) ──────────── */

.eko-feed-toggle {
  display: flex;
  align-items: center;
  background: hsl(var(--muted) / 0.6);
  border-radius: 0.5rem;
  padding: 2px;
  gap: 1px;
}

.eko-feed-toggle-tab {
  min-height: 34px;
  min-width: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(0.5rem - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  color: hsl(var(--muted-foreground));
}

.eko-feed-toggle-tab:hover {
  color: hsl(var(--foreground));
}

.eko-feed-toggle-tab--active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 0 hsl(var(--border) / 0.4);
}

/* Mobile: tabs expand to fill full width */
@media (max-width: 1023px) {
  .eko-feed-toggle {
    flex: 1;
  }
  .eko-feed-toggle-tab {
    flex: 1;
    min-height: 48px;
  }
}

/* ─── Semantic label utilities ───────────────────────────────────── */
/*
 * Replaces arbitrary text-[Xpx] classes in templates.
 * All font sizes are ≥ 14px (0.875rem = text-sm).
 */

.eko-section-label {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.eko-action-label {
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── Mobile entry font scale ────────────────────────────────────── */

@media (max-width: 1023px) {
  .eko-entry-title {
    font-size: 17px;
  }
  .eko-entry-snippet {
    font-size: 15px;
    line-height: 1.55;
  }
}

/* ─── Mobile touch target minimum for small buttons ─────────────── */

@media (max-width: 1023px) {
  .uk-button-small {
    min-height: 44px;
  }
}
