/* NickMilo.org — Light/Dark Theme */

/* Canela font */
@font-face {
  font-family: 'Canela';
  src: url('/assets/fonts/Canela-Regular-Web.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Canela';
  src: url('/assets/fonts/Canela-Medium-Web.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Canela';
  src: url('/assets/fonts/Canela-Bold-Web.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ========== Light Theme (Rosé Pine Dawn) ========== */
:root {
  --bg: #EEE6DD;
  --bg-secondary: #E4DCD3;
  --border: #C9C1B8;
  --text: #575279;
  --text-muted: #7c7a94;
  
  /* Accent colors */
  --accent: #1A7DA4;       /* sapphire */
  --red: #BA7184;          /* bold */
  --green: #5BA57B;        /* italic */
  --teal: #669EA6;
  --lavender: #9A85AE;
  --yellow: #D19548;
  --peach: #DD7F67;
  --pink: #D270A2;
  --rosewater: #BC708D;
  
  /* Layout */
  --max-width: 600px;
  --font-body: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Canela', Georgia, serif;
  
  /* Header */
  --header-bg: var(--accent);
  --header-text: #EEE6DD;
}

/* ========== Dark Theme (Catppuccin Frappé) — only via .dark class ========== */

/* Manual dark mode class override */
html.dark {
  --bg: #303446;
  --bg-secondary: #414559;
  --border: #5a5d73;
  --text: #c6d0f5;
  --text-muted: #a5adce;
  --accent: #26ABC7;
  --red: #E58BB9;
  --green: #67C48F;
  --teal: #11B7C5;
  --lavender: #BB93D6;
  --yellow: #C9BE3E;
  --peach: #ef9f76;
  --pink: #E58BB9;
  --rosewater: #BC708D;
  --header-bg: var(--accent);
  --header-text: #303446;
}

/* ========== Base Styles ========== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 18px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.7;
  padding: 0;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 3rem;
}

/* ========== Header (Blue Bar — Soft Paper inspired) ========== */
.site-header {
  background: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.3s ease;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--header-text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.site-title:hover {
  color: var(--header-text);
  opacity: 0.85;
}

.site-icon {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
}

/* Nav */
nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

nav a {
  color: var(--header-text);
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.85;
}

nav a:hover {
  color: var(--header-text);
  opacity: 1;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  color: var(--header-text);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem;
  transition: opacity 0.2s;
  opacity: 0.85;
}

.theme-toggle:hover {
  opacity: 1;
}

/* ========== Typography ========== */
article {
  margin-bottom: 3rem;
}

h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 2rem;
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1.3;
  margin-top: 3rem;
  margin-bottom: 1rem;
}

h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--teal);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h4 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--green);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1.5rem;
}

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

ul, ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Emphasis */
strong {
  font-weight: 600;
}

em {
  font-style: italic;
}

/* Links — blue accent on hover */
a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

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

/* ========== Footer ========== */
footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--bg-secondary);
  font-size: 0.875rem;
  color: var(--text-muted);
}

footer a {
  color: var(--text-muted);
}

footer a:hover {
  color: var(--text);
}

/* ========== Notes List (Home) ========== */
.notes-list {
  list-style: none;
  padding-left: 0;
}

.notes-list li {
  margin-bottom: 1.5rem;
}

.notes-list a {
  font-family: var(--font-body);
  font-size: 1rem;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  font-weight: 400;
}

.notes-list a:hover {
  color: var(--accent);
}

/* Chronological notes list */
.notes-chrono {
  list-style: none;
  padding: 0;
}

.notes-chrono li {
  margin-bottom: 0.5rem;
  display: flex;
  gap: 1rem;
}

.note-date {
  font-size: 0.875rem;
  color: var(--text-muted);
  min-width: 5rem;
}

.notes-chrono a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.notes-chrono a:hover {
  color: var(--accent);
}

/* Alphabetical notes list */
.notes-alpha {
  list-style: none;
  padding: 0;
}

.notes-alpha li {
  margin-bottom: 0.5rem;
}

.notes-alpha a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.notes-alpha a:hover {
  color: var(--accent);
}

/* Section note (subtitle) */
.section-note {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--accent);
  margin-left: 0.5rem;
}

/* Latest note section */
.latest-note h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 0;
  margin-top: 0;
}

.latest-note .note-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  margin-bottom: 0;
}

.latest-note h3 a {
  color: var(--text);
  text-decoration: none;
}

.latest-note h3 a:hover {
  color: var(--accent);
}

.latest-excerpt {
  color: var(--text);
  line-height: 1.6;
  margin-top: 1rem;
}

.latest-excerpt a {
  color: var(--accent);
  text-decoration: none;
}

.latest-excerpt a:hover {
  text-decoration: underline;
}

/* Topics list */
.topics-list {
  line-height: 2;
}

.topic-tag {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.topic-tag:hover {
  color: var(--accent);
}

/* ========== Tables ========== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9rem;
}

thead {
  text-align: left;
}

th {
  font-weight: 600;
  color: var(--text);
  padding: 0.75rem 1rem 0.75rem 0;
  border-bottom: 1px solid var(--bg-secondary);
}

td {
  padding: 0.75rem 1rem 0.75rem 0;
  border-bottom: 1px solid var(--bg-secondary);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

/* ========== Blockquotes (Soft Paper blue tint) ========== */
blockquote {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  color: var(--text);
  font-style: italic;
  background: rgba(26, 125, 164, 0.06);
  border-radius: 0 6px 6px 0;
}

/* ========== Horizontal Rules ========== */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ========== Code ========== */
code {
  background: var(--bg-secondary);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

pre {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

pre code {
  background: none;
  padding: 0;
}

/* ========== Responsive ========== */
@media (max-width: 600px) {
  html {
    font-size: 17px;
  }
  
  body {
    padding: 0;
  }
  
  .container {
    padding: 0.75rem 1.25rem 2rem;
  }
  
  .header-inner {
    padding: 0.75rem 1.25rem;
  }
  
  h1 {
    font-size: 1.75rem;
  }
}

/* ========== Backlinks (Andy Matuschak style) ========== */
.backlinks {
  margin-top: 1rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}

.backlinks-container {
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 0.5rem 1.25rem 1.25rem;
}

.backlinks-container h2 {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0.5rem 0 0.75rem;
}

.backlinks-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.backlink-card {
  display: block;
  padding: 0.5rem 0;
  text-decoration: none;
}

.backlink-card:hover .backlink-title {
  color: var(--accent);
}

.backlink-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.25rem;
  transition: color 0.2s;
}

.backlink-excerpt {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

@media (max-width: 500px) {
  .backlinks-grid {
    grid-template-columns: 1fr;
  }
  
  .backlinks {
    padding: 1rem;
  }
}

/* Note subtitle (date + read time) */
.note-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: -1.5rem;
  margin-bottom: 2rem;
}

/* Last revised */
.last-revised {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Note navigation */
.note-nav {
  margin-top: 2rem;
}

.note-nav a {
  color: var(--text-muted);
  font-size: 0.875rem;
}
