/* ==========================================================================
   12ak.com — Redesign: editorial serif aesthetic
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts: Literata (headings + body), IBM Plex Sans (UI), IBM Plex Mono (code)
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;1,400&family=Literata:ital,opsz,wght@0,7..72,400;0,7..72,500;0,7..72,600;0,7..72,700;0,7..72,900;1,7..72,400&display=swap');

/* --------------------------------------------------------------------------
   Design tokens
   -------------------------------------------------------------------------- */
:root {
  --bg:            #f5f1eb;
  --text:          #1A1A1A;
  --text-muted:    #767676;
  --accent:        #D1D1D1;
  --accent-color:  #b85c38;
  --accent-hover:  #8f4528;
  --border:        rgba(209, 209, 209, 0.7);

  --font-heading: 'Literata', Georgia, serif;
  --font-serif:   'Literata', Georgia, serif;
  --font-sans:    'IBM Plex Sans', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;

  --content-width: 700px;
  --header-height: 56px;
}

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

html {
  font-size: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-serif);
  font-size: 1.25rem;        /* 20px */
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

/* Subtle paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  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='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
main {
  max-width: calc(var(--content-width) + 4rem);
  margin: 0 auto;
  padding: 0 2rem;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  height: var(--header-height);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
  border-bottom: 0.5px solid var(--border);
}

.header-inner {
  max-width: calc(var(--content-width) + 4rem);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-name {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  letter-spacing: 0;
}

.site-logo {
  display: block;
  border-radius: 50%;
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.site-nav a {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 180ms ease;
}

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

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  max-width: calc(var(--content-width) + 4rem);
  margin: 5rem auto 0;
  padding: 1.5rem 2rem 3rem;
  border-top: 0.5px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 180ms ease;
}

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

/* --------------------------------------------------------------------------
   Home page
   -------------------------------------------------------------------------- */
.site-intro {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: #555;
  margin: 3.5rem 0 5rem;
  max-width: var(--content-width);
  line-height: 1.65;
}

.year-group {
  max-width: var(--content-width);
  margin-bottom: 3rem;
}

.year-group:first-child {
  margin-top: 3.5rem;
}

.year-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--text);
}

.year-number {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.year-count {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  position: relative;
  top: -0.15em;
}

.year-posts {
  list-style: none;
}

.year-posts li {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 1.25rem;
  padding: 1rem 0;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

.year-posts li:last-child {
  border-bottom: none;
}

.post-item-date {
  position: relative;
  top: 0;
}

.post-date-string {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent-color);
  white-space: nowrap;
}

.post-item-content {
  min-width: 0;
}

.year-posts h3 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
  margin: 0 0 0.5rem;
}

.year-posts h3 a {
  color: var(--text);
  text-decoration: none;
  background-image: linear-gradient(var(--accent-color), var(--accent-color));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.3s ease;
}

.year-posts h3 a:hover {
  background-size: 100% 2px;
}

.post-description {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  color: #555;
  margin: 0;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Section header (list.html)
   -------------------------------------------------------------------------- */
.section-header {
  max-width: var(--content-width);
  padding-top: 4rem;
  margin-bottom: 3rem;
}

.section-header h1 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.section-description {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Single post: two-column layout
   -------------------------------------------------------------------------- */
.post-layout {
  max-width: var(--content-width);
}

/* --------------------------------------------------------------------------
   Post header
   -------------------------------------------------------------------------- */
.post-header {
  padding-top: 7.5rem;  /* 120px */
  margin-bottom: 3rem;
}

.post-header h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.25rem, 4.5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 1rem;
  color: var(--text);
}

.post-subtitle {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  color: #555;
  font-style: normal;
  font-weight: 400;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.post-meta {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.post-meta time {
  color: var(--accent-color);
}

.post-meta-sep {
  opacity: 0.4;
}

/* --------------------------------------------------------------------------
   Post body typography
   -------------------------------------------------------------------------- */
.post-body {
  font-family: var(--font-serif);
  font-size: 1.25rem;   /* 20px */
  line-height: 1.65;
}

/* Drop cap on first paragraph */
.post-body > p:first-of-type::first-letter {
  font-family: var(--font-heading);
  font-size: 5em;
  font-weight: 700;
  float: left;
  line-height: 0.78;
  margin: 0.08em 0.07em 0 0;
  color: var(--text);
}

/* Headings */
.post-body h2 {
  font-family: var(--font-heading);
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 3.5rem 0 1rem;
  color: var(--text);
}

.post-body h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 2.5rem 0 0.75rem;
  color: var(--text);
}

.post-body h4 {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 2rem 0 0.5rem;
}

/* Paragraphs */
.post-body p {
  margin-bottom: 1.5rem;
}

/* Links */
.post-body a {
  color: var(--accent-color);
  text-decoration: none;
  background-image: linear-gradient(var(--accent-color), var(--accent-color));
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 250ms ease, color 180ms ease;
}

.post-body a:hover {
  color: var(--accent-hover);
  background-size: 100% 1px;
}

.post-body strong a {
  color: var(--accent-color);
}

.post-body a:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Strong */
.post-body strong {
  font-weight: 600;
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Horizontal rule — tilde separator
   -------------------------------------------------------------------------- */
.post-body hr {
  border: none;
  margin: 3rem 0;
  height: 2rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.post-body hr::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #bbb;
}

.post-body hr::after {
  content: '~';
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  font-style: italic;
  color: #888;
  background: var(--bg);
  padding: 0 0.5rem;
  position: relative;
  z-index: 1;
  line-height: 1;
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Blockquote
   -------------------------------------------------------------------------- */
.post-body blockquote {
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.6;
  color: #555;
  margin: 2rem 0 2rem 1.5rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--accent-color);
}

.post-body blockquote p {
  margin: 0;
}

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

.post-body ul {
  list-style: none;
}

.post-body ul li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.4rem;
}

.post-body ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
}

.post-body ol li {
  margin-bottom: 0.4rem;
}

/* --------------------------------------------------------------------------
   Code
   -------------------------------------------------------------------------- */
.post-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(26, 26, 26, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.post-body pre {
  background: rgba(26, 26, 26, 0.04);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

.post-body pre code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.post-body table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 2rem 0;
  border: 0.5px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
}

.post-body thead {
  background: rgba(26, 26, 26, 0.04);
}

.post-body th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 0.5px solid var(--border);
}

.post-body td {
  padding: 0.75rem 1rem;
  border-bottom: 0.5px solid var(--border);
  color: var(--text);
}

.post-body tbody tr:last-child td {
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   Figures and images
   -------------------------------------------------------------------------- */
.post-body figure {
  margin: 2.5rem 0;
}

.post-body figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 3px;
  box-shadow: 0 4px 24px rgba(26, 26, 26, 0.08);
  transition: transform 280ms ease, box-shadow 280ms ease;
  cursor: zoom-in;
}

.post-body figure img:hover {
  transform: scale(1.01);
  box-shadow: 0 6px 32px rgba(26, 26, 26, 0.12);
}

.post-body figcaption {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
  line-height: 1.4;
  text-align: center;
}

.post-body figcaption .fig-tools {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-color);
  margin-bottom: 0.2em;
  font-style: normal;
}

/* Embedded video */
.post-body iframe {
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(26, 26, 26, 0.08);
}

.post-body div:has(> iframe) {
  margin: 2rem 0;
}



/* --------------------------------------------------------------------------
   About page
   -------------------------------------------------------------------------- */
.about {
  font-size: 1.2rem;
  line-height: 1.7;
  padding-top: 2rem;
}

.about a {
  color: var(--accent-color);
  text-decoration: none;
  background-image: linear-gradient(var(--accent-color), var(--accent-color));
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 250ms ease, color 180ms ease;
}

.about a:hover {
  color: var(--accent-hover);
  background-size: 100% 1px;
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 12, 8, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
  cursor: zoom-out;
}

.lightbox--open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox__wrap {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox__stage {
  position: relative;
  height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 3px;
  object-fit: contain;
  cursor: default;
  transform: scale(0.96);
  transition: transform 300ms ease;
}

.lightbox--open .lightbox__img {
  transform: scale(1);
}

.lightbox__close {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 2;
  background: none;
  border: none;
  color: rgba(245, 242, 233, 0.8);
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 200ms ease;
}

.lightbox__close:hover {
  background: rgba(245, 242, 233, 0.15);
}

.lightbox__nav {
  position: absolute;
  top: 0;
  bottom: 0;
  margin-block: auto;
  z-index: 1;
  background: rgba(245, 242, 233, 0.1);
  border: none;
  color: rgba(245, 242, 233, 0.8);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 200ms ease;
  backdrop-filter: blur(4px);
}

.lightbox__nav:hover {
  background: rgba(245, 242, 233, 0.22);
}

.lightbox__nav--prev { left: -56px; }
.lightbox__nav--next { right: -56px; }

.lightbox__footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25em;
  margin-top: 1rem;
  min-height: 3.5rem;
}

.lightbox__tools {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-color);
}

.lightbox__caption {
  color: rgba(245, 242, 233, 0.75);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-style: italic;
  text-align: center;
}

.lightbox__counter {
  color: rgba(245, 242, 233, 0.35);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/* Tablet */
@media (max-width: 960px) {
  .post-header {
    padding-top: 3.5rem;
  }
}

/* Mobile */
@media (max-width: 640px) {
  body {
    font-size: 1.125rem;  /* 18px */
  }

  main {
    padding: 0 1.25rem;
  }

  .header-inner {
    padding: 0 1.25rem;
  }

  .post-header {
    padding-top: 2.5rem;
  }

  .post-header h1 {
    font-size: 2.25rem;
  }

  .post-body > p:first-of-type::first-letter {
    font-size: 3.75em;
  }

  .post-body blockquote {
    margin: 2rem 0;
    font-size: 1.125rem;
  }

  .year-posts li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .post-item-date {
    padding-top: 0;
  }

  .site-footer {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem 1.25rem 2.5rem;
  }
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */
@media print {
  body::before,
  .site-header,
  .site-footer {
    display: none;
  }

  body {
    font-size: 12pt;
    background: #fff;
    color: #000;
  }

  .post-body a::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    color: #666;
  }
}
