/*
 * blog.truple.io theme.
 *
 * Plain CSS, hand written -- there is no preprocessor in this repo. Loaded
 * after bootstrap.min.css (kept for the .table/.btn/.embed-responsive helpers
 * that post bodies rely on) and overrides its base styles.
 *
 * Palette comes straight from img/logo_small.png: the ring is #007a6b and the
 * plane is #febb15. Teal does the structural work (links, headings, rails);
 * amber is reserved for the few "you are here" marks so it keeps its punch.
 */

:root {
  --ink: #16302c;
  --ink-soft: #4f6663;
  --paper: #ffffff;
  --surface: #eef5f3;
  --line: #cfe0dc;
  --line-strong: #9fc3bc;
  --teal: #007a6b;
  --teal-deep: #005c50;
  --teal-bright: #009688;
  --amber: #febb15;
  --amber-deep: #d99a00;

  --font-heading: 'Manrope', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Source Serif 4', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'SFMono-Regular', Menlo, Consolas, monospace;

  --wrap: 72rem;
  --reading: 48rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

/* Everything is sized in rem, so scaling the root scales the whole page. */
@media (min-width: 1440px) {
  html {
    font-size: 18px;
  }
}

@media (min-width: 1920px) {
  html {
    font-size: 19px;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  /* Full-height column so the footer sits at the bottom of short pages. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
}

a {
  color: var(--teal);
  text-decoration: underline;
  text-decoration-color: rgba(0, 122, 107, 0.35);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.15em;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

a:hover,
a:focus {
  color: var(--teal-deep);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--teal);
  color: #fff;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
  box-sizing: border-box;
}

.wrap--reading {
  max-width: calc(var(--reading) + 2 * var(--gutter));
}

/* --- Site header ---------------------------------------------------------- */

.site-nav {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.site-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  min-height: 4rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover,
.brand:focus {
  color: var(--teal);
  text-decoration: none;
}

.brand img {
  width: 2rem;
  height: 2rem;
  display: block;
}

.site-nav__links {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__links a {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.site-nav__links a:hover,
.site-nav__links a:focus {
  color: var(--teal-deep);
  background: var(--surface);
}

.site-nav__links a[aria-current='page'] {
  color: var(--teal-deep);
}

/* --- Masthead (listing pages) -------------------------------------------- */

.masthead {
  background: linear-gradient(100deg, var(--teal-deep), var(--teal) 55%, var(--teal-bright));
  color: #fff;
  border-bottom: 5px solid var(--amber);
}

.masthead .wrap {
  padding-top: clamp(2.5rem, 7vw, 4.5rem);
  padding-bottom: clamp(2.5rem, 7vw, 4.5rem);
}

.masthead h1 {
  color: #fff;
  font-size: clamp(2.4rem, 6vw, 4rem);
  letter-spacing: -0.03em;
}

.masthead__tagline {
  margin: 0.5rem 0 0;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: rgba(255, 255, 255, 0.82);
}

.masthead :focus-visible {
  outline-color: var(--amber);
}

/* --- Timeline listing ------------------------------------------------------ */

.listing {
  padding-top: clamp(2rem, 5vw, 3.5rem);
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
}

.timeline {
  --rail-x: 7.5rem;
  --body-x: 9.5rem;
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: var(--rail-x);
  width: 2px;
  background: var(--line);
}

.timeline__year {
  position: relative;
  padding: 1.5rem 0 0.5rem;
}

.timeline__year:first-child {
  padding-top: 0;
}

.timeline__year span {
  display: block;
  width: calc(var(--rail-x) - 1.25rem);
  text-align: right;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--teal);
}

.timeline__year::after {
  content: '';
  position: absolute;
  left: calc(var(--rail-x) - 4px);
  top: calc(1.5rem + 0.55rem);
  width: 10px;
  height: 10px;
  background: var(--teal);
  border-radius: 2px;
  transform: rotate(45deg);
}

.timeline__year:first-child::after {
  top: 0.55rem;
}

.post-preview {
  position: relative;
  padding: 1.1rem 0 1.1rem var(--body-x);
}

.post-preview::before {
  content: '';
  position: absolute;
  left: calc(var(--rail-x) - 5px);
  top: 1.75rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--paper);
}

.post-preview__date {
  position: absolute;
  left: 0;
  top: 1.35rem;
  width: calc(var(--rail-x) - 1.25rem);
  text-align: right;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.post-title {
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  margin: 0;
}

.post-title a {
  color: var(--ink);
  text-decoration: none;
}

.post-title a:hover,
.post-title a:focus {
  color: var(--teal);
  text-decoration: underline;
  text-decoration-color: var(--amber);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.12em;
}

.post-subtitle {
  margin: 0.35rem 0 0;
  max-width: var(--reading);
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.post-preview__by {
  display: none;
}

@media (max-width: 640px) {
  .timeline {
    --rail-x: 0.5rem;
    --body-x: 2rem;
  }

  .timeline__year span {
    width: auto;
    text-align: left;
    padding-left: var(--body-x);
  }

  .post-preview__date {
    position: static;
    display: block;
    width: auto;
    text-align: left;
    margin-bottom: 0.2rem;
  }

  .post-preview::before {
    top: 1.5rem;
  }
}

/* --- Pager (listing pages and post prev/next) ------------------------------ */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.5rem 0 0;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  text-align: left;
}

.pager li {
  display: block;
  flex: 1 1 0;
  min-width: 0;
}

.pager li.next {
  text-align: right;
}

.pager li.next:only-child {
  margin-left: auto;
}

.pager li > a {
  display: inline-block;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--teal);
  text-decoration: none;
}

.pager li > a:hover,
.pager li > a:focus {
  color: var(--teal-deep);
  background: none;
  border: 0;
  text-decoration: underline;
}

.pager__label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 0.15rem;
}

.pager__title {
  display: block;
  font-size: 1.05rem;
  line-height: 1.35;
}

.listing .pager {
  padding-left: var(--body-x, 0);
}

@media (max-width: 640px) {
  .listing .pager {
    padding-left: 0;
  }
}

/* --- Post header ------------------------------------------------------------ */

.post-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.post-header .wrap {
  padding-top: clamp(2.5rem, 6vw, 4rem);
  padding-bottom: clamp(2rem, 5vw, 3rem);
}

.post-header h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.9rem);
  letter-spacing: -0.025em;
}

.post-header h1::before {
  content: '';
  display: block;
  width: 3rem;
  height: 5px;
  margin-bottom: 1.25rem;
  background: var(--amber);
  border-radius: 3px;
}

.post-header__subtitle {
  margin: 1rem 0 0;
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  line-height: 1.45;
  font-style: italic;
  color: var(--ink-soft);
}

.post-header__meta {
  margin: 1.5rem 0 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.post-header__meta a {
  color: inherit;
}

/* --- Post body ---------------------------------------------------------------- */

.post-body {
  padding-top: clamp(2rem, 5vw, 3rem);
  padding-bottom: clamp(2rem, 5vw, 3rem);
}

#postContent > :first-child {
  margin-top: 0;
}

#postContent p {
  margin: 0 0 1.4rem;
}

#postContent h2,
#postContent h3,
#postContent h4 {
  margin: 2.6rem 0 0.9rem;
  scroll-margin-top: 1.5rem;
}

#postContent h2 {
  font-size: 1.65rem;
  color: var(--teal);
}

#postContent h3 {
  font-size: 1.3rem;
}

#postContent h4 {
  font-size: 1.1rem;
}

#postContent h2 + h3,
#postContent h3 + h4 {
  margin-top: 1rem;
}

#postContent ul,
#postContent ol {
  margin: 0 0 1.4rem;
  padding-left: 1.5rem;
}

#postContent li {
  margin-bottom: 0.4rem;
}

#postContent li > ul,
#postContent li > ol {
  margin: 0.4rem 0 0;
}

#postContent strong {
  font-weight: 600;
}

#postContent hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

#postContent blockquote {
  margin: 1.8rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--amber);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--ink-soft);
}

#postContent blockquote p:last-child {
  margin-bottom: 0;
}

#postContent img {
  display: block;
  max-width: min(100%, 38rem);
  margin: 2rem auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

#postContent img.big,
#postContent img.extra-big {
  max-width: 100%;
}

#postContent a img:hover,
#postContent a img:focus {
  cursor: zoom-in;
  border-color: var(--line-strong);
}

#postContent .embed-responsive {
  margin: 2rem 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--ink);
}

#postContent code,
#postContent pre {
  font-family: var(--font-mono);
}

#postContent code {
  font-size: 0.85em;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  border: 0;
}

#postContent pre,
#postContent .highlight pre {
  margin: 1.8rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.55;
}

#postContent pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

#postContent .table-responsive {
  margin: 1.8rem 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

#postContent .table {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  background: var(--paper);
}

#postContent .table > thead > tr > th,
#postContent .table > tbody > tr > th,
#postContent .table > tbody > tr > td {
  padding: 0.7rem 0.9rem;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

#postContent .table > thead > tr > th,
#postContent .table > tbody > tr:first-child > th {
  border-top: 0;
  border-bottom: 2px solid var(--line-strong);
  color: var(--teal-deep);
  font-weight: 700;
}

/* Call-to-action buttons some posts drop in with inline sizing. */
#postContent .btn {
  display: inline-block;
  height: auto !important;
  padding: 0.6rem 1.5rem !important;
  border: 2px solid var(--teal);
  border-radius: 999px;
  background: var(--teal);
  color: #fff !important;
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease;
}

#postContent .btn:hover,
#postContent .btn:focus {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
  color: #fff !important;
}

.post-nav .pager {
  margin-top: 3rem;
}

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

.site-footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.site-footer__links a:hover,
.site-footer__links a:focus {
  color: var(--teal-deep);
  text-decoration: underline;
}

.site-footer__links svg {
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
}

.copyright {
  width: 100%;
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
