/* Blog UI on top of the site styles (loaded last):
   header tools, search, breadcrumb, tags, collapsible table of contents, and the light theme. */

/* ---------- Header tools ---------- */
.site-header__inner { position: relative; }

.header-tools {
  position: absolute;
  top: 50%;
  right: 0;
  display: flex;
  gap: 8px;
  transform: translateY(-50%);
}

.site-header .tool-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  height: 38px;
  min-width: 38px;
  margin: 0;
  padding: 0 10px !important;
  color: var(--ed-text) !important;
  border: 1px solid var(--ed-border) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  clip-path: none !important;
  font: 600 14px/1 Arial, Helvetica, sans-serif !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  cursor: pointer;
  transform: none !important;
  transition: border-color .15s ease, color .15s ease !important;
}

.site-header .tool-btn:hover {
  color: var(--ed-cyan) !important;
  border-color: var(--ed-cyan) !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

.tool-btn svg { width: 18px; height: 18px; flex: 0 0 18px; }

.tool-btn__kbd {
  padding: 2px 5px;
  color: var(--ed-muted);
  border: 1px solid var(--ed-border);
  font: 600 11px/1.2 ui-monospace, Menlo, Consolas, monospace;
}

/* Sun in dark mode (switch to light), moon in light mode */
html[data-theme="light"] .icon-sun,
html:not([data-theme="light"]) .icon-moon { display: none; }

@media (max-width: 760px) {
  .tool-btn__label, .tool-btn__kbd { display: none; }
  .site-header .tool-btn { padding: 0 !important; justify-content: center; }
}

/* ---------- Search ---------- */
dialog.search {
  width: min(680px, calc(100vw - 24px));
  max-height: min(72vh, 640px);
  margin: 10vh auto auto;
  padding: 0;
  overflow: hidden;
  color: var(--ed-copy);
  border: 1px solid var(--ed-border-strong);
  background: var(--ed-surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
}

dialog.search[open] { display: flex; flex-direction: column; }
dialog.search::backdrop { background: rgba(5, 5, 8, .72); backdrop-filter: blur(4px); }

.search__box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ed-border);
}

.search__box > svg { width: 20px; height: 20px; flex: 0 0 20px; color: var(--ed-muted); }

dialog.search .search__box input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  color: var(--ed-text) !important;
  border: 0 !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
  font: 400 18px/1.4 Arial, Helvetica, sans-serif;
}

dialog.search .search__box input::-webkit-search-cancel-button { display: none; }

dialog.search .search__close {
  padding: 4px 8px !important;
  color: var(--ed-muted) !important;
  border: 1px solid var(--ed-border) !important;
  background: transparent !important;
  box-shadow: none !important;
  clip-path: none !important;
  font: 600 11px/1.2 ui-monospace, Menlo, Consolas, monospace !important;
  text-transform: none !important;
  cursor: pointer;
  transform: none !important;
}

.search__results {
  flex: 1;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}

.search__results:empty { display: none; }
.search__results li { margin: 0; }

.search__results a {
  display: block;
  padding: 12px 14px;
  color: var(--ed-copy) !important;
  border: 1px solid transparent;
  text-decoration: none !important;
}

.search__results li[aria-selected="true"] a,
.search__results a:hover {
  border-color: var(--ed-border-strong);
  background: rgba(32, 231, 237, .07);
}

.search__kicker {
  display: block;
  color: var(--ed-cyan);
  font: 700 11px/1.3 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.search__results strong {
  display: block;
  margin: 3px 0 4px;
  color: var(--ed-text) !important;
  font-size: 17px;
  line-height: 1.3;
}

.search__snippet {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ed-muted);
  font-size: 14px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.search__results mark {
  color: var(--ed-text) !important;
  background: rgba(239, 255, 74, .30) !important;
}

.search__status {
  margin: 0;
  padding: 9px 16px;
  color: var(--ed-muted) !important;
  border-top: 1px solid var(--ed-border);
  font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  color: var(--ed-muted);
  font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace;
}

.breadcrumb li { margin: 0; color: var(--ed-muted) !important; }
.breadcrumb li + li::before { content: "/"; margin: 0 8px; color: var(--ed-magenta); }
.breadcrumb a { color: var(--ed-muted) !important; text-decoration: none !important; }
.breadcrumb a:hover { color: var(--ed-cyan) !important; }

.breadcrumb [aria-current="page"] {
  display: inline-block;
  max-width: min(46ch, 60vw);
  overflow: hidden;
  vertical-align: bottom;
  color: var(--ed-copy);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Tags ---------- */
a.post-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  color: var(--ed-copy) !important;
  border: 1px solid var(--ed-border);
  background: var(--ed-surface);
  font: 600 13px/1.3 ui-monospace, Menlo, Consolas, monospace;
  text-decoration: none !important;
  transition: border-color .15s ease, color .15s ease;
}

a.post-tag:hover { color: var(--ed-cyan) !important; border-color: var(--ed-cyan); }
.post-tag__count { color: var(--ed-muted); font-size: 11px; }
a.post-tag--all { color: var(--ed-cyan) !important; }
a.post-tag--lg { padding: 10px 14px; font-size: 15px; }

.tag-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 12px; padding: 44px 0 72px; }

.post-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 44px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--ed-border);
}

.post-tags__label {
  margin-right: 4px;
  color: var(--ed-muted);
  font: 700 12px/1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ---------- Collapsible table of contents ---------- */
details.toc--collapsible { padding: 0 !important; margin: 28px 0; }

details.toc--collapsible > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  list-style: none;
  cursor: pointer;
}

details.toc--collapsible > summary::-webkit-details-marker { display: none; }

details.toc--collapsible > summary::after {
  content: "+";
  margin-left: auto;
  color: var(--ed-cyan);
  font: 700 22px/1 ui-monospace, Menlo, Consolas, monospace;
}

details.toc--collapsible[open] > summary::after { content: "−"; }
.toc__title { color: var(--ed-text); font: 900 1.15rem/1.2 Arial, Helvetica, sans-serif; letter-spacing: -.02em; }
.toc__count { color: var(--ed-muted); font: 12px/1 ui-monospace, Menlo, Consolas, monospace; }
details.toc--collapsible > nav { padding: 0 22px 18px; }
details.toc--collapsible ol { margin: 0; }

/* =====================================================================
   Light theme: clean reading, same brand accents
   ===================================================================== */
html[data-theme="light"] {
  color-scheme: light;
  background: #f6f6f3 !important;
  --ed-bg: #f6f6f3;
  --ed-surface: #ffffff;
  --ed-surface-raised: #f1f2f5;
  --ed-surface-soft: #eceef2;
  --ed-text: #11131a;
  --ed-copy: #2a2e39;
  --ed-muted: #5b6070;
  --ed-cyan: #00737a;
  --ed-magenta: #b8178f;
  --ed-yellow: #8a6400;
  --ed-border: rgba(17, 19, 26, .13);
  --ed-border-strong: rgba(0, 115, 122, .45);
  --ed-shadow: 0 10px 30px rgba(17, 19, 26, .07);
  --bg: #f6f6f3 !important;
  --bg-soft: #ffffff !important;
  --surface: #ffffff !important;
  --text: #11131a !important;
  --muted: #5b6070 !important;
  --line: rgba(17, 19, 26, .13) !important;
  --brand: #00737a !important;
  --accent: #00737a !important;
  --soft: #f1f2f5 !important;
}

html[data-theme="light"] body {
  color: var(--ed-copy) !important;
  background-color: var(--ed-bg) !important;
  background-image: none !important;
}

html[data-theme="light"] body::after { display: none !important; }
html[data-theme="light"] :is(article, .article-header, .content) { color: var(--ed-copy) !important; }
html[data-theme="light"] ::selection { color: #fff; background: var(--ed-magenta); }

/* Links: readable teal on white (buttons, tags and cards keep their own colors) */
html[data-theme="light"] :is(main, footer, dialog) a:not(.button):not(.post-tag):not(.article-card):not(.yt__link) {
  color: var(--ed-cyan) !important;
  text-decoration-color: rgba(0, 115, 122, .45) !important;
}
html[data-theme="light"] :is(main, footer, dialog) a:not(.button):not(.post-tag):not(.article-card):hover { color: var(--ed-magenta) !important; }
html[data-theme="light"] .breadcrumb a { color: var(--ed-muted) !important; }
html[data-theme="light"] .search__results a { color: var(--ed-copy) !important; }

/* Header and page headers */
html[data-theme="light"] .site-header {
  background: rgba(246, 246, 243, .92) !important;
  box-shadow: 0 1px 0 var(--ed-border) !important;
}
html[data-theme="light"] .page-header { background: #ffffff !important; box-shadow: none !important; }
html[data-theme="light"] :is(.logo img, .site-header img) {
  filter: grayscale(1) brightness(0) drop-shadow(3px 2px 0 rgba(184, 23, 143, .30)) !important;
}

/* Remove dark section fills from the site-wide stylesheet */
html[data-theme="light"] :where(section:nth-of-type(even)) {
  background-color: transparent !important;
  background-image: none !important;
  border-color: var(--ed-border) !important;
}

/* Panels and cards: white, thin border, no cut corners */
html[data-theme="light"] :where(.toc, .tool-box, .related, .note, .video-box, .disclosure, .choice, .offer, .result, .faq,
  .source-note, details, .card, .info-card, .callout, .step, .table-wrap, .article-card, .price) {
  color: var(--ed-copy) !important;
  border-color: var(--ed-border) !important;
  background: var(--ed-surface) !important;
  box-shadow: none !important;
  clip-path: none !important;
}

/* Keep each panel's colored left edge */
html[data-theme="light"] :is(.toc, .tool-box, .choice, .offer) { border-left: 4px solid var(--ed-cyan) !important; }
html[data-theme="light"] :is(.note, .disclosure, .source-note) { border-left: 4px solid #d4a800 !important; }
html[data-theme="light"] :is(.related, .video-box, .result) { border-left: 4px solid var(--ed-magenta) !important; }

html[data-theme="light"] :is(section.cta, div.cta, .cta) {
  border-color: var(--ed-border-strong) !important;
  background: linear-gradient(135deg, rgba(0, 115, 122, .06), rgba(184, 23, 143, .05)), #ffffff !important;
  box-shadow: none !important;
  clip-path: none !important;
}

html[data-theme="light"] .codex-hostinger-card {
  border-color: rgba(184, 23, 143, .30) !important;
  background: linear-gradient(145deg, #ffffff, #f6f1f8) !important;
}
html[data-theme="light"] .codex-hostinger-card::before { color: rgba(17, 19, 26, .05) !important; }

html[data-theme="light"] .article-card:hover {
  border-color: var(--ed-border-strong) !important;
  box-shadow: 0 14px 34px rgba(17, 19, 26, .08) !important;
}

/* Images and media: light frame, soft shadow */
html[data-theme="light"] :is(.featured-image, .article-visual, .video-box iframe, .content iframe, .content video, .article-card__image, img.hero) {
  border-color: var(--ed-border) !important;
  background: #ffffff !important;
  box-shadow: var(--ed-shadow) !important;
}
html[data-theme="light"] .article-card__image { box-shadow: none !important; border-bottom-color: var(--ed-border) !important; }
html[data-theme="light"] .meta img { box-shadow: none; }

/* Highlights */
html[data-theme="light"] .mark,
html[data-theme="light"] mark {
  color: var(--ed-text) !important;
  background: linear-gradient(transparent 56%, rgba(255, 214, 0, .45) 56%) !important;
}
html[data-theme="light"] .search__results mark { background: rgba(255, 214, 0, .45) !important; }
html[data-theme="light"] blockquote { background: var(--ed-surface-raised) !important; }

/* Buttons keep the brand cyan */
html[data-theme="light"] :is(.button, a.button, .copy-button) {
  color: #041012 !important;
  border-color: #17cfd6 !important;
  background: #20e7ed !important;
  box-shadow: 4px 4px 0 rgba(184, 23, 143, .35) !important;
}
html[data-theme="light"] :is(.button, a.button, .copy-button):hover {
  border-color: #e2c300 !important;
  background: #ffe14a !important;
}

/* Numbered steps and table headers */
html[data-theme="light"] :is(.step-list, .checklist) li::before { color: #041012 !important; background: #20e7ed !important; }
html[data-theme="light"] th { color: #041012 !important; background: #b9f4f6 !important; border-color: var(--ed-border) !important; }
html[data-theme="light"] :is(table, .content table) { background: #ffffff !important; }

/* Code: dark blocks stay dark, inline code turns light */
html[data-theme="light"] :is(pre, .code-copy pre) { color: #e6edf3 !important; background: #10131a !important; border-color: #10131a !important; }
html[data-theme="light"] pre code { color: #e6edf3 !important; background: transparent !important; }
html[data-theme="light"] :not(pre) > code { color: #a3176f !important; background: #f1eef4 !important; border-color: transparent !important; }
html[data-theme="light"] .code-copy { background: #10131a !important; }

/* Footer */
html[data-theme="light"] .site-footer { color: var(--ed-muted) !important; background: #ffffff !important; }

/* Search in light mode */
html[data-theme="light"] dialog.search { box-shadow: 0 30px 90px rgba(17, 19, 26, .25); }
html[data-theme="light"] dialog.search::backdrop { background: rgba(17, 19, 26, .35); }
html[data-theme="light"] .search__results li[aria-selected="true"] a,
html[data-theme="light"] .search__results a:hover { background: rgba(0, 115, 122, .06); }
html[data-theme="light"] .price.winner { border-color: #d4a800 !important; background: #fffbe6 !important; }

/* Hostinger promo card (Codex post) had no inner spacing */
.codex-hostinger-card { margin: 32px 0; padding: clamp(20px, 4vw, 32px) !important; }
.codex-hostinger-card__coupon { display: block; padding: 10px 14px; border: 1px solid; }

/* Phones: on posts the title is right below, so the trail stops at "Blog" */
@media (max-width: 600px) {
  .article-header .breadcrumb li:last-child:not(:first-child) { display: none; }
}
