/* /writing/ index and article pages. Loaded after site.css, whose tokens,
   themes, nav and footer these pages share with the homepage. The release
   build swaps this stylesheet into every article page, fresh or retained,
   so article chrome never lives inline. Night band on top (index hero,
   article masthead), reading surface on ceil, mirroring the homepage. */

:root { --col: 700px; }

/* Footer: the homepage keeps these two lines inline; the writing pages share them here. */
footer.theme-ceil { border-top: 1px solid var(--rule); }
footer .sig { margin-bottom: 10px; }
footer .sig-next { margin-bottom: 28px; font-size: 16px; }
footer .sig-next a { color: var(--accent); border-bottom: 1px solid currentColor; transition: color .15s; }
footer .sig-next a:hover { color: var(--accent-deep); }
footer .meta {
  margin-top: 24px;
  display: flex; gap: 16px; flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- INDEX ---------- */
.writing-hero { padding: 104px 0 96px; }
.writing-hero h1 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(36px, 4.6vw, 62px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  max-width: 17ch;
  text-wrap: balance;
  margin-bottom: 28px;
}
.writing-hero h1 em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.writing-hero .lede {
  font-size: 20px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 52ch;
  margin-bottom: 32px;
}
.writing-hero .follow { display: flex; flex-wrap: wrap; gap: 12px 32px; font-size: 15px; font-weight: 500; }
.writing-hero .follow a { color: var(--accent); border-bottom: 1px solid currentColor; transition: color .15s; }
.writing-hero .follow a:hover { color: var(--accent-deep); }

.article-index { padding: 40px 0 120px; border-bottom: 0; }
.article-index-grid { max-width: 1040px; }
.article-index-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 40px;
  align-items: start;
  padding: 36px 0;
  border-bottom: 1px solid var(--rule);
}
.article-index-thumb {
  order: 2;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--accent-soft);
}
.article-index-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s cubic-bezier(.2, .7, .2, 1);
}
.article-index-date {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 10px;
}
.article-index-card h2 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 25px;
  line-height: 1.22;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: 12px;
  transition: color .15s;
}
.article-index-card p {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 62ch;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.article-index-card:hover h2 { color: var(--accent); }
.article-index-card:hover .article-index-thumb img { transform: scale(1.03); }
.article-index-card:focus-visible { outline-offset: 6px; }

/* ---------- ARTICLE ---------- */
.article-masthead { padding: 56px 0 176px; }
.article-masthead .container > *,
.article-sheet > * {
  max-width: var(--col);
  margin-left: auto;
  margin-right: auto;
}
.article-back {
  display: flex; width: fit-content; gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 40px;
  transition: color .15s;
}
.article-masthead .article-back { max-width: none; margin-left: max(0px, calc((100% - var(--col)) / 2)); }
.article-back:hover { color: var(--accent); }

/* Date sits under the byline: the headline opens the page, metadata follows it. */
.article-header { display: flex; flex-direction: column; }
.article-header h1 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(32px, 4.2vw, 54px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.article-header .article-byline { margin-top: 24px; font-size: 16px; }
.article-header .article-byline a { border-bottom-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.article-date {
  order: 1;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}
.article-header .series-nav { order: 2; margin-top: 14px; }

/* The hero overlaps the night band, so the two themes read as one spread. */
.article-sheet { padding-bottom: 96px; }
.article-sheet > .article-hero-img {
  max-width: 960px;
  aspect-ratio: 16 / 9;
  margin-top: -128px;
  margin-bottom: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--accent-soft);
  box-shadow: 0 28px 56px -28px rgba(15, 26, 44, .55);
}
.article-hero-img img, .article-hero-img picture { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Reading body: Literata at ~69ch. */
.article-body {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.65;
  color: var(--ink-2);
  font-variant-numeric: oldstyle-nums proportional-nums;
  hanging-punctuation: first;
  text-wrap: pretty;
}
.article-body > :first-child { margin-top: 0; }
.article-body p { margin-bottom: 1.15em; }
.article-body h1,
.article-body h2 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
  font-variant-numeric: normal;
  margin: 64px 0 18px;
}
.article-body h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.012em;
  color: var(--ink);
  font-variant-numeric: normal;
  margin: 44px 0 12px;
}
.article-body h4, .article-body h5, .article-body h6 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
  margin: 32px 0 8px;
}
.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: text-decoration-color .15s, color .15s;
}
.article-body a:hover { color: var(--accent-deep); text-decoration-color: currentColor; }
.article-body strong, .article-body b { font-weight: 600; color: var(--ink); }
.article-body em, .article-body i { font-style: italic; }
.article-body ul, .article-body ol { margin: 0 0 1.15em; padding-left: 1.3em; }
.article-body li { margin-bottom: .45em; padding-left: .2em; }
.article-body li::marker { color: var(--muted); }
.article-body li > ul, .article-body li > ol { margin: .45em 0 0; }

/* Quotes: indented Literata italic under a hanging quote mark. No side rule. */
.article-body blockquote {
  position: relative;
  margin: 44px 0;
  padding-left: 1.5em;
  font-style: italic;
  font-size: 21px;
  line-height: 1.5;
  color: var(--ink);
}
.article-body blockquote::before {
  content: "\201C";
  position: absolute;
  left: -.04em;
  top: -.08em;
  font-size: 2.4em;
  line-height: 1;
  font-style: normal;
  color: var(--accent);
}
.article-body blockquote p:last-child { margin-bottom: 0; }

.article-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 40px auto;
  border-radius: 6px;
}
.article-body figure { margin: 40px 0; }
.article-body figure img { margin: 0 auto; }
.article-body figcaption {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.45;
  font-style: italic;
  color: var(--muted);
}
/* Section breaks reuse the ECG complex from the GW mark. */
.article-body hr {
  border: 0;
  width: 44px; height: 26px;
  margin: 54px auto;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='4 12.4 55.4 33.2'><path d='M6 32 L18 32 L22 26 L28 44 L34 14 L38 32 L50 32' stroke='black' stroke-width='2.1' fill='none' stroke-linecap='round' stroke-linejoin='round'/><circle cx='53' cy='32' r='3.2'/></svg>") no-repeat center / contain;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='4 12.4 55.4 33.2'><path d='M6 32 L18 32 L22 26 L28 44 L34 14 L38 32 L50 32' stroke='black' stroke-width='2.1' fill='none' stroke-linecap='round' stroke-linejoin='round'/><circle cx='53' cy='32' r='3.2'/></svg>") no-repeat center / contain;
}
.article-body pre, .article-body code { font-family: var(--mono); font-size: .85em; }
.article-body pre { overflow-x: auto; padding: 16px 20px; margin: 0 0 1.15em; background: var(--card); border-radius: 6px; }
.article-body table { width: 100%; border-collapse: collapse; margin: 0 0 1.15em; font-size: 16px; font-variant-numeric: tabular-nums; }
.article-body th, .article-body td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }

/* Author box and related list come from site.css; here they join the reading column. */
.article-sheet .author-box { background: var(--card); border-color: var(--rule); }
.article-sheet section.related { padding: 0; border-bottom: 0; } /* not a page band: drop the generic section padding and rule */

.article-footer {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: center;
}
.related + .article-footer { border-top: 0; padding-top: 0; } /* the list already ends on a rule */
.article-footer .linkedin-link { font-size: 15px; font-weight: 500; color: var(--ink); }
.article-footer .linkedin-link:hover { color: var(--accent); }
.article-footer .article-back { margin: 0; }

@media (max-width: 960px) {
  .writing-hero { padding: 72px 0 64px; }
  .writing-hero .lede { font-size: 18px; }
  .article-masthead { padding: 40px 0 120px; }
  .article-back { margin-bottom: 28px; }
  .article-sheet > .article-hero-img { margin-top: -88px; margin-bottom: 44px; }
}
@media (max-width: 720px) {
  .article-index { padding: 16px 0 88px; }
  .article-index-card { grid-template-columns: minmax(0, 1fr) 96px; gap: 8px 20px; padding: 28px 0; }
  .article-index-thumb { aspect-ratio: 1; grid-row: 1; grid-column: 2; }
  .article-index-body { display: contents; }
  .article-index-date { grid-row: 1; grid-column: 1; align-self: start; margin: 0; }
  .article-index-card h2 { grid-row: 1; grid-column: 1; margin: 26px 0 0; font-size: 21px; }
  .article-index-card p { grid-column: 1 / -1; font-size: 16px; }
  .article-body { font-size: 18px; }
  .article-body h1, .article-body h2 { font-size: 24px; margin-top: 48px; }
  .article-body h3 { font-size: 19px; }
  .article-body blockquote { font-size: 19px; margin: 36px 0; }
  .article-sheet > .article-hero-img { margin-top: -72px; margin-bottom: 36px; border-radius: 6px; }
  .article-masthead { padding-bottom: 104px; }
}
