/* ===========================
   UniLab — Shared Blog Styles
   =========================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; }
img, svg, video { max-width: 100%; height: auto; }
pre { overflow: auto; }
a { color: inherit; }

:root{
  --bg: #0b1220;
  --surface: rgba(255,255,255,.06);
  --surface-2: rgba(255,255,255,.10);
  --border: rgba(255,255,255,.12);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.70);
  --shadow: 0 18px 40px rgba(0,0,0,.35);

  --accent: #5eead4;
  --accent-2: #60a5fa;

  --radius-xl: 22px;
  --radius-lg: 16px;

  --container: 1200px;

  /* Always wide reading width */
  --content-max: 86ch;

  --anchor-offset: 72px; /* for scroll-margin-top adjustments */

  --line: 1.65;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;

  --focus: 0 0 0 3px rgba(94,234,212,.35);
}

html[data-theme="light"]{
  --bg: #f7fafc;
  --surface: rgba(2,6,23,.05);
  --surface-2: rgba(2,6,23,.08);
  --border: rgba(2,6,23,.10);
  --text: rgba(2,6,23,.92);
  --muted: rgba(2,6,23,.72);
  --shadow: 0 18px 40px rgba(2,6,23,.12);
}

body{
  background: radial-gradient(900px 420px at 20% -10%, rgba(94,234,212,.25), transparent 55%),
              radial-gradient(800px 380px at 85% 0%, rgba(96,165,250,.22), transparent 50%),
              var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: var(--line);
  letter-spacing: .1px;
}

.sr-only{
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.skip-link{
  position: absolute;
  left: 12px; top: 12px;
  transform: translateY(-200%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 12px;
  border-radius: 10px;
  z-index: 9999;
  box-shadow: var(--shadow);
}
.skip-link:focus{ transform: translateY(0); outline: none; }

:focus-visible{
  outline: none;
  box-shadow: var(--focus);
  border-radius: 10px;
}

.container{
  width: min(var(--container), calc(100% - 2rem));
  margin-inline: auto;
}

/* Progress */
.progress{
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 1000;
  background: transparent;
}
.progress__bar{
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left center;
}

/* Header */
.site-header{
  position: sticky;
  top: 0;
  z-index: 900;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header__inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.brand{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: max-content;
}
.brand__text{ font-weight: 800; letter-spacing: .2px; }
.badge{
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.nav{
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.nav__link{
  text-decoration: none;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.nav__link:hover{
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.header__actions{
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Buttons */
.btn{
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(0,0,0,.08);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover{ transform: translateY(-1px); border-color: color-mix(in srgb, var(--border) 60%, var(--accent) 40%); }
.btn:active{ transform: translateY(0px); }
.btn--primary{
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 80%, white 20%), color-mix(in srgb, var(--accent-2) 80%, white 20%));
  color: #07131f;
  border-color: transparent;
}
.btn--ghost{
  background: transparent;
  box-shadow: none;
}
.btn__icon{ font-size: 14px; }
.btn__text{ font-weight: 650; font-size: 13px; }

/* Select (styled dropdown) */
.select{
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface-2) 40%, transparent 60%));
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 36px 8px 12px;
  border-radius: 12px;
  font-size: 0.95rem;
  cursor: pointer;
  min-width: 180px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(1em + 2px), calc(100% - 9px) calc(1em + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.select:focus{ box-shadow: var(--focus); outline: none; }


/* Hero */
.hero{ padding: 42px 0 18px; }
.hero__inner{
  display: grid;
  grid-template-columns: 1.35fr .85fr;
  gap: 24px;
  align-items: center;
}
.kicker{
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .18px;
  margin-bottom: 10px;
}
.hero__title{
  font-size: clamp(2rem, 3.5vw, 3.1rem);
  line-height: 1.08;
  margin: 0 0 12px;
  letter-spacing: -0.6px;
}
.hero__subtitle{
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 70ch;
}
.meta{
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}
.meta__item{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.dot{
  width: 8px; height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.tag-row{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 18px;
}
.tag{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}
.hero__cta{ display: flex; gap: 10px; flex-wrap: wrap; }

/* Hero card */
.hero__card .glass{
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 80%, transparent 20%), transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 14px;
}
.glass__top{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.pill{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(94,234,212,.2), rgba(96,165,250,.2));
  border: 1px solid color-mix(in srgb, var(--border) 70%, var(--accent) 30%);
}
.pill--muted{
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
}

.terminal{
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  background: color-mix(in srgb, var(--bg) 75%, black 25%);
}
.terminal__bar{
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent 30%);
}
.t-dot{
  width: 10px; height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
}
.terminal__title{
  margin-left: 8px;
  font-size: 12px;
  color: var(--muted);
}
.terminal__body{
  margin: 0;
  padding: 14px 14px 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: rgba(255,255,255,.92);
  line-height: 1.6;
}
.glass__foot{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.mini-stat{
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 12px;
}
.mini-stat__k{ display: block; font-size: 12px; color: var(--muted); }
.mini-stat__v{ display: block; font-weight: 800; letter-spacing: .15px; }

/* Layout */
.layout{
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 22px;
  padding: 18px 0 34px;
  align-items: start;
}
html[data-sidebar="closed"] .layout{
  grid-template-columns: 1fr;
}
html[data-sidebar="closed"] .sidebar{
  display: none;
}

/* Article */
.post{
  min-width: 0;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 75%, transparent 25%);
  box-shadow: var(--shadow);
  padding: 26px;
}

/* ===========================
   Unified content width (LEFT aligned)
   =========================== */

/* Lead */
.post__intro .lead{
  font-size: 1.12rem;
  color: var(--text);
  max-width: var(--content-max);
  margin-left: 0;
  margin-right: auto;
}

/* Top-level blocks align left */
.post > :is(h2, h3, p, ul, ol, pre.code),
.post section > :is(h2, h3, p, ul, ol, pre.code){
  max-width: var(--content-max);
  margin-left: 0;
  margin-right: auto;
}

/* Callouts and standalone cards align left */
.post section > .callout,
.post section > .card{
  max-width: var(--content-max);
  margin: 16px 0; /* left aligned */
}

/* Grids align left, with same width */
.grid-2,
.grid-3{
  max-width: var(--content-max);
  margin: 14px 0; /* left aligned */
}

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

/* Make inner blocks full-width inside cards/callouts */
.card pre.code,
.callout pre.code{
  max-width: none;
  margin-inline: 0;
}
.card .table-wrap,
.callout .table-wrap{
  max-width: none;
}

/* Headings + text */
html{
  scroll-padding-top: var(--anchor-offset); /* helps native hash scrolling */
}

.post h2, .post h3{
  scroll-margin-top: var(--anchor-offset);
}

.post h2{
  margin: 30px 0 12px;
  font-size: 1.65rem;
  letter-spacing: -0.2px;
}
.post h3{
  margin: 18px 0 10px;
  font-size: 1.2rem;
}
.post p{
  color: var(--muted);
  margin: 12px 0;
}
.post code{
  font-family: var(--mono);
  font-size: .92em;
  padding: .15em .4em;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: color-mix(in srgb, var(--text) 90%, var(--accent) 10%);
}
.post pre code{
  display: block;
  padding: 0;
  background: transparent;
  border: none;
  color: inherit;
}

.sep{
  border: none;
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* Cards */
.card{
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 14px;
}
.card--soft{
  background: color-mix(in srgb, var(--surface) 65%, transparent 35%);
}
.card__title{
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.muted{ color: var(--muted); }

/* Callouts */
.callout{
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 14px 14px 12px;
}
.callout__title{ font-weight: 850; margin-bottom: 6px; letter-spacing: .1px; }
.callout__body{ color: var(--muted); }
.callout--tip{
  border-color: color-mix(in srgb, var(--border) 55%, var(--accent) 45%);
  background: linear-gradient(135deg, rgba(94,234,212,.12), rgba(96,165,250,.08));
}
.callout--note{
  border-color: color-mix(in srgb, var(--border) 60%, rgba(96,165,250,.5) 40%);
  background: linear-gradient(135deg, rgba(96,165,250,.12), rgba(94,234,212,.06));
}
.callout--warning{
  border-color: color-mix(in srgb, var(--border) 60%, rgba(251,191,36,.65) 40%);
  background: linear-gradient(135deg, rgba(251,191,36,.10), rgba(251,113,133,.06));
}

/* Code blocks */
.code{
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, black 18%);
  padding: 14px 14px 16px;
  margin: 12px 0;
  max-width: var(--content-max);
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.code code{
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  color: rgba(255,255,255,.92);
}
.copy-btn{
  position: absolute;
  top: 10px;
  right: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent 30%);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.copy-btn:hover{
  border-color: color-mix(in srgb, var(--border) 60%, var(--accent) 40%);
}

/* Tables */
.table-wrap{
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.table{
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  background: color-mix(in srgb, var(--surface) 60%, transparent 40%);
}
.table th, .table td{
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  color: var(--muted);
}
.table th{
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent 30%);
}

/* Checklist */
.checklist{
  list-style: none;
  padding-left: 0;
  margin: 10px 0 0;
}
.checklist li{
  position: relative;
  padding-left: 28px;
  margin: 10px 0;
  color: var(--muted);
}
.checklist li::before{
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  width: 20px; height: 20px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(94,234,212,.25), rgba(96,165,250,.18));
  border: 1px solid color-mix(in srgb, var(--border) 60%, var(--accent) 40%);
  color: var(--text);
  font-weight: 900;
}

/* Post footer */
.post__footer{
  margin-top: 18px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  max-width: var(--content-max);
  margin-left: 0;
  margin-right: auto;
}
.author{ display: flex; gap: 12px; align-items: center; }
.avatar{
  width: 42px; height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: linear-gradient(135deg, rgba(94,234,212,.28), rgba(96,165,250,.22));
  border: 1px solid color-mix(in srgb, var(--border) 60%, var(--accent) 40%);
}
.author__name{ font-weight: 900; }
.author__bio{ font-size: .95rem; }
.share{ display: flex; gap: 10px; flex-wrap: wrap; }

/* Writer box */
.sidebar__box--writer{
  padding: 16px;
}

.writer{
  display: flex;
  gap: 12px;
  align-items: center;
}

.writer__avatar{
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: linear-gradient(135deg, rgba(94,234,212,.28), rgba(96,165,250,.22));
  border: 1px solid color-mix(in srgb, var(--border) 60%, var(--accent) 40%);
}

.writer__meta{
  display: grid;
  gap: 4px;
}

.writer__name{
  font-weight: 900;
  letter-spacing: .1px;
}

.writer__email{
  color: var(--muted);
  text-decoration: none;
  border-radius: 10px;
  padding: 2px 0;
  width: fit-content;
}

.writer__email:hover{
  color: var(--text);
  text-decoration: underline;
}

.writer__date{
  font-size: .92rem;
}


/* Sidebar */
.sidebar{
  position: sticky;
  top: 86px;
  display: grid;
  gap: 14px;
  align-self: start;
}
.sidebar__box{
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent 30%);
  box-shadow: var(--shadow);
  padding: 14px;
}
.sidebar__box--newsletter{ padding: 16px; }
.sidebar__title{
  font-weight: 900;
  margin-bottom: 10px;
  letter-spacing: .1px;
}

/* TOC scroll container */
.sidebar__box--toc{
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 110px);
}
.sidebar__box--toc .toc{
  overflow: auto;
  padding-right: 6px;
  scroll-behavior: smooth;
}

/* TOC */
.toc{
  display: grid;
  gap: 6px;
}
.toc a{
  display: block;            /* one block highlight even when wrapped */
  text-decoration: none;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}
.toc a:hover{
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}
.toc a.is-active{
  color: var(--text);
  background: linear-gradient(135deg, rgba(94,234,212,.14), rgba(96,165,250,.10));
  border-color: color-mix(in srgb, var(--border) 60%, var(--accent) 40%);
}
.toc .toc__item--h3 a{ padding-left: 18px; font-size: 13px; }

/* Newsletter */
.newsletter{
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.input{
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 12px;
  color: var(--text);
  outline: none;
}
.hint{ min-height: 18px; }

/* Footer */
.site-footer{
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 86%, transparent 14%);
}
.footer__inner{
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0;
  align-items: center;
}
.footer__links{ display: flex; gap: 12px; }
.footer__links a{
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 12px;
}
.footer__links a:hover{
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}

/* Floating button */
.fab{
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 82%, transparent 18%);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
}
.fab.is-visible{ opacity: 1; transform: translateY(0); }

/* Responsive */
@media (max-width: 980px){
  .hero__inner{ grid-template-columns: 1fr; }
  .layout{ grid-template-columns: 1fr; }
  .sidebar{ position: static; }
  .nav{ display: none; }
  .sidebar__box--toc{ max-height: none; }
  .sidebar__box--toc .toc{ overflow: visible; }
}

@media (max-width: 640px){
  .post{ padding: 18px; }
  .grid-2{ grid-template-columns: 1fr; }
  .grid-3{ grid-template-columns: 1fr; }
  .meta__item{ width: 100%; justify-content: flex-start; }
  .table{ min-width: 520px; }
}

/* ===========================
   Quiz
   =========================== */

.quiz-section{
  margin-top: 10px;
}

.quiz{
  display: grid;
  gap: 14px;
  margin-top: 12px;
  max-width: var(--content-max);
}

.quiz__q{
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 14px;
}

.quiz__q legend{
  font-weight: 900;
  letter-spacing: .1px;
  color: var(--text);
  margin-bottom: 10px;
}

.quiz__opt{
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  color: var(--muted);
  width: 100%;
}

.quiz__opt:hover{
  background: color-mix(in srgb, var(--surface-2) 55%, transparent 45%);
  border-color: var(--border);
  color: var(--text);
}

.quiz__opt input{
  margin-top: 2px;
  flex: 0 0 auto;
  accent-color: color-mix(in srgb, var(--accent) 70%, var(--accent-2) 30%);
}

.quiz__feedback{
  margin-top: 8px;
  font-size: .95rem;
  color: var(--muted);
  min-height: 1.2em;
}

.quiz__q.is-correct{
  border-color: color-mix(in srgb, var(--border) 35%, var(--accent) 65%);
  background: linear-gradient(135deg, rgba(94,234,212,.10), rgba(96,165,250,.06));
}

.quiz__q.is-wrong{
  border-color: color-mix(in srgb, var(--border) 40%, rgba(251,113,133,.85) 60%);
  background: linear-gradient(135deg, rgba(251,113,133,.10), rgba(251,191,36,.06));
}

.quiz__q.is-missing{
  border-color: color-mix(in srgb, var(--border) 45%, rgba(251,191,36,.85) 55%);
}

.quiz__actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 2px;
  margin-bottom: 15px;
}

.quiz__score{
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent 30%);
}
