/* ----------------------------------------------------------
   Base variables
   ---------------------------------------------------------- */

:root {
  --background-color: #fdfaf7;
  --text-color: #111111;
  --muted-text-color: #666666;
  --border-color: #ddd5c7;
  --code-bg: #f3efe7;
  --max-site-width: 72rem;
  --max-content-width: 40rem; /* ~65 characters at 18px */
  --font-size-base: 18px;
  --line-height-base: 1.5;

  --font-serif: "Iowan Old Style", "Palatino", "Book Antiqua",
    Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI",
    system-ui, sans-serif;
}

/* ----------------------------------------------------------
   Reset-ish
   ---------------------------------------------------------- */

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

html {
  font-size: 100%;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-serif);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
}

/* Images in Ghost get width/height attributes, so guard against squashing */
img {
  max-width: 100%;
  height: auto;
}

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

.site-wrapper {
  max-width: var(--max-site-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1;
}

/* ----------------------------------------------------------
   Header & navigation
   ---------------------------------------------------------- */

.site-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
}

.site-header-inner {
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-logo img {
  display: block;
  height: 3rem;
  width: auto;
}

.site-title-group {
  display: flex;
  flex-direction: column;
}

.site-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-color);
}

.site-description {
  margin: 0.2rem 0 0;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--muted-text-color);
}

.site-nav {
  margin-left: auto;
  align-self: flex-end;
}

.site-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.site-nav a {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--muted-text-color);
  border-bottom: 1px solid transparent;
  padding-bottom: 0.1rem;
}

.site-nav li.is-current a,
.site-nav a:hover {
  color: var(--text-color);
  border-bottom-color: var(--border-color);
}

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

.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.site-footer p {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--muted-text-color);
}

/* ----------------------------------------------------------
   Global typography
   ---------------------------------------------------------- */

.site-main {
  font-size: 1rem;
}

.post-content,
.page-content {
  max-width: var(--max-content-width);
  margin: 0 auto 4rem;
}

.post-content p,
.page-content p {
  margin: 0 0 1.1em;
}

.post-content p + p,
.page-content p + p {
  text-indent: 1.3em;
}

.post-content p:first-child,
.page-content p:first-child {
  text-indent: 0;
}

/* Headings hierarchy */

.post-title,
.page-title {
  max-width: var(--max-content-width);
  margin: 0 auto 0.6em;
}

.post-title {
  font-size: 2.25rem;
  line-height: 1.2;
}

.page-title {
  font-size: 2rem;
  line-height: 1.25;
}

.post-content h2,
.page-content h2 {
  font-size: 1.6rem;
  margin: 2.4rem auto 0.8rem;
  max-width: var(--max-content-width);
}

.post-content h3,
.page-content h3 {
  font-size: 1.3rem;
  margin: 1.8rem auto 0.6rem;
  max-width: var(--max-content-width);
}

.post-content h4,
.page-content h4 {
  font-size: 1.1rem;
  margin: 1.5rem auto 0.5rem;
  max-width: var(--max-content-width);
}

/* Lists */

.post-content ul,
.post-content ol,
.page-content ul,
.page-content ol {
  max-width: var(--max-content-width);
  margin: 0 0 1.2em 1.5em;
  padding: 0;
}

.post-content li,
.page-content li {
  margin: 0.1em 0;
}

/* Blockquotes */

.post-content blockquote,
.page-content blockquote {
  max-width: var(--max-content-width);
  margin: 1.8em auto;
  padding-left: 1rem;
  border-left: 2px solid var(--border-color);
  font-style: italic;
  color: var(--muted-text-color);
}

/* Links – “intelligent” underlines, accent color */

a {
  color: var(--ghost-accent-color, #0050a0);
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

a:hover {
  border-bottom-color: currentColor;
}

/* Code */

code {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.1em 0.25em;
  border-radius: 3px;
}

pre {
  max-width: var(--max-content-width);
  margin: 1.5em auto;
  padding: 1rem 1.25rem;
  background: var(--code-bg);
  border-radius: 4px;
  overflow-x: auto;
}

pre code {
  padding: 0;
  background: transparent;
}

/* Horizontal rules */

hr {
  border: none;
  border-top: 1px solid var(--border-color);
  max-width: var(--max-content-width);
  margin: 3rem auto;
}

/* Figures */


.post-feature-image,
.page-feature-image,
.post-content figure,
.page-content figure {
  max-width: var(--max-content-width);
  margin: 2rem auto;
}


.post-feature-image img,
.page-feature-image img,
.post-content figure img,
.page-content figure img {
  display: block;
}


.post-feature-image figcaption,
.page-feature-image figcaption,
.post-content figcaption,
.page-content figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted-text-color);
  line-height: 1.4;
}

/* Tables */

table {
  max-width: var(--max-content-width);
  margin: 1.8em auto;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: 0.4em 0.6em;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

/* ----------------------------------------------------------
   Archive / lists
   ---------------------------------------------------------- */

.post-list {
  max-width: var(--max-content-width);
  margin: 0 auto;
}

.post-card {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.post-card:last-child {
  border-bottom: none;
}

.post-card-title {
  font-size: 1.4rem;
  margin: 0 0 0.2rem;
}

.post-card-title a {
  border-bottom: none;
}

.post-card-meta {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--muted-text-color);
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.post-card-tag {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.post-card-excerpt {
  margin: 0.8rem 0 0;
}

/* Archive headers (tag/author) */

.archive-header {
  max-width: var(--max-content-width);
  margin: 0 auto 1.5rem;
  padding-top: 0.5rem;
}

.archive-title {
  margin: 0 0 0.3rem;
  font-size: 1.6rem;
}

.archive-description {
  margin: 0;
  color: var(--muted-text-color);
}

/* ----------------------------------------------------------
   Post meta, tags, comments
   ---------------------------------------------------------- */

.post-header {
  max-width: var(--max-content-width);
  margin: 0 auto 1.5rem;
}

.post-meta {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--muted-text-color);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.post-meta-tag {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.post-meta-reading {
  white-space: nowrap;
}

.post-footer {
  max-width: var(--max-content-width);
  margin: 2rem auto 0;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.post-tag {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

/* Ghost default content CTA (if membership used) */

.gh-post-upgrade-cta {
  max-width: var(--max-content-width);
  margin: 3rem auto 0;
}

.gh-post-upgrade-cta-content {
  padding: 1.5rem 1.75rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.03);
}

.gh-post-upgrade-cta h2 {
  margin-top: 0;
}

.gh-post-upgrade-cta .gh-btn {
  font-family: var(--font-sans);
}

/* Native comments container */

.gh-comments,
.post-comments {
  max-width: var(--max-content-width);
  margin: 3rem auto 0;
}

/* ----------------------------------------------------------
   Tufte-style margin notes
   ---------------------------------------------------------- */

/* Usage in content:
   <span class="sidenote">Short side note</span>
   or
   <aside class="marginnote">Longer margin note...</aside>
*/

.sidenote,
.marginnote {
  font-family: var(--font-serif);
  font-size: 0.8em;
  line-height: 1.4;
  color: var(--muted-text-color);
}

/* Desktop margin positioning */
@media (min-width: 960px) {
  .post-content,
  .page-content {
    position: relative;
    padding-right: 18rem; /* room for notes */
  }

  .sidenote,
  .marginnote {
    float: right;
    clear: right;
    width: 16rem;
    margin-right: -18rem;
    margin-top: 0;
    margin-bottom: 0.8em;
  }
}

/* On small screens, margin notes just become inline/stacked */
@media (max-width: 959.98px) {
  .sidenote,
  .marginnote {
    display: block;
    margin: 0.5em 0 0.8em;
  }
}

/* Optional superscript note numbers */
.sidenote-number {
  font-size: 0.75em;
  vertical-align: super;
}

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

.page-header {
  max-width: var(--max-content-width);
  margin: 0 auto 1.5rem;
}

.page-excerpt {
  margin: 0.5rem 0 0;
  color: var(--muted-text-color);
}

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

@media (max-width: 640px) {
  .site-wrapper {
    padding: 1.75rem 1.1rem 2.5rem;
  }

  .site-header-inner {
    align-items: flex-start;
  }

  .site-nav {
    margin-left: 0;
    margin-top: 0.75rem;
  }

  .post-title {
    font-size: 1.9rem;
  }
}

/* ----------------------------------------------------------
   Koenig editor image sizes
   ---------------------------------------------------------- */

/* Wide images break out of the content column */
.kg-width-wide {
  position: relative;
  width: 85vw;
  min-width: 100%;
  margin: auto calc(50% - 50vw);
  transform: translateX(calc(50vw - 50%));
}

.kg-width-wide img {
  max-width: 85vw;
  width: 100%;
  height: auto;
}

/* Full-width images span the viewport */
.kg-width-full {
  position: relative;
  width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.kg-width-full img {
  max-width: 100vw;
  width: 100%;
  height: auto;
}

/* ----------------------------------------------------------
   Header tagline & subscribe nav tweaks
   ---------------------------------------------------------- */

.site-description--solo {
  margin: 0.2rem 0 0;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--muted-text-color);
}

.site-nav-subscribe a {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  text-decoration: none;
  padding: 0.2rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
}

.site-nav-subscribe a:hover {
  border-bottom-color: transparent;
}
