/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --font-mono: "IBM Plex Mono", monospace;
  --font-body: "IBM Plex Serif", serif;

  --color-text: #e8e8e8;
  --color-text-dim: rgba(232, 232, 232, 0.45);
  --color-muted: #666666;
  --color-accent: #c8a96e;
  --color-bg: #0f0f0f;
  --color-rule: #2a2a2a;

  /* Spacing scale */
  --page-x: 2rem; /* left/right page padding */
  --page-y: 1rem; /* top/bottom page padding — tight, like pucek */
  --gap-hr: 1.25rem; /* HR margin = 25px each side, ~50px between sections */
  --gap-label: 0.4rem; /* section label → first row */
  --gap-list: 0.6rem; /* last row → view-all link */

  --measure: 65ch;
  --measure-wide: 72ch;

  /* Vertical rhythm scale */
  --space-xs: 0.5rem; /*  8px — tight intra-element gaps */
  --space-sm: 1rem; /* 16px — within-section gaps */
  --space-md: 2rem; /* 32px — between major sections */
  --space-lg: 3rem; /* 48px — header→content, content→footer */
}

/* ============================================================
   RESET
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ============================================================
   BASE
   ============================================================ */
html {
  font-size: 16px;
}

body {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: var(--page-y) var(--page-x);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

a {
  color: var(--color-text);
  transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

/* ============================================================
   LAYOUT SHELL — header / main / footer spacing
   ============================================================ */
header {
  margin-bottom: var(--space-md);
}

main {
  margin-bottom: var(--space-lg);
}

/* ============================================================
   HEADER
   ============================================================ */
.site-name {
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  margin-bottom: 0.15rem;
}

.site-name a {
  text-decoration: none;
  color: var(--color-text);
}

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

nav {
  font-size: 0.875rem;
}

nav a {
  color: var(--color-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

/* ============================================================
   HORIZONTAL RULES
   ============================================================ */
hr {
  border: none;
  border-top: 1px solid rgba(232, 232, 232, 0.22);
  margin: var(--gap-hr) 0;
}

/* ============================================================
   SECTION LABEL  (ESSAYS, PROJECTS, SUBSCRIBE)
   ============================================================ */
.section-label {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-text);
  margin-bottom: var(--gap-label);
}

/* ============================================================
   DOT-LEADER ROWS
   CSS Grid: title | dots | date — three explicit columns.
   grid-row: 1 on all items prevents ::after from wrapping
   to a second row when auto-placement passes column 2.
   ============================================================ */
.dot-row {
  display: grid;
  grid-template-columns: max-content 1fr max-content;
  align-items: baseline;
  overflow: hidden;
  font-size: 0.875rem;
  line-height: 1.55;
}

.dot-row-title {
  grid-column: 1;
  grid-row: 1;
  white-space: nowrap;
}

.dot-row::after {
  grid-column: 2;
  grid-row: 1;
  content: "..............................................................................";
  letter-spacing: 0.1em;
  color: rgba(232, 232, 232, 0.28);
  overflow: hidden;
  white-space: nowrap;
  padding: 0 0.4ch;
  user-select: none;
}

.dot-row-date {
  grid-column: 3;
  grid-row: 1;
  white-space: nowrap;
  color: var(--color-text-dim);
}

.dot-row-title a {
  color: var(--color-text);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: transparent;
}

.dot-row-title a:hover {
  color: var(--color-accent);
  text-decoration-color: var(--color-accent);
}

/* ============================================================
   HOME PAGE
   ============================================================ */
.tagline {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-text);
  margin-top: var(--space-sm);
}

.tagline strong {
  font-weight: 600;
}

.section-list {
  margin-bottom: var(--gap-list);
}

/* Home page sections: breathing room between ESSAYS, PROJECTS, SUBSCRIBE */
.section {
  margin-bottom: var(--space-md);
}

.view-all {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--color-muted);
  text-decoration: none;
}

.view-all:hover {
  color: var(--color-text);
}

/* Subscribe sits below Projects — give it breathing room without a divider */
.subscribe-section {
  margin-top: var(--space-md);
}

/* ============================================================
   GALLERY PAGES  (/essays, /projects)
   ============================================================ */
.gallery-list {
  list-style: none;
}

.gallery-item {
  margin-bottom: 1.25rem;
}

.gallery-item-description {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-style: italic;
  color: var(--color-muted);
  margin-top: 0.2rem;
  line-height: 1.45;
}

/* ============================================================
   INDIVIDUAL POST  (essay / project page)
   ============================================================ */
.post-title {
  font-family: var(--font-body);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 0.4rem;
}

.post-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-dim);
  margin-bottom: var(--space-md);
}

.post-body {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--color-text);
  max-width: var(--measure);
  margin-bottom: var(--space-lg);
}

.post-body p {
  margin-bottom: 1.3em;
}
.post-body ul,
.post-body ol {
  padding-left: 1.5em;
  margin-bottom: 1.3em;
}
.post-body li {
  margin-bottom: 0.3em;
}
.post-body hr {
  margin: 2em 0;
}

.post-body h2 {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin: 2.25em 0 0.75em;
}

.post-body h3 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-muted);
  margin: 1.75em 0 0.5em;
}

.post-body a {
  color: var(--color-text);
  text-underline-offset: 3px;
}

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

.post-body blockquote {
  border-left: 2px solid var(--color-rule);
  padding-left: 1.25em;
  margin: 1.5em 0;
  color: var(--color-muted);
  font-style: italic;
}

.post-body img {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 0.5em;
}
.post-body figure {
  margin: 2em 0;
}
.post-body figcaption {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 0.5em;
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: #1e1e1e;
  padding: 0.1em 0.3em;
  border-radius: 2px;
}

.post-body pre {
  background: #1e1e1e;
  padding: 1em 1.25em;
  overflow-x: auto;
  margin: 1.5em 0;
}

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

/* ============================================================
   SUBSCRIBE FORM
   ============================================================ */
.subscribe-section p:not(.section-label) {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 0.6rem;
}

.subscribe-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.subscribe-form input[type="email"] {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.45em 0.75em;
  border: 1px solid rgba(232, 232, 232, 0.2);
  background: var(--color-bg);
  color: var(--color-text);
  flex: 1;
  min-width: 200px;
  outline: none;
}

.subscribe-form input[type="email"]:focus {
  border-color: var(--color-accent);
}

.subscribe-form button {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.45em 1em;
  border: 1px solid var(--color-accent);
  background: var(--color-accent);
  color: #0f0f0f;
  cursor: pointer;
  white-space: nowrap;
}

.subscribe-form button:hover {
  opacity: 0.85;
}

/* Async submit — success message */
.subscribe-confirm {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--color-text);
  animation: subscribe-fade-up 0.35s ease both;
}

/* Delayed "Thank you" appended inline after confirm */
.subscribe-thankyou {
  animation: subscribe-fade-up 0.35s ease both;
}

/* Async submit — inline error */
.subscribe-error {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #e07070;
  margin-top: 0.5rem;
  width: 100%;
  animation: subscribe-fade-up 0.2s ease both;
}

@keyframes subscribe-fade-up {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   SUBSCRIBED PAGE
   ============================================================ */
.subscribed {
  max-width: var(--measure);
  animation: subscribe-fade-up 0.5s ease both;
}

.subscribed-mark {
  font-size: 1.5rem;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
}

.subscribed-heading {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-text);
  margin-bottom: 1.25rem;
}

.subscribed-body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-text-dim);
  margin-bottom: 0.5rem;
}

.subscribed-link {
  display: inline-block;
  margin-top: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-muted);
  text-decoration: none;
}

.subscribed-link:hover {
  color: var(--color-text);
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-dim);
}

footer a {
  color: var(--color-text-dim);
  text-decoration: none;
}

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

.copyright {
  margin-top: 0.3rem;
  font-size: 0.75rem;
}

/* ============================================================
   UTILITY
   ============================================================ */
.muted {
  color: var(--color-muted);
}
