:root {
  color-scheme: light;
  --paper: #faf8f5;
  --card: #ffffff;
  --ink: #24292f;
  --muted: #68737d;
  --line: #e8e3db;
  --blue: #0079ff;
  --link: #0068da; /* a hair deeper than --blue so small link text passes AA on light */
  --brand: #0079ff; /* vivid Tito blue for the logo + highlight, same in both themes */
  --code-bg: #f2efe9;
  /* category inks: tint (hover ground) + mark (ink) */
  --tint-product: #cce6ff;
  --mark-product: #0068da;
  --tint-team: #c2eee3;
  --mark-team: #00846f;
  --tint-industry: #ded4f2;
  --mark-industry: #6b51a8;
  --tint-default: #ece7de;
  --mark-default: #6e6657;
  /* blue accent (deep tone stays aubergine) */
  --accent-ground: #e4f0ff;
  --accent-mark: #0079ff;
  --accent-text: #0061cc;
  --accent-deep: #3c3041;
  --selection: #cfe4ff;
  --selection-ink: #10386e;
  /* footer: a deep aubergine slab, identical in both themes (anchors the page) */
  --footer-bg: #2b2430;
  --footer-ink: #ebe4db;
  --footer-accent: #7cb8ff;
}

/* dark palette: applies on system preference, or when toggled explicitly */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #18151b;
  --card: #242029;
  --ink: #ece9f2;
  --muted: #a29bb3;
  --line: #3a3440;
  --blue: #57a9ff;
  --link: #57a9ff;
  --code-bg: #2c2631;
  --tint-product: #1c3556;
  --mark-product: #5aa6ff;
  --tint-team: #14403a;
  --mark-team: #35c1a4;
  --tint-industry: #322a4d;
  --mark-industry: #ab90ea;
  --tint-default: #2e2a26;
  --mark-default: #a99e8a;
  --accent-ground: #26202b;
  --accent-deep: #d3c9bd;
  --accent-text: #57a9ff;
  --selection: #1e3a5f;
  --selection-ink: #ece9f2;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #18151b;
    --card: #242029;
    --ink: #ece9f2;
    --muted: #a29bb3;
    --line: #3a3440;
    --blue: #57a9ff;
    --code-bg: #2c2631;
    --tint-product: #1c3556;
    --mark-product: #5aa6ff;
    --tint-team: #14403a;
    --mark-team: #35c1a4;
    --tint-industry: #322a4d;
    --mark-industry: #ab90ea;
    --tint-default: #2e2a26;
    --mark-default: #a99e8a;
    --accent-ground: #26202b;
    --accent-deep: #d3c9bd;
    --accent-text: #57a9ff;
    --selection: #1e3a5f;
    --selection-ink: #ece9f2;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "myriad-pro", "Myriad Pro", "Helvetica Neue", Helvetica, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.masthead :focus-visible { outline-color: var(--blue); }
::selection { background: var(--selection); color: var(--selection-ink); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  z-index: 10;
  left: 16px;
  top: -60px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 0 0 8px 8px;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; text-decoration: none; }

/* punched-hole edge along the footer top */
.site-footer::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 0;
  right: 0;
  height: 14px;
  background: radial-gradient(circle 7px at 50% 50%, var(--paper) 6px, transparent 7px) 0 0 / 26px 14px repeat-x;
  pointer-events: none;
}

/* ---------- masthead ---------- */
.masthead {
  position: relative;
  overflow: hidden;
  background: var(--card);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
/* tiled "all the people" pattern for texture */
.masthead::before, .footer-texture {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
/* header (light): grey line-art on the light card ground */
.masthead::before {
  background: url("../people-pattern.png") repeat 0 0 / 440px;
  opacity: 0.9;
}
/* header (dark): grey lines don't read, so paint the pattern as white line-art via a mask */
:root[data-theme="dark"] .masthead::before {
  background: #ffffff;
  -webkit-mask: url("../people-pattern.png") repeat 0 0 / 440px;
  mask: url("../people-pattern.png") repeat 0 0 / 440px;
  opacity: 0.6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .masthead::before {
    background: #ffffff;
    -webkit-mask: url("../people-pattern.png") repeat 0 0 / 440px;
    mask: url("../people-pattern.png") repeat 0 0 / 440px;
    opacity: 0.6;
  }
}
/* footer: a deep aubergine slab in both themes, so always white line-art */
.footer-texture {
  background: #ffffff;
  -webkit-mask: url("../people-pattern.png") repeat 0 0 / 440px;
  mask: url("../people-pattern.png") repeat 0 0 / 440px;
  opacity: 0.5;
}

/* waves hidden on the light header for now */
.masthead-waves { display: none; }

.masthead-inner {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 24px 30px;
}
.masthead-deep .masthead-inner { padding-bottom: 56px; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
/* Tito logo tinted via mask so it follows the theme; relative url survives the path prefix */
.wordmark-logo {
  display: block;
  width: 38px;
  height: 17px;
  background-color: var(--brand);
  -webkit-mask: url("../tito-logo-white.svg") no-repeat center / contain;
  mask: url("../tito-logo-white.svg") no-repeat center / contain;
}
.wordmark-blog { color: var(--brand); }
.wordmark:hover { text-decoration: none; }

.site-nav { display: flex; align-items: center; gap: 18px; }
.site-header--out { 
  align-items: center;
  color: var(--muted); 
  display: flex;
  font-weight: 600;
  gap: 4px;
}
.site-header--out-icon {
  background-color: var(--muted);
  display: block;
  height: 14px;
  -webkit-mask: url("../icons/chevron-right.svg") no-repeat center / contain;
  mask: url("../icons/chevron-right.svg") no-repeat center / contain;
  width: 10px;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  background: none;
  border: 0;
  padding: 10px;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

.hero {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.18;
  margin: 44px 0 0;
  max-width: 22ch;
  color: var(--ink);
}

main { max-width: 860px; margin: 0 auto; padding: 44px 24px 56px; }

/* ---------- filters row with collapsible search ---------- */
.filters-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 36px;
  --pagefind-ui-scale: 0.9;
  --pagefind-ui-primary: var(--blue);
  --pagefind-ui-text: var(--ink);
  --pagefind-ui-background: var(--card);
  --pagefind-ui-border: var(--line);
  --pagefind-ui-tag: var(--line);
  --pagefind-ui-border-width: 1.5px;
  --pagefind-ui-border-radius: 999px;
  --pagefind-ui-font: inherit;
}
.filters-row.searching .search-toggle { display: none; }

.search-toggle, .search-close {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.search-toggle { margin-left: auto; }
.search-toggle[hidden] { display: none; }
.search-toggle:hover, .search-close:hover { border-color: var(--accent-mark); color: var(--accent-deep); }
.search-toggle-label { display: none; } /* icon-only on desktop; labelled on mobile */

.search-area {
  flex: 1;
  min-width: 220px;
  margin-left: auto;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.search-area[hidden] { display: none; }

.search { flex: 1; }
/* match the pills' height so the row doesn't jump (out-specifies Pagefind's own sizing) */
.search .pagefind-ui__form input.pagefind-ui__search-input {
  height: 45px;
  padding-top: 0;
  padding-bottom: 0;
  font-size: 0.95rem;
  font-weight: 600;
}
.search .pagefind-ui__form .pagefind-ui__search-clear {
  height: 45px;
  padding-top: 0;
  padding-bottom: 0;
}
/* results flow in the page below the row, full width
   (the drawer node is moved into .filters-row by the init script) */
.filters-row > .pagefind-ui__drawer { flex-basis: 100%; }

/* centre the magnifier icon in the shortened field */
.search .pagefind-ui__form::before {
  top: 50% !important;
  transform: translateY(-50%) !important;
}
.filters-row .pagefind-ui__result-title { font-weight: 700; }
.filters-row .pagefind-ui__result-title a { color: var(--ink); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pill {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
/* hover outline picks up each pill's category ink */
.pill:hover { border-color: var(--mark-default); color: var(--mark-default); }
.pill[data-filter="product"]:hover { border-color: var(--mark-product); color: var(--mark-product); }
.pill[data-filter="team"]:hover { border-color: var(--mark-team); color: var(--mark-team); }
.pill[data-filter="industry"]:hover { border-color: var(--mark-industry); color: var(--mark-industry); }
.pill.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* mobile: stack filters, search full-width on its own row */
@media (max-width: 620px) {
  .filters { flex-basis: 100%; gap: 8px; }
  /* pills drop a size on small screens */
  .pill { font-size: 0.85rem; padding: 6px 14px; }
  .search-toggle {
    flex-basis: 100%;
    margin-left: 0;
    width: auto;
    height: 42px;
    display: flex;
    gap: 8px;
    border-radius: 999px;
  }
  .search-toggle-label { display: inline; font-weight: 600; font-size: 0.9rem; }
  .search-area { flex-basis: 100%; margin-left: 0; min-width: 0; }
  /* tighten the oversized hero on small screens */
  .hero { font-size: clamp(1.7rem, 7vw, 2.2rem); margin-top: 30px; }
  .masthead-inner { padding: 22px 20px 24px; }
  .masthead-deep .masthead-inner { padding-bottom: 38px; }
}

/* ---------- the ticket roll ---------- */
.roll {
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  list-style: none;
  margin: 0;
  padding: 0;
}
.roll li[hidden] { display: none; }

.roll li:not([hidden]):not(:is(li:not([hidden]) ~ li:not([hidden]))) a {
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
}

.roll li:not([hidden]) + li[hidden] {
  border-top: 1px solid var(--line);
}

.roll li:not([hidden]):not(:has(~ li:not([hidden]))) a {
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 14px 14px;
}

.ticket-row {
  position: relative;
  display: block;
  padding: 26px 30px 28px;
  color: var(--ink);
  --tint: var(--tint-default);
  --mark: var(--mark-default);
  transition: background 0.15s;
}
.ticket-row[data-category="product"] { --tint: var(--tint-product); --mark: var(--mark-product); }
.ticket-row[data-category="team"] { --tint: var(--tint-team); --mark: var(--mark-team); }
.ticket-row[data-category="industry"] { --tint: var(--tint-industry); --mark: var(--mark-industry); }

a.ticket-row:hover {
  text-decoration: none;
  background: color-mix(in srgb, var(--tint) 32%, var(--card));
  /* a category-ink edge on hover — echoes the ticket stub, no layout shift */
  box-shadow: inset 4px 0 0 var(--mark);
}

/* perforated tear-line between visible tickets, with punched notches at the edges */
.roll li:not([hidden]) ~ li:not([hidden]) .ticket-row { 
  border-top: 2px dashed var(--line);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.roll li:not([hidden]) ~ li:not([hidden]) .ticket-row::before,
.roll li:not([hidden]) ~ li:not([hidden]) .ticket-row::after {
  content: "";
  position: absolute;
  top: -10px;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
}
.roll li:not([hidden]) ~ li:not([hidden]) .ticket-row::before { left: -9px; }
.roll li:not([hidden]) ~ li:not([hidden]) .ticket-row::after { right: -9px; }

/* category eyebrow above the title */
.tr-cat {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--mark);
}

.ticket-row h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.tr-byline { margin: 0 0 8px; color: var(--muted); font-size: 0.92rem; }

.tr-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 620px) {
  .ticket-row { padding: 20px 22px; }
}

/* ---------- link posts: a source link at the foot of the post ---------- */
.post--source {
  margin: 32px 0 0;
  padding: 14px 18px;
  background: color-mix(in srgb, var(--tint-industry) 30%, var(--card));
  border-radius: 10px;
  font-weight: 600;
}
.post--source a { color: var(--link); }

/* ---------- load more ---------- */
.load-more-wrap { text-align: center; margin-top: 44px; }
.load-more {
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 12px 30px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.load-more:hover { background: var(--ink); color: var(--paper); }

/* ---------- footer ---------- */
.site-footer {
  position: relative;
  overflow: hidden;
  margin-top: 72px;
  background: var(--footer-bg);
  color: var(--footer-ink);
  text-align: center;
  padding: 88px 24px 68px;
  font-size: 0.95rem;
}

.footer-inner {
  display: flex;
  flex-direction: column-reverse;
  gap: 3rem;
  max-width: 860px;
  margin: 0 auto;
  position: relative;
  text-align: left;

  @media only screen and (width >= 720px) {
    flex-direction: row;
    justify-content: space-between;
  }
}

.footer-cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 36px;
}
@media (max-width: 720px) {
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .footer-brand {
    grid-column: 1 / -1;
  }
}

.footer-brand {
  & p {
    margin-top: 0;
  }
}

.footer-col h2 {
  margin: 0 0 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.7;
}
.footer-col a {
  display: block;
  padding: 4px 0;
  color: var(--footer-ink);
  font-weight: 600;
  font-size: 0.95rem;
}
.site-footer a { color: var(--footer-ink); }

/* ---------- article ---------- */
.post { max-width: 720px; margin: 0 auto; }

.post--header h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 8px 0 10px;
}

.post--meta { color: var(--muted); margin: 0 0 8px; }
.post--author { color: var(--muted); font-weight: 600; }
.post--author:hover { color: var(--ink); }

.author-count {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.92rem;
}
.post--category { font-weight: 600; color: var(--mark-default); }
.post--category[data-category="product"] { color: var(--mark-product); }
.post--category[data-category="team"] { color: var(--mark-team); }
.post--category[data-category="industry"] { color: var(--mark-industry); }

.post--banner {
  width: 100%;
  border-radius: 12px;
  margin-top: 20px;
}

.post--content {
  font-size: 1.1rem;
  line-height: 1.75;
  margin-top: 24px;
}
.post--content img { max-width: 100%; border-radius: 8px; }
.post--content a { font-weight: 600; }
.post--content blockquote {
  margin: 24px 0;
  padding-left: 20px;
  border-left: 3px solid var(--blue);
  color: var(--muted);
}
.post--content pre {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  font-size: 0.9em;
}

.post--back { margin-top: 48px; }

@media (prefers-reduced-motion: reduce) {
  .ticket-row, .pill, .load-more { transition: none; }
}
