/* base.css – layout, typography, header/footer */
@import url("variables.css");

html {
  /* Reserve the scrollbar gutter always — the sticky top bar shifts ~15px
     sideways every navigation between short and long pages otherwise. */
  scrollbar-gutter: stable;
}

body {
  font-family: var(--oh-font-sans, Arial, Helvetica, sans-serif);
  margin: 0;
  padding: 0 var(--page-padding);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1100px;
  width: 90%;
  margin: 18px auto 40px;
  padding: 40px 60px;
  background: var(--container-bg);
  border: 1px solid var(--container-border);
  border-radius: var(--oh-radius-lg);
  /* soft ambient lift — the old 4px 4px offset read as an OS panel */
  box-shadow: 0 8px 28px var(--container-shadow);
  flex: 1 0 auto;
}

/* Force darker border in dark mode if variables are not cascading */
html.oh-dark .container {
  border-color: var(--container-border-dark, #444);
}

header {
  background: #333;
  color: #fff;
  padding: 1em 0;
  text-align: center;
}

nav a {
  color: #fff;
  margin: 0 10px;
  text-decoration: none;
}
nav a:hover { text-decoration: underline; }

main { padding: 20px; }

footer {
  padding-top: 1rem;
  border-top: 1px solid var(--container-border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--fg-muted, #666);
  width: 100%;
  flex-shrink: 0;
}

.pinned-label{
  position:absolute;
  top:6px;   /* tweak to taste */
  right:6px;
  color:var(--oh-accent);
}

html.oh-dark .pinned-label{
  color:var(--oh-accent);
}

/* ------------------------------------------------------------------
   Motion — one easing/speed across the app. A mount fade for cards and
   rows (also fires on htmx swaps, which is the desired effect), plus a
   unified transition for every interactive element.
   ------------------------------------------------------------------ */
@keyframes oh-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.paper-row,
.topic-card,
.lib-item,
.lib-notion-card,
.empty-state-card,
.oh-surface,
.report-card {
  animation: oh-fade-up var(--oh-speed) var(--oh-ease) both;
}

/* Result rows cascade in one at a time — the page arrives, it doesn't
   just pop. Delays capped at 8 rows; later rows share the last delay. */
.paper-row:nth-child(2)  { animation-delay: 40ms; }
.paper-row:nth-child(3)  { animation-delay: 80ms; }
.paper-row:nth-child(4)  { animation-delay: 120ms; }
.paper-row:nth-child(5)  { animation-delay: 160ms; }
.paper-row:nth-child(6)  { animation-delay: 200ms; }
.paper-row:nth-child(7)  { animation-delay: 240ms; }
.paper-row:nth-child(n+8) { animation-delay: 280ms; }

a, button, .btn-secondary, .oh-search-btn,
.top-bar-link, .oh-related-chip, .oh-topic-pill, .oh-foryou-chip,
input, select, textarea, summary {
  transition:
    color var(--oh-speed) var(--oh-ease),
    background-color var(--oh-speed) var(--oh-ease),
    border-color var(--oh-speed) var(--oh-ease),
    box-shadow var(--oh-speed) var(--oh-ease),
    transform var(--oh-speed) var(--oh-ease),
    opacity var(--oh-speed) var(--oh-ease);
}

/* subtle press/hover lift on card-like rows */
.paper-row:hover, .topic-card:hover, .lib-item:hover {
  border-color: var(--oh-accent);
}

/* One focus ring for the whole app — keyboard users deserve to see
   where they are; mouse users never trigger :focus-visible. */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--oh-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------------
   Paper grain — faint fractal noise so the canvas reads as paper, not
   a flat template background. Fixed overlay, pointer-events none; sits
   over everything (including modals) so the texture is cohesive.
   ------------------------------------------------------------------ */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
html.oh-dark body::after {
  opacity: 0.07;
  filter: invert(1);
}

/* dark-mode tweaks handled via CSS vars above */
