/* ES Performance blog. Builds on styles.css (same colors, type and square corners) */

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

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 50;
  background: var(--purple);
  padding: 10px 16px;
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
}
.skip:focus { top: 12px; }

.text-link {
  font-family: var(--font-label);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lavender);
  text-decoration: none;
}
.text-link:hover { color: var(--white); }

/* Search box */

.search-box {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--lavender);
  background: var(--black);
  position: relative;
}

.search-box svg {
  width: 20px;
  height: 20px;
  flex: none;
  align-self: center;
  margin-left: 16px;
  fill: none;
  stroke: var(--lavender);
  stroke-width: 2;
}

.search-box input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--white);
  font: inherit;
  font-size: 16px;
  padding: 15px 14px;
  border-radius: 0;
  -webkit-appearance: none;
}

.search-box input::placeholder { color: var(--gray); }
.search-box input:focus { outline: none; }
.search-box:focus-within { border-color: var(--purple-light); box-shadow: 0 0 0 1px var(--purple-light); }
.search-box input::-webkit-search-cancel-button { display: none; }

.search-box .btn { border: 0; cursor: pointer; font: inherit; font-family: var(--font-label); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; }

.search-clear {
  background: none;
  border: 0;
  border-left: 1px solid var(--line);
  color: var(--gray);
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0 16px;
  cursor: pointer;
}
.search-clear:hover { color: var(--white); }

.search-box.big input { font-size: 17px; padding: 18px 14px; }

/* Blog hero */

.blog-hero { background: var(--ink); overflow: hidden; }

.blog-hero-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  padding-top: clamp(48px, 7vw, 96px);
  padding-bottom: clamp(48px, 7vw, 96px);
}

.blog-hero .script { font-size: clamp(32px, 3.6vw, 46px); font-weight: 600; line-height: 1.1; margin: 0 0 10px; }

.blog-hero h1 { font-size: clamp(36px, 5vw, 68px); margin-bottom: 24px; }

.blog-hero .lead { max-width: 56ch; margin: 0 0 30px; }

.blog-hero .search-box { max-width: 640px; }

.blog-hero-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }

.popular {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin: 20px 0 0;
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.popular span { color: var(--gray); }

.popular a { color: var(--lavender); text-decoration: none; border-bottom: 1px solid rgba(226, 212, 255, 0.4); padding-bottom: 2px; }

.popular a:hover { color: var(--white); border-color: var(--white); }

/* Topics */

.topics-band { padding: clamp(64px, 9vw, 112px) 0; }

.topic-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.topic-tile {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px 20px 22px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background 0.2s;
}

.topic-tile:hover, .topic-tile[aria-current="page"] { background: rgba(140, 82, 255, 0.14); }

.tt-num {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  font-weight: 800;
  font-size: 46px;
  line-height: 0.9;
  color: var(--purple);
}

.tt-name {
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 16px 0 8px;
  line-height: 1.35;
}

.tt-short { color: var(--gray); font-size: 14px; line-height: 1.5; margin-bottom: 18px; }

.tt-count {
  margin-top: auto;
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lavender);
}

.topic-tile:hover .tt-count { color: var(--white); }

/* Latest */

.lib-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 36px; }

.lib-head h2 { font-size: clamp(28px, 3.4vw, 44px); }

.latest-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(24px, 4vw, 48px);
}

.feature { display: flex; flex-direction: column; text-decoration: none; border: 1px solid var(--line); background: var(--black); }

.feature-img { aspect-ratio: 16 / 9; overflow: hidden; background: var(--ink); }

.feature-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s; }

.feature:hover .feature-img img { transform: scale(1.03); }

.feature-body { padding: 28px 28px 30px; }

.feature h3 { font-size: clamp(22px, 2.4vw, 32px); line-height: 1.15; margin: 0 0 14px; }

.feature-body > p:not(.pc-topic):not(.pc-meta) { color: var(--gray); margin: 0 0 16px; }

.feature:hover h3 { color: var(--lavender); }

.latest-list { display: grid; align-content: start; border-top: 1px solid var(--line); }

.mini { display: block; text-decoration: none; padding: 22px 0; border-bottom: 1px solid var(--line); }

.mini h3 { font-family: var(--font-display); font-stretch: 125%; font-variation-settings: "wdth" 125; font-weight: 700; font-size: 18px; line-height: 1.25; margin: 0 0 10px; }

.mini:hover h3 { color: var(--lavender); }

/* Post cards */

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 24px;
}

.post-card { display: flex; }

.post-card[hidden] { display: none; }

.pc-link {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--black);
  transition: border-color 0.2s;
}

.pc-link:hover { border-color: var(--purple); }

.pc-img { aspect-ratio: 16 / 10; overflow: hidden; background: var(--ink); }

.pc-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s; }

.pc-link:hover .pc-img img { transform: scale(1.04); }

.pc-noimg { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--ink), #2a1650); }

.pc-noimg span { font-family: var(--font-label); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--lavender); }

.pc-body { display: flex; flex-direction: column; flex: 1; padding: 20px 20px 22px; }

.pc-topic {
  font-family: var(--font-label);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--purple-light);
  margin: 0 0 10px;
}

.pc-title {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.25;
  margin: 0 0 10px;
}

.pc-link:hover .pc-title { color: var(--lavender); }

.pc-desc {
  color: var(--gray);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pc-meta {
  margin: auto 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-family: var(--font-label);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray);
}

.pc-meta span::before { content: ""; display: inline-block; width: 4px; height: 4px; background: var(--purple); margin-right: 10px; vertical-align: middle; }

mark { background: rgba(140, 82, 255, 0.45); color: var(--white); padding: 0 2px; }

/* Library: search, filters, results */

.library { scroll-margin-top: 80px; }

.lib-tools {
  position: sticky;
  top: 77px;
  z-index: 5;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(6px);
  padding: 16px 0 14px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
}

.lib-selects { display: flex; gap: 10px; }

.lib-selects select {
  height: 100%;
  min-height: 52px;
  background: var(--black);
  color: var(--white);
  border: 1px solid var(--lavender);
  border-radius: 0;
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0 38px 0 16px;
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--lavender) 50%), linear-gradient(135deg, var(--lavender) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.chips {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.chip {
  flex: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--gray);
  font-family: var(--font-label);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.chip:hover { color: var(--white); border-color: var(--lavender); }

.chip[aria-pressed="true"] { background: var(--purple); border-color: var(--purple); color: var(--white); }

.lib-status {
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gray);
  margin: 18px 0 22px;
}

.lib-status strong { color: var(--white); font-weight: 600; }

.lib-empty { border: 1px solid var(--line); padding: 40px 32px; text-align: center; }

.lib-empty h3 { font-size: 26px; margin-bottom: 12px; }

.lib-empty p { color: var(--gray); max-width: 56ch; margin: 0 auto 24px; }

.lib-empty .btn-row { justify-content: center; }

.lib-empty button.btn, .center-cta button.btn { cursor: pointer; font-family: var(--font-label); }

/* Topic pages */

.topic-hero { background: var(--ink); padding: clamp(40px, 6vw, 72px) 0 clamp(56px, 8vw, 96px); }

.topic-hero h1 { font-size: clamp(36px, 5.4vw, 72px); }

.topic-hero .lead { max-width: 62ch; font-size: 18px; }

.topic-count {
  margin: 18px 0 0;
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lavender);
}

.topic-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.topic-links a {
  display: block;
  border: 1px solid var(--line);
  padding: 12px 16px;
  text-decoration: none;
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray);
}

.topic-links a:hover { color: var(--white); border-color: var(--purple); background: rgba(140, 82, 255, 0.14); }

/* Breadcrumbs */

.crumbs ol {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray);
}

.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--purple); }

.crumbs a { color: var(--gray); text-decoration: none; }

.crumbs a:hover { color: var(--white); }

/* Article page */

.read-progress { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 40; pointer-events: none; }

.read-progress span { display: block; height: 100%; width: 0; background: var(--purple); }

.post-head { background: var(--ink); padding: clamp(36px, 5vw, 64px) 0 clamp(40px, 5vw, 64px); }

.post-head .eyebrow a { color: var(--purple-light); text-decoration: none; }

.post-head h1 { font-size: clamp(30px, 4.2vw, 56px); line-height: 1.08; max-width: 22ch; margin-bottom: 26px; }

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 0;
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray);
}

.post-meta a { color: var(--white); text-decoration: none; }

.post-meta > * + *::before { content: ""; display: inline-block; width: 5px; height: 5px; background: var(--purple); margin-right: 12px; vertical-align: middle; }

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(32px, 5vw, 72px);
  padding-top: clamp(32px, 5vw, 56px);
  padding-bottom: clamp(56px, 8vw, 96px);
}

.post-main { min-width: 0; max-width: 760px; }

.post-hero-img { margin: 0 0 40px; }

.post-hero-img img { width: 100%; max-height: 560px; object-fit: cover; }

.post-body { font-size: 18px; line-height: 1.75; color: #E8E4EF; }

.post-body > * { margin: 0 0 1.25em; }

.post-body h2 {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  font-weight: 800;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.2;
  color: var(--white);
  margin: 2em 0 0.7em;
  scroll-margin-top: 100px;
}

.post-body h2::before { content: ""; display: block; width: 40px; height: 3px; background: var(--purple); margin-bottom: 16px; }

.post-body h3, .post-body h4 {
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 1.8em 0 0.6em;
  scroll-margin-top: 100px;
}

.post-body strong { color: var(--white); }

.post-body a { color: var(--lavender); text-decoration: underline; text-decoration-color: rgba(168, 125, 255, 0.6); text-underline-offset: 3px; }

.post-body a:hover { color: var(--white); text-decoration-color: var(--white); }

.post-body ul, .post-body ol { padding-left: 1.3em; }

.post-body li { margin-bottom: 0.5em; }

.post-body li::marker { color: var(--purple-light); }

.post-body figure { margin: 2em 0; }

.post-body img { height: auto; margin: 0 auto; }

.post-body table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }

.post-body td, .post-body th { border: 1px solid var(--line); padding: 10px 12px; vertical-align: top; }

.post-body blockquote { margin: 2em 0; padding: 4px 0 4px 24px; border-left: 3px solid var(--purple); color: var(--white); }

.post-body blockquote.pull { border: 0; padding: 30px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; }

.post-body blockquote.pull p {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  font-weight: 700;
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.3;
  margin: 0;
}

.post-body blockquote.pull::before { content: ""; position: absolute; top: -1px; left: 0; width: 64px; height: 4px; background: var(--purple); }

/* YouTube videos load only when played */

.video { position: relative; aspect-ratio: 16 / 9; background: var(--ink); margin: 2em 0; }

.video-start { position: absolute; inset: 0; display: block; }

.video-start img { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; transition: opacity 0.2s; }

.video-start:hover img { opacity: 1; }

.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 78px;
  height: 78px;
  transform: translate(-50%, -50%);
  background: var(--purple);
}

.video-play::after {
  content: "";
  position: absolute;
  left: 32px;
  top: 25px;
  border-style: solid;
  border-width: 14px 0 14px 22px;
  border-color: transparent transparent transparent var(--white);
}

.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Post footer */

.post-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.post-foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }

.post-foot a, .post-foot button {
  display: block;
  border: 1px solid var(--line);
  background: none;
  color: var(--gray);
  padding: 9px 13px;
  text-decoration: none;
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.post-foot a:hover, .post-foot button:hover { color: var(--white); border-color: var(--purple); }

.post-foot .eyebrow { margin-bottom: 12px; }

.author-box {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 32px;
  align-items: start;
  margin-top: 48px;
  padding: 32px;
  background: var(--ink);
  border-top: 6px solid var(--purple);
}

.author-box img { width: 160px; height: 160px; object-fit: cover; object-position: center top; }

.author-box h2 { font-size: 24px; margin-bottom: 12px; }

.author-box p { color: var(--gray); font-size: 15px; margin: 0 0 20px; }

/* Sidebar */

.post-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.toc, .side-card { border: 1px solid var(--line); padding: 22px 22px 24px; }


.toc .eyebrow { margin-bottom: 14px; }

.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }

.toc li { counter-increment: toc; border-top: 1px solid var(--line); }

.toc a {
  display: grid;
  grid-template-columns: 26px 1fr;
  padding: 10px 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--gray);
  text-decoration: none;
}

.toc a::before { content: counter(toc, decimal-leading-zero); font-family: var(--font-label); font-size: 12px; color: var(--purple-light); padding-top: 2px; }

.toc a:hover, .toc a.active { color: var(--white); }

.side-title {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.25;
  margin: 0 0 18px;
}

.side-actions { display: grid; gap: 10px; }

.side-actions .btn { font-size: 12px; }

.side-actions .btn span:first-child { flex: 1; padding: 13px 14px; }

.side-book { display: grid; grid-template-columns: 84px 1fr; gap: 18px; align-items: center; }

.side-book img { width: 84px; }

.side-book .side-title { font-size: 15px; margin-bottom: 10px; }

/* Related and pager */

.related .post-grid { margin-bottom: 40px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.pager-link { display: block; text-decoration: none; border: 1px solid var(--line); padding: 20px 22px; background: var(--black); }

.pager-link .eyebrow { display: block; margin-bottom: 8px; }

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

.pager-title { font-family: var(--font-display); font-stretch: 125%; font-variation-settings: "wdth" 125; font-weight: 700; font-size: 16px; line-height: 1.3; }

.pager-link:hover { border-color: var(--purple); }

/* Responsive */

@media (max-width: 1100px) {
  .topic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1060px) {
  .lib-tools { top: 0; position: relative; }
}

@media (max-width: 960px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-main { max-width: none; }
  .post-side { position: static; max-height: none; overflow: visible; }
  .post-side { order: -1; }
  .post-side .side-card { display: none; }
  .post-layout::after { content: none; }
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .latest-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .blog-hero-grid { grid-template-columns: 1fr; }
  .blog-hero-photo { display: none; }
  .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lib-tools { grid-template-columns: 1fr; }
  .lib-selects select { width: 100%; }
  .lib-selects label { flex: 1; }
  .post-foot { grid-template-columns: 1fr; }
  .author-box { grid-template-columns: 1fr; padding: 26px 22px; }
  .author-box img { width: 110px; height: 110px; }
  .pager { grid-template-columns: 1fr; }
  .pager-link.next { text-align: left; }
}

@media (max-width: 600px) {
  .post-grid { grid-template-columns: 1fr; }
  .topic-grid { grid-template-columns: 1fr; }
  .tt-num { font-size: 36px; }
  .search-box.big .btn .arrow { display: none; }
  .search-box.big .btn span { padding: 14px 16px; }
  .post-body { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .pc-img img, .feature-img img { transition: none; }
}
