/* ==========================================================================
   INSTACAN — blog
   Loads after css/style.css and only adds. Every token, button and heading
   style comes from the main stylesheet, so a change to the site's design
   reaches the blog without anything being edited here.
   ========================================================================== */

[hidden] { display: none !important; }

/* The header is fixed, so the first section needs to clear it. */
.blog-hero { padding-top: calc(var(--sec-y) * .7 + var(--bar-h)); padding-bottom: 0; }
.blog-hero .sec-head { max-width: 720px; }

/* ==========================================================================
   CATEGORY BAR
   ========================================================================== */

.cat-bar { border-bottom: 1px solid var(--line); margin-top: clamp(2rem, 4vw, 3rem); }
.cat-bar__inner {
  display: flex; gap: .55rem; flex-wrap: wrap;
  padding-block: 1.1rem;
}
.cat-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: 8px 16px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  font-size: var(--fs-sm); color: var(--body);
  transition: background-color var(--t2) var(--ease), border-color var(--t2) var(--ease), color var(--t2) var(--ease);
}
.cat-chip span { font-size: var(--fs-xs); color: var(--muted); }
.cat-chip:hover { border-color: var(--gold); color: var(--gold-ink); }
.cat-chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.cat-chip.is-on span { color: rgba(255,255,255,.6); }

/* ==========================================================================
   POST CARDS
   Same card language as the service cards on the homepage: light card, serif
   title, and the "Read More" row with a circled arrow pinned to the bottom.
   ========================================================================== */

.post-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 1.8vw, 1.5rem);
}
.pcard {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden;
  transition: transform var(--t2) var(--ease), box-shadow var(--t2) var(--ease), border-color var(--t2) var(--ease);
}
.pcard:hover { transform: translateY(-5px); box-shadow: var(--sh-md); border-color: var(--gold-line); }
.pcard__link { display: flex; flex-direction: column; height: 100%; color: inherit; }

/* Cards keep one ratio so the grid stays a grid — 16:9 because that is the
   shape of the banners actually being uploaded, so very little is lost. */
.pcard__media {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--cream-2); flex: none;
}
.pcard__media img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transition: transform .8s var(--ease);
}
.pcard:hover .pcard__media img { transform: scale(1.05); }

/* Posts with no featured image get the crest on a wash rather than a hole. */
.pcard__crest {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--cream) 0%, var(--gold-wash) 100%);
}
.pcard__crest img { width: 88px; height: 88px; opacity: .35; }

.pcard__body {
  padding: clamp(1.25rem, 1.8vw, 1.6rem);
  display: flex; flex-direction: column; flex: 1;
}
.pcard__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  margin-bottom: .7rem;
  font-size: var(--fs-xs); color: var(--muted);
}
.pcard__cat {
  color: var(--gold-ink); font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; font-size: var(--fs-label);
}
.pcard__title {
  font-family: var(--display); font-weight: 400;
  font-size: var(--fs-lg); line-height: 1.24; letter-spacing: -.02em; color: var(--ink);
  margin-bottom: .5rem;
}
.pcard__copy { font-size: var(--fs-sm); color: var(--muted); }
.pcard__more {
  margin-top: auto; padding-top: 1.4rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  font-size: var(--fs-xs); font-weight: 500;
  text-transform: uppercase; letter-spacing: .07em; color: var(--ink);
}
.pcard__ring {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line-2);
  transition: background-color var(--t2) var(--ease), border-color var(--t2) var(--ease), transform var(--t2) var(--ease), color var(--t2) var(--ease);
}
.pcard__ring svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.pcard:hover .pcard__ring {
  background: var(--ink); border-color: var(--ink); color: #fff; transform: translateX(3px);
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.pager {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(1rem, 3vw, 2rem);
  margin-top: clamp(2.5rem, 4vw, 3.5rem);
}
.pager__step {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: 11px 20px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  font-size: var(--fs-sm); font-weight: 500;
  transition: border-color var(--t2) var(--ease), color var(--t2) var(--ease);
}
.pager__step:hover { border-color: var(--gold); color: var(--gold-ink); }
.pager__step svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.pager__count { font-size: var(--fs-sm); color: var(--muted); }

/* ==========================================================================
   ARTICLE
   ========================================================================== */

.article { padding-top: calc(var(--bar-h) + var(--top-gap)); }

/* --------------------------------------------------------------------------
   THE OPENING PANEL
   Breadcrumb, title, standfirst, when-and-what, picture — all inside one
   cream card the full width of the site.

   The panel is wide; the words inside it are not. Title and standfirst are
   capped at a readable measure and centred, so a 1440 screen gives the panel
   presence without stretching the sentences across it.
   -------------------------------------------------------------------------- */

.article__panel {
  background: var(--cream);
  border-radius: var(--r-md);
  padding: clamp(1.75rem, 4vw, 3.5rem) clamp(1.25rem, 3.5vw, 3.5rem);
  text-align: center;
}
.article__intro { max-width: 900px; margin-inline: auto; }

/* .crumbs lives in css/style.css — the article, the About page and every
   service page use it, and it was quietly unstyled on all of them while it
   was defined only here. */

.article__title {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(2rem, 4.2vw, 3.15rem); line-height: 1.12; letter-spacing: -.02em;
  color: var(--ink); text-wrap: balance;
}

/* The standfirst: the author's own one-line summary, in the UI face so it
   reads as a caption to the title rather than as more of the title. */
.article__lede {
  margin: .9rem auto 0; max-width: 56ch;
  font-size: clamp(1rem, 1.4vw, 1.12rem); line-height: 1.6;
  color: var(--muted);
}

/* When it was published, how long it takes, what it is about. */
.article__meta {
  margin-top: 1.3rem;
  display: flex; flex-wrap: wrap; justify-content: center;
  align-items: center; gap: .7rem;
  font-size: var(--fs-sm); color: var(--muted);
}
/* A drawn dot rather than a middot character: it sits on the centre line
   whatever the font does, and screen readers never announce it. */
.article__dot {
  width: 3px; height: 3px; border-radius: 50%;
  background: currentColor; opacity: .5;
}
.cat-chip--sm { padding: 5px 13px; font-size: var(--fs-xs); background: var(--white); }

/* Inside the panel, inset from its edges — the panel frames the picture. */
.article__hero {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  border-radius: var(--r-md);
  overflow: hidden; background: var(--cream-2);
}
/* No forced ratio and no cropping: a banner someone designed gets shown whole,
   whatever shape it is. The width and height attributes on the tag reserve the
   right space, so the page does not jump when it loads. */
.article__hero img { width: 100%; height: auto; display: block; }

/* --------------------------------------------------------------------------
   CONTENTS LEFT, ARTICLE RIGHT
   30 / 70, as asked. The gap comes out of the right-hand column, which lands
   the running text at a measure that is still comfortable to read on a 1440
   screen rather than one long ruler of a line.
   -------------------------------------------------------------------------- */

.article__grid {
  display: grid;
  grid-template-columns: 30% 1fr;
  gap: clamp(2rem, 4vw, 4rem);
  align-items: start;
  margin-top: clamp(2rem, 4vw, 3.5rem);
  /* Breathing room below the last thing in the columns. Without it, a post
     with nothing to "keep reading" ends with the comment card sitting flush
     against the footer's photograph. */
  margin-bottom: clamp(3rem, 6vw, 5rem);
}
.article__main { min-width: 0; }

.article__body {
  font-size: clamp(1rem, .96rem + .25vw, 1.1rem);
  line-height: 1.75; color: var(--body);
}
.article__body > * + * { margin-top: 1.15em; }
.article__body h2, .article__body h3, .article__body h4 {
  font-family: var(--display); font-weight: 400; color: var(--ink);
  line-height: 1.22; letter-spacing: -.015em;
}
/* A hairline above each main section, so the article has visible joints
   rather than one unbroken run of text. */
.article__body h2 {
  font-size: 1.7em;
  margin-top: 2em; padding-top: 1.5rem; border-top: 1px solid var(--line);
}
.article__body h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.article__body h3 { font-size: 1.3em;  margin-top: 1.9em; }
.article__body h4 { font-size: 1.12em; margin-top: 1.7em; }
.article__body h2 + *, .article__body h3 + *, .article__body h4 + * { margin-top: .75em; }
.article__body a { color: var(--gold-ink); border-bottom: 1px solid var(--gold-line); }
.article__body a:hover { border-color: var(--gold-ink); }
.article__body ul, .article__body ol { padding-left: 1.4em; }
.article__body ul { list-style: disc; }
.article__body ol { list-style: decimal; }
.article__body li + li { margin-top: .5em; }
.article__body blockquote {
  border-left: 3px solid var(--gold);
  padding: .3em 0 .3em 1.3em; font-style: italic; color: var(--body);
}
.article__body img { border-radius: var(--r-md); margin-inline: auto; }
.article__body figcaption {
  margin-top: .7em; text-align: center;
  font-size: var(--fs-sm); color: var(--muted);
}
.article__body pre {
  background: var(--cream); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 1rem 1.2rem; overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82em; line-height: 1.6;
}
.article__body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em;
  background: var(--cream); padding: .12em .4em; border-radius: 4px;
}
.article__body pre code { background: none; padding: 0; }
.article__body hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.2em; }

/* ==========================================================================
   TABLE OF CONTENTS
   The left-hand column. One level only — the article's main sections — since
   a list with indented sub-entries stops being something you take in at a
   glance.
   ========================================================================== */

.toc {
  padding: clamp(1.5rem, 2.2vw, 2rem) clamp(1.4rem, 2vw, 1.9rem);
  border-radius: var(--r-lg);
  background: var(--cream);
}
.toc__title {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(1.4rem, 2vw, 1.7rem); line-height: 1.15;
  letter-spacing: -.02em; color: var(--ink);
  margin-bottom: 1.1rem;
}

/* Numbered by CSS rather than by the list marker, so the number can be aligned
   with the first line of a title that wraps onto two. */
.toc__list { counter-reset: toc; list-style: none; }
.toc__item { counter-increment: toc; }
.toc__item + .toc__item { margin-top: .8rem; }

.toc__item a {
  display: grid; grid-template-columns: 1.9rem 1fr; align-items: baseline;
  font-size: var(--fs-md); line-height: 1.5; color: var(--body);
  transition: color var(--t2) var(--ease);
}
.toc__item a::before {
  content: counter(toc) ".";
  color: var(--muted); font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.toc__item a:hover { color: var(--gold-ink); }
/* set by js/main.js as you scroll */
.toc__item.is-here a { color: var(--gold-ink); font-weight: 500; }
.toc__item.is-here a::before { color: var(--gold-ink); }

/* ==========================================================================
   COMMENTS
   ========================================================================== */

.comments {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-top: clamp(2rem, 4vw, 2.75rem);
  border-top: 1px solid var(--line);
}
.comments__title {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(1.5rem, 2.4vw, 1.9rem); color: var(--ink);
}

.comments__note {
  margin-top: 1.1rem; padding: .85rem 1.1rem;
  border-radius: var(--r-sm); font-size: var(--fs-sm);
}
.comments__note--ok  { background: var(--gold-wash); border: 1px solid var(--gold-line); color: var(--ink); }
.comments__note--bad { background: #fdf2f2; border: 1px solid #f0c9c9; color: #8a2020; }
.comments__note--bad p + p { margin-top: .3rem; }

.comments__list { margin-top: 1.75rem; display: flex; flex-direction: column; gap: 1.4rem; }
.comment { display: flex; gap: 1rem; }
.comment__avatar {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold-wash); border: 1px solid var(--gold-line);
  font-size: var(--fs-sm); font-weight: 600; color: var(--gold-ink);
}
.comment__body {
  flex: 1; background: var(--white);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 1rem 1.2rem;
}
.comment__who { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem; }
.comment__who strong { font-size: var(--fs-sm); color: var(--ink); font-weight: 600; }
.comment__who time  { font-size: var(--fs-xs); color: var(--muted); }
.comment__text {
  margin-top: .45rem;
  font-size: var(--fs-sm); line-height: 1.7; color: var(--body);
}

/* --- the form --- */
.cform {
  margin-top: 2rem; padding: clamp(1.4rem, 2.6vw, 1.9rem);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--white);
}
.cform__lede { font-size: var(--fs-sm); color: var(--muted); max-width: 56ch; }
.cform__row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  margin-top: 1.25rem;
}
.cfield { display: block; }
/* Only stacked fields need the gap. Inside .cform__row the two sit side by
   side in a grid that already spaces them, and a top margin on the second one
   drops its input a line below the first. */
.cform > .cfield + .cfield,
.cform__row + .cfield { margin-top: 1rem; }
.cfield__label {
  display: block; margin-bottom: .4rem;
  font-size: var(--fs-xs); font-weight: 500; color: var(--ink);
}
.cfield__hint { font-weight: 400; color: var(--muted); }
.cfield input, .cfield textarea {
  width: 100%; font: inherit; font-size: var(--fs-sm); color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 11px 14px;
  transition: border-color var(--t2) var(--ease), background-color var(--t2) var(--ease);
}
.cfield textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.cfield input:focus, .cfield textarea:focus {
  outline: none; background: var(--white); border-color: var(--gold);
}
.cform .btn { margin-top: 1.25rem; }

/* The honeypot. Off-screen rather than display:none — a bot that skips hidden
   fields will still fill this one in, which is the entire point. */
.cform__trap {
  position: absolute; left: -9999px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */

.blog-empty {
  text-align: center; padding: clamp(3rem, 6vw, 5rem) 1.5rem;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--white);
}
.blog-empty h2 {
  font-family: var(--display); font-weight: 400;
  font-size: var(--fs-xl); color: var(--ink);
}
.blog-empty p {
  margin: .8rem auto 1.8rem; max-width: 46ch;
  font-size: var(--fs-sm); color: var(--muted);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1080px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}

/* One column. The contents come first, above the article — but a long article
   has a long contents list, and a full one would push the first paragraph most
   of a screen down. So on a narrow screen the list is capped and scrolls
   inside itself: the card stays a fixed, predictable size whatever the article
   turns out to be. */
@media (max-width: 900px) {
  .article__grid { grid-template-columns: 1fr; gap: 2rem; }
  .toc__list {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    /* room for the scrollbar, and a hint that there is more below */
    padding-right: .6rem;
    overscroll-behavior: contain;
  }
}

@media (max-width: 640px) {
  .post-grid { grid-template-columns: 1fr; }
  .blog-hero { padding-top: calc(var(--sec-y) * .6 + var(--bar-h)); }
  .article { padding-top: calc(var(--bar-h) + var(--top-gap)); }
  .cform__row { grid-template-columns: 1fr; }
  .comment { gap: .75rem; }
  .comment__avatar { width: 34px; height: 34px; }
  .pager { gap: .8rem; }
  .pager__step { padding: 10px 15px; font-size: var(--fs-xs); }
}

/* ==========================================================================
   WIDE SCREENS
   The article column takes whatever the grid gives it. Once the page
   container grows past 1440 that is a line of well over a hundred
   characters, and at that length the eye loses its place coming back to the
   left margin. The column still widens — the text inside it stops.
   ========================================================================== */

@media (min-width: 1560px) {
  .article__body,
  .comments { max-width: 920px; }
}
