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

:root {
  --text: #2c2825;
  --text-secondary: #77716e;
  --bg: #fbf9f7;
  --accent: #96533a;
  --rule: #e6e2de;
  --max-w: 40rem;
  --font: "freight-text-pro", Georgia, serif;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

html {
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-weight: 400;
  font-kerning: normal;
}


/* ---- Layout ---- */

header, main, footer {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
}

main {
  flex: 1;
  padding-top: 3rem;
  padding-bottom: 6rem;
}


/* ---- Navigation ---- */

header {
  padding-top: 2.5rem;
  padding-bottom: 2rem;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-name {
  text-decoration: none;
  display: flex;
  align-items: center;
}

.site-logo {
  height: 1.7rem;
  width: auto;
}

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

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 1rem;
  letter-spacing: 0.02em;
  transition: color 200ms cubic-bezier(0.25, 1, 0.5, 1);
}

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

.rss-link {
  font-variant: small-caps;
  letter-spacing: 0.04em;
}


/* ---- Post listing ---- */

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

.post-list li {
  padding: 1.5rem 0;
}

.post-list li + li {
  border-top: 1px solid var(--rule);
}

.post-list a {
  text-decoration: none;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
}

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

.post-list .post-title {
  font-size: 1.3rem;
  font-weight: 700;
  transition: color 200ms cubic-bezier(0.25, 1, 0.5, 1);
}

.post-list .post-meta {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
}

.post-list .post-excerpt {
  display: none;
}


/* ---- Single post ---- */

.post-header {
  margin-bottom: 3rem;
  padding: 0 0 2rem;
  border-bottom: 1px solid var(--rule);
}

.post-header time {
  font-size: 0.95rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  font-weight: 400;
}

.post-header h1 {
  font-size: clamp(2.1rem, 5vw, 2.9rem);
  line-height: 1.2;
  margin-top: 0.5rem;
  font-weight: 700;
}

.post-description {
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.75rem;
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1.6;
}


/* ---- Prose ---- */

.post-body, .page-body {
  font-size: 1.2rem;
  line-height: 1.85;
  font-weight: 400;
}

.post-body h2, .page-body h2 {
  font-size: 1.5rem;
  margin: 3rem 0 1rem;
  font-weight: 700;
}

.post-body h3, .page-body h3 {
  font-size: 1.25rem;
  margin: 2rem 0 0.75rem;
  font-weight: 700;
}

.post-body p, .page-body p {
  margin-bottom: 1.5rem;
}

.post-body a, .page-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  transition: opacity 200ms cubic-bezier(0.25, 1, 0.5, 1);
}

.post-body a:hover, .page-body a:hover {
  opacity: 0.65;
}

.post-body blockquote, .page-body blockquote {
  border-left: 2px solid var(--rule);
  padding-left: 1.25rem;
  color: var(--text-secondary);
  margin: 2rem 0;
  font-style: italic;
  font-weight: 400;
}

.post-body code, .page-body code {
  font-family: var(--mono);
  font-size: 0.84em;
  font-variant-ligatures: none;
  background: #f3f0ed;
  padding: 0.1em 0.3em;
}

.post-body pre, .page-body pre {
  background: #f3f0ed;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 2rem 0;
  line-height: 1.6;
}

.post-body pre code {
  background: none;
  padding: 0;
}

.post-body img, .page-body img {
  max-width: 100%;
  height: auto;
  margin: 2rem 0;
  display: block;
}

.polaroid img {
  margin: 0;
}


/* ---- Figures & Captions ---- */

.post-body figure, .page-body figure {
  margin: 2.5rem 0;
}

.post-body figure img, .page-body figure img {
  margin: 0;
  width: 100%;
}

.post-body figcaption, .page-body figcaption {
  font-size: 0.98rem;
  color: var(--text-secondary);
  margin-top: 0.6rem;
  font-weight: 400;
  font-style: italic;
  line-height: 1.5;
}

.post-body figcaption a, .page-body figcaption a {
  color: var(--text-secondary);
  text-decoration-color: var(--rule);
}


/* ---- Image Row ---- */

.post-body .image-row, .page-body .image-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 2.5rem 0;
}

.post-body .image-row figure, .page-body .image-row figure {
  margin: 0;
}

@media (max-width: 480px) {
  .post-body .image-row, .page-body .image-row {
    grid-template-columns: 1fr;
  }
}


/* ---- Video Embed ---- */

.post-body .video-embed, .page-body .video-embed {
  margin: 2.5rem 0;
}

.post-body .video-embed iframe, .page-body .video-embed iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  display: block;
}


/* ---- Tables ---- */

.post-body table, .page-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 1.08rem;
  font-weight: 400;
}

.post-body th, .page-body th {
  text-align: left;
  padding: 0.5rem 0.75rem 0.5rem 0;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--text-secondary);
}

.post-body td, .page-body td {
  text-align: left;
  padding: 0.55rem 0.75rem 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}

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


/* ---- Horizontal Rules ---- */

.post-body hr, .page-body hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 3rem 0;
}


/* ---- Details / Summary ---- */

.post-body details, .page-body details {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--rule);
}

.post-body details + details, .page-body details + details {
  margin-top: -1px;
}

.post-body summary, .page-body summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1.1rem;
  list-style: none;
}

.post-body summary::-webkit-details-marker {
  display: none;
}

.post-body summary::before, .page-body summary::before {
  content: '+ ';
  color: var(--text-secondary);
  font-weight: 400;
}

.post-body details[open] > summary::before,
.page-body details[open] > summary::before {
  content: '− ';
}

.post-body details[open] > summary, .page-body details[open] > summary {
  margin-bottom: 0.75rem;
}

.post-body details p:last-child, .page-body details p:last-child {
  margin-bottom: 0;
}


.post-body ul, .page-body ul,
.post-body ol, .page-body ol {
  margin: 0 0 1.5rem 1.25rem;
}

.post-body li, .page-body li {
  margin-bottom: 0.35rem;
}


/* ---- Newsletter ---- */

.newsletter {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--rule);
}

.newsletter p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-weight: 400;
}

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

.newsletter-form input[type="email"] {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 400;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--text);
  width: 240px;
  outline: none;
  transition: border-color 200ms cubic-bezier(0.25, 1, 0.5, 1);
}

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

.newsletter-form input[type="email"]::placeholder {
  color: #8a8480;
}

.newsletter-form button {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.55rem 1.5rem;
  background: var(--text);
  color: var(--bg);
  border: none;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: opacity 200ms cubic-bezier(0.25, 1, 0.5, 1);
}

.newsletter-form button:hover {
  opacity: 0.75;
}


/* ---- Page ---- */

.page h1 {
  font-size: clamp(2.1rem, 5vw, 2.9rem);
  margin-bottom: 2rem;
  font-weight: 700;
}


/* ---- Footer ---- */

footer {
  padding-top: 2rem;
  padding-bottom: 2.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-align: left;
}


/* ---- Focus ---- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


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

@media (max-width: 750px) {
  html { font-size: 17px; }

  header, main, footer { padding: 1rem; }

  .post-header h1, .page h1 { font-size: 1.85rem; }

  .post-list a {
    flex-direction: column;
    gap: 0.15rem;
  }

  .post-list .post-meta {
    order: -1;
  }

  .newsletter-form input[type="email"] { width: 100%; }
  .newsletter-form { flex-direction: column; }
  .newsletter-form button { width: 100%; text-align: center; }
}


/* ---- Polaroid ---- */

.polaroid {
  float: right;
  margin: 0.25rem 0 1.5rem 2rem;
  padding: 0.6rem 0.6rem 2rem;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.06);
  border-radius: 3px;
  transform: rotate(2deg);
  max-width: 220px;
}

.polaroid img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 750px) {
  .polaroid {
    float: none;
    margin: 1rem auto 1.5rem;
    max-width: 240px;
  }
}


/* ---- Reduced Motion ---- */

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