/* ─────────────────────────────────────────────────────────────────────────
   Aviquill Notes — shared stylesheet
   Used by: notes/index.html, notes/template.html, and every article page.
   ───────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&family=Sora:wght@700;800&family=VT323&display=swap');

/* ── Design tokens (mirrors landing page) ── */
:root {
  --bg:            #05050a;
  --surface:       #0c0c14;
  --surface-2:     #111119;
  --border:        rgba(255, 255, 255, 0.07);
  --border-bright: rgba(255, 255, 255, 0.14);
  --text:          #ffffff;
  --text-2:        rgba(255, 255, 255, 0.55);
  --text-dim:      rgba(255, 255, 255, 0.3);
  --accent:        #ff006e;
  --accent-glow:   rgba(255, 0, 110, 0.4);
  --accent-light:  #ff66b8;
  --teal:          #aaff00;
  --cyan:          #00ffff;
  --mono:          "JetBrains Mono", monospace;
  --display:       "Sora", "Inter", system-ui, sans-serif;
  --content-max:   1100px;
  --prose-max:     680px;
  --gutter:        clamp(24px, 5vw, 64px);
  --radius:        4px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Film grain ── */
body::after {
  content: "";
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  z-index: 9996;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.4s steps(1) infinite;
}

/* ── Scanlines ── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent, transparent 3px,
    rgba(0,0,0,0.06) 3px, rgba(0,0,0,0.06) 4px
  );
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-6%, -11%); }
  40%  { transform: translate(9%, -4%); }
  60%  { transform: translate(-7%, 9%); }
  80%  { transform: translate(6%, -2%); }
  100% { transform: translate(0, 0); }
}

/* ── Topbar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(5, 5, 10, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 20px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.topbar-brand svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.topbar-brand-name {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 28px;
}

.topbar-nav {
  display: flex;
  gap: 24px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}

.topbar-nav a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}

.topbar-nav a:hover,
.topbar-nav a[aria-current="page"] {
  color: var(--accent);
}

.topbar-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 2px;
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 0 16px var(--accent-glow);
  white-space: nowrap;
}

.topbar-cta:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 0 28px var(--accent-glow);
}

/* ── Footer ── */
.footer {
  border-top: 1px solid rgba(255, 0, 110, 0.12);
  padding: 36px var(--gutter);
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 28px;
}

.footer-links a {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
  font-weight: 500;
}

.footer-links a:hover { color: var(--accent); }

.footer-copy {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

/* ─────────────────────────────────────────────────────────────────────────
   NOTES INDEX
   ───────────────────────────────────────────────────────────────────────── */

.notes-page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(64px, 10vw, 120px) var(--gutter) 80px;
}

.notes-header {
  margin-bottom: 64px;
}

.notes-eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
  display: block;
}

.notes-title {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.notes-subtitle {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-2);
  max-width: 540px;
}

/* ── Entry list ── */
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.note-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 16px 32px;
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
  border-radius: var(--radius);
}

.note-entry:first-child { border-top: 1px solid var(--border); }

.note-entry:hover .note-entry-title {
  color: var(--accent);
}

.note-entry-left { display: flex; flex-direction: column; gap: 10px; }

.note-entry-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.note-tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid transparent;
}

.note-tag--reflection   { color: var(--text-dim); border-color: rgba(255,255,255,0.1); background: rgba(255,255,255,0.04); }
.note-tag--design       { color: var(--accent-light); border-color: rgba(255,0,110,0.25); background: rgba(255,0,110,0.06); }
.note-tag--dev          { color: var(--teal); border-color: rgba(170,255,0,0.25); background: rgba(170,255,0,0.05); }
.note-tag--feature      { color: var(--cyan); border-color: rgba(0,255,255,0.25); background: rgba(0,255,255,0.05); }
.note-tag--update       { color: #7eb8ff; border-color: rgba(126,184,255,0.25); background: rgba(126,184,255,0.05); }

.note-entry-title {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  transition: color 0.15s;
}

.note-entry-desc {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-2);
  max-width: 560px;
}

.note-entry-meta {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding-top: 4px;
}

/* ─────────────────────────────────────────────────────────────────────────
   ARTICLE PAGE
   ───────────────────────────────────────────────────────────────────────── */

.article-wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(48px, 8vw, 96px) var(--gutter) 96px;
}

/* Back link */
.article-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  margin-bottom: 56px;
  transition: color 0.15s;
}

.article-back:hover { color: var(--accent); }

.article-back svg { flex-shrink: 0; }

/* Header */
.article-header {
  max-width: var(--prose-max);
  margin-bottom: 64px;
}

.article-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.article-header-date,
.article-header-read {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.article-header-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}

.article-title {
  font-family: var(--display);
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 22px;
}

.article-lede {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text-2);
}

/* Divider under header */
.article-divider {
  max-width: var(--prose-max);
  border: none;
  border-top: 1px solid var(--border);
  margin-bottom: 56px;
}

/* ── Prose body ── */
.article-body {
  max-width: var(--prose-max);
  font-size: 1.05rem;
  line-height: 1.82;
  color: rgba(255, 255, 255, 0.85);
}

.article-body p {
  margin-bottom: 1.6em;
}

.article-body p:last-child {
  margin-bottom: 0;
}

.article-body h2 {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: var(--text);
  margin: 2.6em 0 0.7em;
}

.article-body h3 {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--text);
  margin: 2em 0 0.5em;
}

.article-body h2:first-child,
.article-body h3:first-child {
  margin-top: 0;
}

/* Blockquote */
.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 24px;
  margin: 2em 0;
  color: var(--text-2);
  font-size: 1.1rem;
  font-style: italic;
  line-height: 1.7;
}

/* Section break */
.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3em 0;
}

/* Inline code */
.article-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--border-bright);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--accent-light);
}

/* ── Media inside prose ── */

/* Standard image — fits prose column */
.article-media {
  margin: 2.5em 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.article-media img,
.article-media gif {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border-bright);
  display: block;
}

/* Wide image — bleeds beyond prose column */
.article-media--wide {
  max-width: min(900px, 90vw);
}

.article-media figcaption {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  line-height: 1.5;
}

/* YouTube embed */
.article-video {
  margin: 2.5em 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-bright);
  aspect-ratio: 16 / 9;
  background: var(--surface);
}

.article-video iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Wide video */
.article-video--wide {
  max-width: min(900px, 90vw);
}

/* ── Article footer ── */
.article-footer {
  max-width: var(--prose-max);
  margin-top: 80px;
  padding-top: 36px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.article-footer-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}

.article-footer-back:hover { color: var(--accent); }

.article-footer-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 2px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 0 16px var(--accent-glow);
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
}

.article-footer-cta:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 0 28px var(--accent-glow);
}

/* ── GIF / image placeholder (shown when src file doesn't exist yet) ── */
.article-media--placeholder {
  background: var(--surface-2);
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-media--placeholder::before {
  content: attr(data-label);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ── Burger button ── */
.topbar-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 3px;
  padding: 0;
  flex-shrink: 0;
}

.topbar-burger span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--text-2);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease, width 0.25s ease;
  transform-origin: center;
}

.topbar-burger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.topbar-burger.open span:nth-child(2) { opacity: 0; width: 0; }
.topbar-burger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── Mobile sidebar ── */
.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(4px);
}

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

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 201;
  width: min(320px, 85vw);
  background: #0c0c14;
  border-left: 1px solid rgba(255,255,255,0.08);
  box-shadow: -8px 0 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.mobile-nav-drawer.open { transform: translateX(0); }

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.mobile-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.mobile-nav-brand svg {
  width: 26px;
  height: 26px;
  color: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.mobile-nav-brand-name {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.mobile-nav-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.mobile-nav-close:hover { color: var(--text); border-color: rgba(255,255,255,0.25); }

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  flex: 1;
}

.mobile-nav-links a {
  display: flex;
  align-items: center;
  padding: 14px 24px;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.mobile-nav-links a:hover,
.mobile-nav-links a[aria-current="page"] {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(255,0,110,0.04);
}

.mobile-nav-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.mobile-nav-footer a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 2px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 0 16px var(--accent-glow);
  transition: opacity 0.15s, transform 0.15s;
}

.mobile-nav-footer a:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .topbar-nav  { display: none; }
  .topbar-cta  { display: none; }
  .topbar-burger { display: flex; }
}

@media (max-width: 640px) {

  .note-entry {
    grid-template-columns: 1fr;
  }

  .note-entry-meta {
    padding-top: 0;
  }

  .article-media--wide,
  .article-video--wide {
    max-width: 100%;
  }
}
