/* Acting Intelligent — one stylesheet for the whole site.
   Layout: one column on phones; on screens wider than 782px the header and
   post list use two columns and post pages get the "Look Around" sidebar. */

:root {
  --text: #2b2723;        /* warm charcoal */
  --background: #f5f0e6;  /* eggshell */
  --muted: #6b6258;       /* warm grey, 5.3:1 on the background */
  --code-background: #ece5d8;
  --border: #d9cfbe;
  --sans: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: Lora, Georgia, serif;
  --small: clamp(0.825rem, 0.78rem + 0.43vw, 1.0625rem);
  --gutter: 1.5rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.95rem + 0.45vw, 1.25rem);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
  text-decoration: none;
  text-decoration-thickness: 0.0625em;
  text-underline-offset: 0.15em;
}
a:hover { text-decoration: underline; }

img, video { max-width: 100%; height: auto; }

h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.05; margin: 0; }

.wrap {
  max-width: calc(1200px + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Header ---------- */

.site-header { padding-top: 56px; padding-bottom: 64px; }

.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-size: 30px;
  line-height: 1;
}
.logo:hover { text-decoration: none; }
.logo b { font-weight: 700; letter-spacing: -0.5px; }
.logo i { font-family: var(--serif); font-weight: 400; }

.intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 2rem;
  margin-top: 2rem;
}
.intro p {
  flex: 999 1 26rem;
  max-width: 60ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 0.85rem + 0.5vw, 1.15rem);
}
.intro .social { flex: 1 1 10rem; justify-content: center; }

.social {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.social a { display: block; line-height: 0; }
.social svg { width: 24px; height: 24px; fill: currentColor; }

/* ---------- Home: post list ---------- */

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

.post-card {
  display: flex;
  align-items: center;
  gap: 1.5rem 2rem;
  padding: 40px 0;
  border-top: 2px solid var(--text);
}
.post-card > div { flex: 1; min-width: 0; }

.post-card time,
.meta time {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
}
.post-card time { font-size: clamp(0.875rem, 0.85rem + 0.23vw, 1rem); }

.post-card h2 {
  margin-top: 4px;
  font-size: clamp(1.75rem, 1.6rem + 2.3vw, 3rem);
  letter-spacing: -1px;
  overflow-wrap: break-word;
}

.categories {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: clamp(0.825rem, 0.78rem + 0.43vw, 1rem);
}

.thumb {
  flex: 0 0 25%;
  display: flex;
  justify-content: center;
}
.thumb img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  border-radius: 12px;
}

/* ---------- Post page ---------- */

.post-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 3rem;
}
.post-layout > main { min-width: 0; }

.sidebar { padding-top: 30px; }
.sidebar h2 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 20px;
  margin-top: 1rem;
}
.sidebar ul:not(.social) { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.sidebar li { padding-top: 0.75rem; line-height: 1.2; }
.sidebar li a { color: var(--muted); font-size: 1rem; }
.sidebar li a[aria-current] { color: var(--text); font-weight: 600; }
.sidebar .social { margin-top: 1.75rem; }

.meta { margin: 0; font-size: var(--small); }
.meta time { margin-right: 0.4em; }

article h1 {
  font-size: clamp(1.8rem, 1.6rem + 2.4vw, 3.125rem);
  letter-spacing: -1px;
  margin: 6px 0 0;
  overflow-wrap: break-word;
}
article > .categories { margin-top: 14px; }

.post-content {
  margin-top: 40px;
  max-width: 68ch;
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  overflow-wrap: break-word; /* long URLs in captions on small phones */
}
.post-content > * { margin: 18px 0 0; }
.post-content > :first-child { margin-top: 0; }
.post-content a {
  text-decoration: underline;
  text-decoration-color: var(--muted);
  overflow-wrap: anywhere;
}
.post-content a:hover { text-decoration-color: currentColor; }
.post-content h2,
.post-content h3 { font-family: var(--serif); line-height: 1.15; margin-top: 40px; }
.post-content h2 { font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.2rem); }
.post-content h3 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.9rem); }
.post-content h4 { font-size: 1.15em; line-height: 1.2; margin-top: 32px; }
.post-content h5 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.04em; }
.post-content ul,
.post-content ol { padding-left: 1.5em; }
.post-content li + li { margin-top: 0.35rem; }
.post-content hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }
.post-content blockquote {
  margin-left: 0;
  margin-right: 0;
  padding-left: 20px;
  border-left: 2px solid var(--text);
  font-family: var(--serif);
  font-style: italic;
}
.post-content pre {
  overflow-x: auto;
  padding: 18px 20px;
  background: var(--code-background);
  border-radius: 8px;
  font-size: 0.85em;
  line-height: 1.6;
}
.post-content code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.post-content :not(pre) > code {
  padding: 0.1em 0.3em;
  background: var(--code-background);
  border-radius: 4px;
  font-size: 0.9em;
}
.post-content figure { margin-left: 0; margin-right: 0; }
.post-content figcaption { color: var(--muted); font-size: 0.85em; text-align: center; }
.post-content .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.post-content table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
}
.post-content th,
.post-content td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; text-align: left; }
.post-content th { background: var(--code-background); }

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

.site-footer { padding-bottom: 72px; }
.site-footer::before {
  content: "";
  display: block;
  border-top: 2px solid var(--text);
  margin: 40px 0 96px;
}
.site-footer a {
  font-size: var(--small);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- Phones and small tablets ---------- */

@media (max-width: 782px) {
  .post-card { flex-direction: column-reverse; align-items: flex-start; }
  .thumb { flex-basis: auto; justify-content: flex-start; }
  .post-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* Very wide screens: nudge the sidebar left, as on the old site. */
@media (min-width: 1340px) {
  .sidebar { margin-left: -40px; }
}
