:root {
  --brand-start: #0b91cf;
  --brand-end: #095393;
  --brand: #095393;
  --ring: rgba(11, 145, 207, .35);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: #f7f8fc;
  color: #0f172a;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Panel & Buttons --- */
.light-panel {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: hsl(0 0% 100% / .85);
  border: 1px solid hsl(0 0% 100% / .35);
  border-radius: 1.25rem;
  box-shadow: 0 8px 32px rgb(31 38 135 / .08);
  transition: .3s cubic-bezier(.25, .8, .25, 1);
}

.btn-primary {
  background-image: linear-gradient(to right, var(--brand-start) 0, var(--brand-end) 50%, var(--brand-start) 100%);
  background-size: 200% auto;
  box-shadow: 0 8px 20px rgb(9 83 147 / .25);
  color: #fff;
  transition: all .35s ease;
}

.btn-primary:hover {
  background-position: 100%;
  box-shadow: 0 12px 28px rgb(9 83 147 / .3);
  transform: translateY(-1px);
}

.nav-link {
  padding-bottom: 6px;
  position: relative;
  transition: color .25s;
}

.nav-link:after {
  background: linear-gradient(90deg, var(--brand-start), var(--brand-end));
  bottom: 0;
  content: "";
  height: 2px;
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
  transition: width .25s;
  width: 0;
}

.nav-link.active,
.nav-link:hover {
  color: var(--brand);
}

.nav-link.active:after,
.nav-link:hover:after {
  width: 100%;
}

#read-progress {
  background: linear-gradient(90deg, var(--brand-start), var(--brand-end));
  height: 4px;
  left: 0;
  position: fixed;
  top: 0;
  width: 0;
  z-index: 60;
}

/* --- Fade animations --- */
@media (prefers-reduced-motion:no-preference) {
  .fade {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .5s ease, transform .5s ease;
  }

  .fade.show {
    opacity: 1;
    transform: translateY(0);
  }

  .fade-img {
    opacity: 0;
    transition: opacity .8s ease;
  }

  .fade-img.loaded {
    opacity: 1;
  }

  .fade-scroll {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .8s ease, transform .8s ease;
  }

  .fade-scroll.visible {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Prose (article content) --- */
.prose {
  color: #0f172a;
  max-width: 72ch;
  margin-left: auto;
  margin-right: auto;
}

.prose h2 {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.3;
  margin-bottom: 1rem;
  margin-top: 3rem;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.5rem;
}

.prose h3 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.75rem;
  margin-top: 2.5rem;
}

.prose h2,
.prose h3 {
  scroll-margin-top: 110px;
}

.prose p {
  font-size: 1.125rem;
  line-height: 1.75;
  margin: 1.5rem 0;
}

.prose ul,
.prose ol {
  list-style: disc;
  margin-left: 1.3rem;
  padding-left: 1rem;
  font-size: 1.125rem;
  line-height: 1.75;
}

.prose ol {
  list-style: decimal;
}

.prose li {
  margin: 0.5rem 0;
  padding-left: 0.25rem;
}

.prose strong {
  color: #0b1220;
  font-weight: 700;
}

.prose a {
  color: var(--brand-end);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid var(--brand-start);
  transition: all 0.2s ease-in-out;
  padding-bottom: 1px;
  border-radius: 2px;
}

.prose a:hover {
  color: var(--brand-start);
  background-color: #f0f9ff;
  border-color: var(--brand-end);
}

.prose hr {
  border: 0;
  border-top: 1px solid #e5e7eb;
  margin: 3rem auto;
}

.prose blockquote {
  background: #f8fafc;
  border-left: 3px solid var(--brand-start);
  border-radius: .75rem;
  color: #334155;
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  font-style: italic;
  font-size: 1.15rem;
}

.prose blockquote p {
  font-size: inherit;
  line-height: 1.7;
  margin: 0.5rem 0;
}

.prose img {
  border-radius: 1rem;
  margin: 2.5rem 0;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
}

.prose figure {
  margin: 2.5rem 0;
}

.prose figcaption {
  color: #64748b;
  font-size: 0.95rem;
  margin-top: 0.75rem;
  text-align: center;
  font-style: italic;
}

/* --- Callouts & Pull-quotes --- */
.callout {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  display: flex;
  gap: .9rem;
  padding: 1.25rem;
}

.callout .icon {
  flex: 0 0 auto;
  margin-top: 0.125rem;
}

.callout .title {
  font-weight: 700;
  margin-bottom: .25rem;
}

.callout p {
  margin: 0.25rem 0;
}

.callout.note {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.callout.tip {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.callout.warn {
  background: #fff7ed;
  border-color: #fecaca;
}

.callout.danger {
  background: #fef2f2;
  border-color: #fca5a5;
}

.pull-quote {
  background: #f1f5f9;
  border-radius: 1rem;
  isolation: isolate;
  margin: 2.5rem auto;
  padding: 1.5rem 2rem;
  position: relative;
  text-align: center;
}

.pull-quote p {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.7;
  margin: 0;
}

.pull-quote:before {
  color: #bae6fd;
  content: "“";
  font-size: 4rem;
  left: 1rem;
  position: absolute;
  top: -1.5rem;
  z-index: -1;
  opacity: 0.8;
}

/* --- Tables --- */
.table-wrap {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  overflow: auto;
  margin: 2rem 0;
}

table.table {
  border-collapse: collapse;
  font-size: 0.95rem;
  width: 100%;
}

.table td,
.table th {
  border-bottom: 1px solid #eef2f7;
  padding: 1rem 1.25rem;
  text-align: left;
  vertical-align: top;
}

.table thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table tbody tr {
  transition: background-color 0.2s ease;
}

.table tbody tr:hover {
  background: #f9fbff;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

/* --- Footer & Utilities --- */
pre,
code {
  max-width: 100%;
  overflow: auto;
}

#toc a {
  transition: color .2s;
}

#toc a.active {
  color: var(--brand-end);
  font-weight: 600;
}

.toast {
  bottom: 24px;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transform: translateX(-50%) translateY(10px);
  transition: all .25s;
  z-index: 60;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.footer-wrap {
  background: #0f172a;
}

.footer-gradient {
  background: radial-gradient(800px 300px at 10% 0, rgb(11 145 207 / .15), transparent 60%), radial-gradient(800px 300px at 90% 0, rgb(9 83 147 / .15), transparent 60%);
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.footer-input {
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
  transition: .25s;
}

.footer-input:focus {
  border-color: var(--brand-end);
  box-shadow: 0 0 0 3px rgb(11 145 207 / .2);
  outline: none;
}

.footer-social {
  align-items: center;
  background: #1e293b;
  border-radius: .75rem;
  display: inline-flex;
  justify-content: center;
  padding: .6rem;
  transition: .2s;
}

.footer-social:hover {
  background: #334155;
  transform: translateY(-2px);
}

.footer-link-ux {
  transition: color .2s, transform .2s;
}

.footer-link-ux:hover {
  color: #fff;
  transform: translateX(2px);
}

.pay-badge {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: .5rem;
  color: #e2e8f0;
  font-size: .75rem;
  font-weight: 600;
  padding: .35rem .55rem;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* --- Responsive (mobile) --- */
@media (max-width: 1024px) {
  body {
    background-attachment: scroll !important;
  }

  .light-panel {
    border-radius: 1rem;
  }
}

@media (max-width: 640px) {
  .prose {
    font-size: 1rem;
    max-width: 100%;
  }

  .prose h2 {
    font-size: 1.4rem;
  }

  .prose h3 {
    font-size: 1.1rem;
  }

  .prose p,
  .prose ul,
  .prose ol,
  .prose li,
  .prose blockquote,
  .prose blockquote p {
    font-size: 1rem;
    line-height: 1.6;
  }

  .prose ul,
  .prose ol {
    margin-left: 1rem;
    padding-left: 0.5rem;
  }

  .prose img,
  .prose figure {
    margin: 1.5rem 0;
    border-radius: 0.75rem;
  }

  .prose blockquote {
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
  }

  .callout {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .pull-quote {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
  }

  .pull-quote p {
    font-size: 1.125rem;
  }

  .pull-quote:before {
    font-size: 3rem;
    top: -1rem;
  }

  .table-wrap {
    width: 100%;
    margin: 1.5rem 0;
  }

  .table td,
  .table th {
    padding: 0.75rem 1rem;
  }

  .light-panel {
    padding: 1.1rem;
  }

  nav[aria-label="Breadcrumb"] ol {
    row-gap: .25rem;
  }

  #toc,
  #tag-list {
    word-break: break-word;
  }
}

/* Extra small devices (≤480px) */
@media (max-width: 480px) {
  .prose {
    padding: 0 0.75rem;
  }

  .prose p,
  .prose ul,
  .prose ol,
  .prose li,
  .prose blockquote {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .prose h2 {
    font-size: 1.25rem;
  }

  .prose h3 {
    font-size: 1rem;
  }

  .callout {
    padding: 0.75rem;
  }

  .pull-quote {
    padding: 1rem;
  }

  .table td,
  .table th {
    padding: 0.5rem 0.75rem;
  }

  #toc a {
    font-size: 0.85rem;
  }
}

/* Ultra small devices (≤380px) – extra safety */
@media (max-width: 380px) {
  main.container {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  #post-title {
    font-size: 1.75rem !important;
  }

  .prose {
    font-size: 0.9rem !important;
  }
}

/* Global overflow protection */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

main,
header,
footer,
section,
.light-panel,
.container {
  max-width: 100%;
  overflow-x: clip;
}

.prose,
.prose h1,
.prose h2,
.prose h3,
.prose h4,
#post-title {
  overflow-wrap: anywhere;
  word-break: break-word;
}

img,
video,
iframe {
  max-width: 100% !important;
  height: auto;
  display: block;
}

.table-wrap,
pre,
code,
table {
  max-width: 100%;
  overflow-x: auto;
}

#site-header {
  width: 100%;
  left: 0;
  right: 0;
  margin: 0;
  border-radius: 0;
}

nav[aria-label="Breadcrumb"] ol,
#toc,
#tag-list {
  overflow: hidden;
  flex-wrap: wrap;
}

@media (max-width: 767.98px) {
  .full-bleed[class*="-mx-"],
  .full-bleed[class*="-mr-"],
  .full-bleed[class*="-ml-"] {
    max-width: 100%;
  }
}