/*
  Blog styles - Marginalia layout
  - Narrow text column for readability
  - Wide margin for dates, notes, small images
  - Breakout images for full-width impact
  - Handcrafted, minimal aesthetic
*/

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --text-width: 720px;
  --margin-width: 180px;
  --gap: 40px;
  --total-width: calc(var(--text-width) + var(--margin-width) + var(--gap));
}

body {
  background: #000;
  color: #fff;
  font-family: 'Atkinson Hyperlegible Mono', monospace;
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
}

/* Navigation */
nav {
  padding: 30px 40px;
  display: flex;
  gap: 2rem;
}

nav a {
  color: #555;
  text-decoration: none;
  font-size: 0.9rem;
}

nav a:hover,
nav a.active {
  color: #fff;
}

/* Main content wrapper */
main {
  max-width: var(--total-width);
  margin: 0 auto;
  padding: 40px;
}

/* Landing page */
.landing {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 150px);
  max-width: var(--text-width);
  position: relative;
}

.landing::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('images/biblioteca.png') no-repeat center center;
  background-size: cover;
  opacity: 0.12;
  pointer-events: none;
  z-index: -1;
}

.landing h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  font-weight: 400;
}

.tagline {
  color: #666;
  margin-bottom: 2.5rem;
}

.links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.links a {
  color: #888;
  text-decoration: none;
}

.links a:hover {
  color: #fff;
}

/* Article layout with marginalia */
article {
  display: grid;
  grid-template-columns: var(--text-width) var(--margin-width);
  gap: var(--gap);
}

article > * {
  grid-column: 1;
}

/* Margin notes - sit in the right column */
.margin-note {
  grid-column: 2;
  font-size: 0.85rem;
  color: #555;
  align-self: start;
}

.margin-note.date {
  position: sticky;
  top: 40px;
}

/* Breakout images - span full viewport */
.img-breakout {
  grid-column: 1 / -1;
  width: calc(100vw - 80px);
  max-width: 1200px;
  margin-left: 50%;
  transform: translateX(-50%);
  margin-top: 2rem;
  margin-bottom: 2rem;
}

/* Typography */
h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  line-height: 1.25;
}

h2 {
  font-size: 1.4rem;
  margin: 2rem 0 0.8rem;
  font-weight: 500;
  color: #fff;
}

h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
  font-weight: 500;
}

p {
  margin-bottom: 0.8rem;
  text-align: justify;
}

a {
  color: #666;
}

a:hover {
  color: #fff;
}

ul, ol {
  margin-left: 1.2rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.3rem;
}

code {
  background: #111;
  padding: 2px 6px;
  font-size: 0.9em;
}

pre {
  background: #111;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

blockquote {
  border-left: 1px solid #333;
  padding-left: 1rem;
  color: #888;
  margin: 1.5rem 0;
}

hr {
  border: none;
  border-top: 1px solid #1a1a1a;
  margin: 2rem 0;
}

/* Article header */
.article-header {
  margin-bottom: 2rem;
}

.article-header h1 {
  margin-bottom: 0;
}

.article-date {
  color: #444;
  font-size: 0.85rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  color: #444;
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  color: #fff;
}

/* Article list (blog page) */
.article-list {
  list-style: none;
  margin: 0;
  max-width: var(--text-width);
}

.article-list li {
  margin-bottom: 0.5rem;
}

.article-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  text-decoration: none;
  padding: 0.75rem 0;
  border-bottom: 1px solid #111;
}

.article-list a:hover {
  border-color: #333;
}

.article-list .title {
  color: #fff;
}

.article-list .date {
  color: #444;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Image positioning within text column */
img {
  max-width: 100%;
  display: block;
  margin: 1.2rem 0;
}

.img-right {
  float: right;
  max-width: 50%;
  margin: 0.5rem 0 1rem 1.5rem;
}

.img-left {
  float: left;
  max-width: 50%;
  margin: 0.5rem 1.5rem 1rem 0;
}

.img-small {
  max-width: 180px;
}

.img-medium {
  max-width: 300px;
}

/* Margin image - small image in the margin column */
.img-margin {
  grid-column: 2;
  max-width: 100%;
  margin: 0;
}

.clear {
  clear: both;
}

/* Hand-drawn circle highlights - multiple variations */
.circle, .circle-1, .circle-2, .circle-3, .circle-4 {
  position: relative;
  white-space: nowrap;
  isolation: isolate;
}

.circle::before, .circle-1::before, .circle-2::before, .circle-3::before, .circle-4::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  pointer-events: none;
  z-index: -1;
}

/* Variation 1 - tilted left, wobbly */
.circle::before, .circle-1::before {
  width: calc(100% + 28px);
  height: calc(100% + 26px);
  transform: translate(-50%, -50%) rotate(-2deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 50' preserveAspectRatio='none'%3E%3Cpath d='M 6 25 Q 4 10, 28 6 Q 52 2, 78 8 Q 97 14, 95 28 Q 93 44, 65 47 Q 35 50, 14 42 Q 3 36, 6 25' fill='none' stroke='%23c43' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center;
  background-size: 100% 100%;
}

/* Variation 2 - tilted right, rounder */
.circle-2::before {
  width: calc(100% + 30px);
  height: calc(100% + 28px);
  transform: translate(-50%, -50%) rotate(2deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 50' preserveAspectRatio='none'%3E%3Cpath d='M 10 22 Q 8 8, 35 5 Q 60 2, 82 10 Q 96 18, 92 32 Q 88 46, 55 48 Q 22 50, 8 38 Q 2 30, 10 22' fill='none' stroke='%23c43' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center;
  background-size: 100% 100%;
}

/* Variation 3 - more oval, slight tilt */
.circle-3::before {
  width: calc(100% + 32px);
  height: calc(100% + 24px);
  transform: translate(-50%, -50%) rotate(-1deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 50' preserveAspectRatio='none'%3E%3Cpath d='M 5 26 Q 3 12, 25 7 Q 50 2, 80 9 Q 98 16, 96 28 Q 94 42, 70 46 Q 40 50, 15 43 Q 2 38, 5 26' fill='none' stroke='%23c43' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center;
  background-size: 100% 100%;
}

/* Variation 4 - messier, like drawn quickly */
.circle-4::before {
  width: calc(100% + 40px);
  height: calc(100% + 16px);
  transform: translate(-50%, -50%) rotate(1deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 50' preserveAspectRatio='none'%3E%3Cpath d='M 12 28 Q 6 14, 32 8 Q 55 3, 76 12 Q 95 20, 90 33 Q 85 46, 58 47 Q 28 48, 10 40 Q 4 34, 12 28' fill='none' stroke='%23c43' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center;
  background-size: 100% 100%;
}

/* Responsive - collapse to single column */
@media (max-width: 900px) {
  :root {
    --text-width: 100%;
    --margin-width: 0;
    --gap: 0;
  }

  main {
    padding: 20px;
  }

  nav {
    padding: 20px;
  }

  article {
    display: block;
  }

  .margin-note {
    display: block;
    margin-bottom: 1.5rem;
    color: #444;
  }

  .margin-note.date {
    position: static;
  }

  .img-breakout {
    width: calc(100vw - 40px);
    margin-left: -20px;
    transform: none;
  }

  .img-margin {
    max-width: 100%;
    margin: 1.5rem 0;
  }

  .img-right,
  .img-left {
    float: none;
    max-width: 100%;
    margin: 1.5rem 0;
  }

  .landing h1 {
    font-size: 1.8rem;
  }
}
