@import "tailwindcss";

@theme {
  /* Colour vars below mirror the `midnight` theme in src/lib/themes.ts.
     applyTheme() overrides these at runtime — keep them in sync so the
     pre-theme initial paint matches and there is no colour flash. */
  --color-bg: #0d0e12;
  --color-bg-raised: #161820;
  --color-bg-hover: #1f222c;
  --color-border: #2b2e3a;
  --color-border-subtle: #1d1f29;
  --color-text: #e8e9ee;
  --color-text-muted: #9a9db0;
  --color-text-dim: #686b7d;
  --color-accent: #a78bfa;
  --color-accent-hover: #8b5cf6;
  --color-accent-text: #ffffff;
  --color-zap: #f5b73d;
  --color-zap-text: #15161a;
  --color-danger: #ef5f6b;
  --color-warning: #f5b73d;
  --color-success: #4cc98a;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", monospace;
  --font-reading: Georgia, "Times New Roman", "Noto Serif", serif;
}

* {
  -webkit-user-select: none;
  user-select: none;
}

/* Allow text selection in note content */
.note-content {
  -webkit-user-select: text;
  user-select: text;
}

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

/* Easy-read font — Atkinson Hyperlegible — toggleable in Settings.
   Designed by the Braille Institute for legibility; helps dyslexic readers
   and anyone reading long sessions. Letter-spacing and line-height nudged
   per evidence-based guidance. */
html.font-readable {
  --font-ui: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
html.font-readable body {
  letter-spacing: 0.012em;
  line-height: 1.65;
}

/* Allow text selection in article editor */
.article-editor textarea,
.article-editor input {
  -webkit-user-select: text;
  user-select: text;
}

/* Article preview prose styles */
.article-preview {
  -webkit-user-select: text;
  user-select: text;
  font-family: var(--font-reading);
  font-size: 15px;
}
.article-preview h1 { font-size: 1.6em; font-weight: bold; margin: 1.2em 0 0.5em; }
.article-preview h2 { font-size: 1.3em; font-weight: bold; margin: 1.2em 0 0.5em; }
.article-preview h3 { font-size: 1.1em; font-weight: bold; margin: 1em 0 0.4em; }
.article-preview p { margin: 0.8em 0; line-height: 1.75; }
.article-preview ul { list-style: disc; padding-left: 1.5em; margin: 0.8em 0; }
.article-preview ol { list-style: decimal; padding-left: 1.5em; margin: 0.8em 0; }
.article-preview li { margin: 0.3em 0; line-height: 1.7; }
.article-preview blockquote { border-left: 3px solid var(--color-accent); padding-left: 1em; color: var(--color-text-muted); margin: 1em 0; }
.article-preview code { font-family: var(--font-mono); background: var(--color-bg-raised); padding: 0.1em 0.4em; font-size: 0.9em; border-radius: 2px; }
.article-preview pre { background: var(--color-bg-raised); border: 1px solid var(--color-border); padding: 1em; overflow-x: auto; margin: 1em 0; }
.article-preview pre code { background: none; padding: 0; }
.article-preview a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 2px; }
.article-preview hr { border: none; border-top: 1px solid var(--color-border); margin: 1.5em 0; }
.article-preview strong { color: var(--color-text); font-weight: 600; }
.article-preview img { max-width: 100%; border-radius: 2px; margin: 0.5em 0; }

/* Article reader — slightly larger type than the editor preview */
.prose-article { -webkit-user-select: text; user-select: text; color: var(--color-text); font-family: var(--font-reading); font-size: 17px; line-height: 1.8; }
.prose-article h1 { font-size: 1.7em; font-weight: bold; margin: 1.4em 0 0.5em; }
.prose-article h2 { font-size: 1.35em; font-weight: bold; margin: 1.4em 0 0.5em; border-bottom: 1px solid var(--color-border); padding-bottom: 0.3em; }
.prose-article h3 { font-size: 1.15em; font-weight: bold; margin: 1.2em 0 0.4em; }
.prose-article p { margin: 0.9em 0; }
.prose-article ul { list-style: disc; padding-left: 1.6em; margin: 0.9em 0; }
.prose-article ol { list-style: decimal; padding-left: 1.6em; margin: 0.9em 0; }
.prose-article li { margin: 0.35em 0; }
.prose-article blockquote { border-left: 3px solid var(--color-accent); padding-left: 1.1em; color: var(--color-text-muted); margin: 1.2em 0; font-style: italic; }
.prose-article code { font-family: var(--font-mono); background: var(--color-bg-raised); padding: 0.15em 0.4em; font-size: 0.88em; border-radius: 2px; }
.prose-article pre { background: var(--color-bg-raised); border: 1px solid var(--color-border); padding: 1.1em; overflow-x: auto; margin: 1.2em 0; border-radius: 2px; }
.prose-article pre code { background: none; padding: 0; }
.prose-article a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 3px; }
.prose-article hr { border: none; border-top: 1px solid var(--color-border); margin: 2em 0; }
.prose-article strong { color: var(--color-text); font-weight: 600; }
/* WebKitGTK scroll-lock workaround: body <img> sometimes collapses to 0 height on re-decode,
   shrinking scrollHeight and clamping the scroll. A fixed aspect-ratio reserves a layout box
   that survives the collapse. object-fit: contain preserves the image's own ratio inside it. */
.prose-article img { display: block; width: 100%; max-width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: var(--color-bg-raised); border-radius: 2px; margin: 1em 0; cursor: zoom-in; }

/* View transition fade-in */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.view-fade-in {
  animation: fade-in 150ms ease-out;
}

/* V4V nudge — slides in, holds, then fades out */
@keyframes nudge-in {
  0% { opacity: 0; transform: translateY(4px); }
  10% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}
.animate-fade-in {
  animation: nudge-in 5s ease-out forwards;
}

/* Toast slide-in */
@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast-enter {
  animation: toast-in 200ms ease-out;
}

/* Reduced motion: collapse all animations/transitions */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 12px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-dim);
}
