/* Clean Technical Blog Theme - Boxy Archie with Rose Pine Dawn */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,600;1,300&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400&display=swap');

:root {
  --width: 720px;
  --full-width: 1100px;
  --font-main: 'EB Garamond', serif;
  --font-secondary: 'EB Garamond', serif;
  --font-headings: 'EB Garamond', serif;
  --font-scale: 1.15em;
  
  /* Layout */
  --notes-width: 280px;
  --note-gap: 30px;
  
  /* Rose Pine Dawn palette */
  --rp-base: #fdfbf9;
  --rp-muted: #9893a5;
  --rp-subtle: #797593;
  --rp-text: #3a3654;
  --rp-love: #b4637a;
  --rp-gold: #ea9d34;
  --rp-rose: #d7827e;
  --rp-pine: #286983;
  --rp-foam: #56949f;
  --rp-iris: #907aa9;
  --rp-highlight-low: #f4ede8;
  --rp-highlight-med: #dfdad9;
  --rp-highlight-high: #cecacd;
  
  /* Theme colors */
  --background-color: var(--rp-base);
  --heading-color: var(--rp-text);
  --text-color: var(--rp-text);
  --link-color: var(--rp-text);
  --main-color: var(--rp-love);
  
  /* Code colors */
  --code-background-color: transparent;
  --code-border: var(--rp-highlight-high);
  --code-color: var(--rp-text);
  --inline-code-color: var(--rp-love);
  
  /* Blockquote */
  --blockquote-bg: var(--rp-highlight-low);
  --blockquote-border: var(--rp-love);
  
  /* Muted elements */
  --text-muted: var(--rp-muted);
  --border-light: var(--rp-highlight-med);
  
  /* Notes */
  --note-bg: transparent;
  --note-border: var(--rp-love);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-secondary);
  font-size: var(--font-scale);
  max-width: var(--full-width);
  margin: 0 auto;
  padding: 40px 20px;
  line-height: 1.6;
  background-color: var(--background-color);
  color: var(--text-color);
}

/* Headings */
h1, h2, h4, h5, h6 {
  font-family: var(--font-headings);
  font-weight: 600;
  color: var(--heading-color);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

h1 {
  font-size: 2.2em;
  margin-top: 0;
}

h2 {
  font-size: 1.6em;
}

h3 {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 300;
  font-size: 1.4em;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

/* Header */
header {
  max-width: var(--width);
  margin-left: 0;
  margin-bottom: 40px;
  border: none;
}

header::after {
  content: "";
  display: block;
  height: 1px;
  background: linear-gradient(to right, transparent 0%, var(--border-light) 10%, var(--border-light) 90%, transparent 100%);
  margin-top: 20px;
}

.logo {
  margin-bottom: 10px;
}

.logo a {
  font-family: var(--font-headings);
  font-size: 1.8em;
  font-weight: 600;
  color: var(--link-color);
  text-decoration: none;
  border-bottom: none;
}

.logo a:hover {
  background: none;
  color: var(--link-color);
}

nav {
  margin-top: 10px;
}

nav a {
  font-family: var(--font-main);
  font-size: 1em;
  color: var(--link-color);
  text-decoration: none;
  margin-right: 20px;
  border-bottom: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}

nav a:hover {
  opacity: 1;
  background: none;
  color: var(--link-color);
  border-bottom: 2px solid var(--main-color);
}

/* Main content */
main {
  max-width: var(--width);
  margin-bottom: 60px;
  position: relative;
}

main > h1 {
  margin-bottom: 30px;
}

/* Links */
a {
  border-bottom: 2px solid var(--main-color);
  color: var(--link-color);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

a:hover {
  background: var(--main-color);
  color: white;
}

/* Paragraphs */
p {
  margin: 1.2em 0;
  text-align: justify;
}

/* Time */
i time, time {
  font-style: normal;
  opacity: 0.7;
}

/* Article styling */
article {
  margin-bottom: 40px;
  counter-reset: sidenote-counter;
}

article .header {
  font-size: 0.9em;
  color: var(--text-muted);
  margin-bottom: 30px;
  font-style: italic;
}

article section {
  text-align: justify;
}

/* Sidenotes */
.sidenote-ref {
  display: inline;
}

.sidenote-ref::before {
  counter-increment: sidenote-counter;
  content: counter(sidenote-counter);
  font-size: 0.72em;
  vertical-align: super;
  color: var(--main-color);
  margin: 0 2px;
  font-weight: 600;
}

.sidenote {
  float: right;
  clear: right;
  width: var(--notes-width);
  margin-right: calc(-1 * (var(--notes-width) + var(--note-gap)));
  margin-left: 1rem;
  margin-bottom: 1.1rem;
  font-size: 0.8em;
  line-height: 1.4;
  color: var(--text-muted);
  text-align: left;
}

.sidenote::before {
  content: counter(sidenote-counter) ". ";
  color: var(--main-color);
  font-weight: 600;
  font-size: 0.9em;
}

/* Post list */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list li {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-light);
}

.post-list li:last-child {
  border-bottom: none;
}

.post-list a {
  font-weight: 600;
  border-bottom: 2px solid var(--main-color);
}

.post-list a:hover {
  background: var(--main-color);
  color: white;
}

.post-list .date {
  font-size: 0.85em;
  color: var(--text-muted);
  margin-left: 10px;
}

/* Horizontal rule */
hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent 0%, var(--border-light) 10%, var(--border-light) 90%, transparent 100%);
  margin: 40px 0;
}

/* Blockquote */
blockquote {
  border-left: 3px solid var(--blockquote-border);
  background-color: var(--blockquote-bg);
  color: var(--text-color);
  padding: 0.75em 1.25em;
  margin: 1.5em 0;
  border-radius: 0;
  font-style: italic;
}

blockquote p {
  margin: 0.5em 0;
}

blockquote p:first-child {
  margin-top: 0;
}

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

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

li {
  margin-bottom: 0.5em;
}

/* Tables */
table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

th, td {
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  text-align: left;
}

thead th {
  font-weight: 600;
  background: var(--code-background-color);
}

tbody tr:nth-child(even) {
  background: var(--blockquote-bg);
}

/* Inline code */
p code,
li code,
span code,
td code,
th code {
  font-family: 'Geist Mono', monospace;
  font-size: 0.85em;
  padding: 2px 6px;
  background-color: var(--code-background-color);
  border: 1px solid var(--code-border);
  border-radius: 0;
  color: var(--inline-code-color);
  font-weight: 500;
}

/* Code blocks */
code, pre code {
  font-family: 'Geist Mono', monospace;
}

pre {
  background: var(--code-background-color);
  border: 1px solid var(--code-border);
  border-radius: 0;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  overflow-x: auto;
  position: relative;
}

pre code {
  display: block;
  padding: 0;
  font-size: 0.85em;
  line-height: 1.5;
  background: none;
  border: none;
  color: var(--code-color);
}

/* Syntax highlighting colors - Rose Pine Dawn */
code span.al { color: var(--rp-love); font-weight: bold; } /* Alert */
code span.an { color: var(--rp-foam); font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: var(--rp-gold); } /* Attribute */
code span.bn { color: var(--rp-gold); } /* BaseN */
code span.bu { color: var(--rp-pine); } /* BuiltIn */
code span.cf { color: var(--rp-iris); font-weight: bold; } /* ControlFlow */
code span.ch { color: var(--rp-gold); } /* Char */
code span.cn { color: var(--rp-gold); } /* Constant */
code span.co { color: var(--rp-muted); font-style: italic; } /* Comment */
code span.cv { color: var(--rp-muted); font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: var(--rp-muted); font-style: italic; } /* Documentation */
code span.dt { color: var(--rp-foam); } /* DataType */
code span.dv { color: var(--rp-gold); } /* DecVal */
code span.er { color: var(--rp-love); font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: var(--rp-gold); } /* Float */
code span.fu { color: var(--rp-pine); } /* Function */
code span.im { color: var(--rp-iris); font-weight: bold; } /* Import */
code span.in { color: var(--rp-foam); font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: var(--rp-iris); font-weight: bold; } /* Keyword */
code span.op { color: var(--rp-subtle); } /* Operator */
code span.ot { color: var(--rp-iris); } /* Other */
code span.pp { color: var(--rp-love); } /* Preprocessor */
code span.sc { color: var(--rp-rose); } /* SpecialChar */
code span.ss { color: var(--rp-rose); } /* SpecialString */
code span.st { color: var(--rp-rose); } /* String */
code span.va { color: var(--rp-rose); } /* Variable */
code span.vs { color: var(--rp-rose); } /* VerbatimString */
code span.wa { color: var(--rp-gold); font-weight: bold; font-style: italic; } /* Warning */

/* Highlight.js token colors - Rose Pine Dawn */
pre code.hljs {
  background: transparent;
  color: var(--code-color);
}

code .hljs-keyword,
code .hljs-meta .hljs-keyword,
code .hljs-selector-tag {
  color: var(--rp-pine);
  font-weight: 600;
}

code .hljs-title,
code .hljs-name,
code .hljs-literal,
code .hljs-number,
code .hljs-symbol {
  color: var(--rp-rose);
}

code .hljs-string,
code .hljs-regexp,
code .hljs-template-tag,
code .hljs-template-variable,
code .hljs-bullet {
  color: var(--rp-gold);
}

code .hljs-type,
code .hljs-built_in,
code .hljs-title.class_,
code .hljs-selector-class,
code .hljs-selector-id,
code .hljs-meta,
code .hljs-doctag {
  color: var(--rp-foam);
}

code .hljs-attr,
code .hljs-attribute {
  color: var(--rp-iris);
  font-style: italic;
}

code .hljs-variable {
  color: var(--rp-rose);
  font-style: italic;
}

code .hljs-params {
  color: var(--rp-iris);
}

code .hljs-function,
code .hljs-title.function_ {
  color: var(--rp-love);
  font-style: italic;
}

code .hljs-comment,
code .hljs-quote {
  color: var(--rp-muted);
  font-style: italic;
}

code .hljs-operator,
code .hljs-punctuation {
  color: var(--rp-muted);
}

/* Remove link styles from code line numbers */
pre a {
  border-bottom: none;
  color: inherit;
}

pre a:hover {
  background: none;
  color: inherit;
}

/* Copy button for code blocks */
.copy-btn {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  padding: 0.5rem;
  background: var(--background-color);
  border: 1px solid var(--code-border);
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

@media (hover: hover) {
  .copy-btn:hover {
    background: var(--rp-highlight-low);
  }
}

.copy-btn:active {
  background: var(--rp-highlight-low);
}

.copy-btn.copied {
  background: var(--rp-highlight-low);
}

.copy-btn.copy-failed {
  background: var(--rp-love);
  color: white;
}

.copy-btn svg {
  display: block;
  pointer-events: none;
}

/* Footer */
footer {
  max-width: var(--width);
  margin-left: 0;
  padding-top: 20px;
  font-size: 0.85em;
  color: var(--text-muted);
  text-align: center;
}

footer::before {
  content: "";
  display: block;
  height: 1px;
  background: linear-gradient(to right, transparent 0%, var(--border-light) 10%, var(--border-light) 90%, transparent 100%);
  margin-bottom: 20px;
}

footer a {
  color: var(--text-muted);
  border-bottom: 1px solid var(--main-color);
}

footer a:hover {
  background: var(--main-color);
  color: white;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: 0;
}

/* Selection */
::selection {
  background: var(--main-color);
  color: white;
}

/* Mobile responsive */
@media (max-width: 1000px) {
  body {
    max-width: var(--width);
  }

  /* Sidenotes become inline notes - different style from blockquotes */
  .sidenote {
    float: none;
    display: block;
    width: 100%;
    margin: 0.75rem 0;
    padding: 0.5rem 0.75rem;
    background: var(--note-bg);
    border: 1px dashed var(--note-border);
    font-size: 0.85em;
    color: var(--text-muted);
    position: relative;
  }
  
  .sidenote::after {
    content: "";
    position: absolute;
    top: -1px;
    left: 1rem;
    width: 2rem;
    height: 3px;
    background: var(--background-color);
  }
}

@media (max-width: 768px) {
  body {
    padding: 20px 15px;
    font-size: 1.05em;
  }

  h1 {
    font-size: 1.8em;
  }

  h2 {
    font-size: 1.4em;
  }

  nav a {
    margin-right: 15px;
  }

  pre {
    padding: 1rem;
    margin: 1.5rem 0;
  }

  pre code {
    font-size: 0.75rem;
  }

  p {
    text-align: left;
  }

  article section {
    text-align: left;
  }
}
