@layer base {
/* attn — base styles
 * Theme variables live in src/app.css (shadcn/Tailwind system).
 * This file provides typography, layout, and element styles.
 */

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global font scaling (Cmd/Ctrl + / - / 0) */
:root {
    --attn-base-font-size: 15.5px;
    --attn-font-scale: 1;
}

html {
    font-size: calc(var(--attn-base-font-size) * var(--attn-font-scale));
}

/* Base */
html, body {
    height: 100%;
    background: var(--background);
    color: var(--foreground);
    font-family: 'Source Serif 4 Variable', 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    line-height: 1.72;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: 0.003em;
    overflow: hidden;
}

/* Paper grain texture overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: var(--grain-opacity, 0.035);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

#app {
    height: 100%;
    overflow: hidden;
}

/* UI chrome uses sans-serif; content areas inherit serif from body */
[data-slot="sidebar"],
[data-slot="sidebar"] *,
nav,
.breadcrumb,
.directory-listing {
    font-family: 'Source Sans 3 Variable', 'Source Sans 3', -apple-system, system-ui, sans-serif;
}

/* Reading column */
article {
    max-width: min(105ch, calc(100vw - 2rem));
    margin: 0 auto;
    padding: 2.5rem clamp(1rem, 2.8vw, 2rem) 6rem;
}

/* Typography scale */
h1 { font-size: 2rem; line-height: 1.18; margin-top: 2.5rem; margin-bottom: 0.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; line-height: 1.24; margin-top: 2.25rem; margin-bottom: 0.5rem; font-weight: 600; letter-spacing: -0.015em; }
h3 { font-size: 1.25rem; line-height: 1.3; margin-top: 2rem; margin-bottom: 0.4rem; font-weight: 600; letter-spacing: -0.01em; }
h4 { font-size: 1.1rem; line-height: 1.4; margin-top: 1.75rem; margin-bottom: 0.4rem; font-weight: 600; letter-spacing: -0.005em; }
h5, h6 { font-size: 1rem; line-height: 1.5; margin-top: 1.5rem; margin-bottom: 0.4rem; font-weight: 600; }
h6 { font-style: italic; font-weight: 400; }

h1:first-child { margin-top: 0; }

p {
    margin-bottom: 1rem;
}

/* Links */
a {
    color: var(--link);
    text-decoration: none;
    text-underline-offset: 2px;
    transition: color 0.12s ease;
}
a:visited {
    color: var(--link-visited);
}
a:hover {
    color: var(--link-hover);
    text-decoration: underline;
    text-decoration-thickness: 1px;
}
a:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Code */
code {
    font-family: 'Source Code Pro Variable', 'Source Code Pro', 'SF Mono', Consolas, monospace;
    font-size: 0.84em;
    background: var(--code-block);
    padding: 0.15em 0.32em;
    border-radius: 3px;
}

pre {
    margin-bottom: 1.25rem;
    padding: 1rem 1.125rem;
    background: var(--code-block);
    border-radius: 6px;
    border: 1px solid var(--border);
    overflow-x: auto;
    line-height: 1.55;
    box-shadow: inset 0 1px 3px oklch(0 0 0 / 4%);
}


pre code {
    display: block;
    background: none;
    border: 0;
    border-radius: 0;
    padding: 0;
    font-size: 0.85rem;
}

/* Lists */
ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.25rem;
}

li > ul, li > ol {
    margin-bottom: 0;
    margin-top: 0.25rem;
}

/* Task lists — comrak outputs <li><input type="checkbox"> text</li>
   without special classes, so we target the structure directly. */
li:has(> input[type="checkbox"]) {
    list-style: none;
    position: relative;
    padding-left: 1.75rem;
    margin-left: -1.5rem;
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    left: 0;
    top: 0.35em;
    cursor: pointer;
    width: 1rem;
    height: 1rem;
    border: 1.5px solid var(--muted-foreground);
    border-radius: 3px;
    background: transparent;
    transition: background 0.15s, border-color 0.15s;
}

input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
    background-size: 100% 100%;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

th, td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--muted);
}

th {
    font-family: 'Source Sans 3 Variable', 'Source Sans 3', -apple-system, system-ui, sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-foreground);
    border-bottom-width: 2px;
}

/* Blockquotes */
blockquote {
    margin-bottom: 1rem;
    padding: 0.4rem 1.25rem;
    border-left: 2.5px solid var(--blockquote-bar);
    color: var(--muted-foreground);
}

blockquote p {
    margin-bottom: 0.45rem;
}

blockquote p:last-child {
    margin-bottom: 0;
}

/* Horizontal rules */
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem auto;
    max-width: 8rem;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1rem 0;
}

/* Directory listing */
.directory-listing h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.dir-entry {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 4px;
}

.dir-entry:hover {
    background: var(--accent);
}

.dir-entry.dir {
    font-weight: 600;
}

}

/* Scrollbar styles — intentionally unlayered so they override native scrollbars in WebKit. */
pre::-webkit-scrollbar {
  height: 6px;
  background: transparent;
}

pre::-webkit-scrollbar-track {
  background: transparent;
}

pre::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 999px;
}

pre::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.dark pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
}

.dark pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}
