/* ============ Tutorial hub & article pages ============ */
/* Relies on style.css :root tokens (bg / coral / mauve / text / border / radius) */

/* ---- Hero ---- */
.tut-hero {
  padding: 130px 24px 44px;
  background:
    radial-gradient(ellipse at 50% 60%, rgba(212, 136, 106, 0.06) 0%, transparent 65%),
    linear-gradient(to bottom, var(--bg) 0%, var(--bg-deep) 100%);
}
.tut-hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}
.tut-hero.centered { text-align: center; }
.tut-crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-soft);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tut-hero.centered .tut-crumbs { justify-content: center; }
.tut-crumbs a { color: var(--text-soft); transition: color var(--t); }
.tut-crumbs a:hover { color: var(--coral); }
.tut-crumbs i { font-size: 0.8rem; opacity: 0.6; }
.tut-hero-title {
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--mauve);
  margin-bottom: 10px;
  line-height: 1.35;
}
.tut-hero-sub {
  color: var(--text-soft);
  font-size: 1.02rem;
  max-width: 640px;
}
.tut-hero.centered .tut-hero-sub { margin: 0 auto; }
.tut-hero-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  font-size: 0.88rem;
  color: var(--text-soft);
  flex-wrap: wrap;
}
.tut-hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.tut-hero-meta i { color: var(--coral); font-size: 1rem; }

/* ---- Two-column layout: sticky TOC + article ---- */
.tut-layout {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px 24px 72px;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.tut-toc {
  position: sticky;
  top: 88px;
}
.tut-toc-box {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 0;
}
.tut-toc-box summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--mauve);
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.tut-toc-box summary::-webkit-details-marker { display: none; }
.tut-toc-box summary i { color: var(--coral); }
.tut-toc-caret { margin-left: auto; transition: transform 0.3s ease; }
.tut-toc-box[open] .tut-toc-caret { transform: rotate(180deg); }
.tut-toc-list {
  list-style: none;
  padding: 0 10px 10px;
  margin: 0;
}
.tut-toc-list a {
  display: block;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.5;
  border: 1px solid transparent;
  transition: color var(--t), background var(--t), border-color var(--t);
}
.tut-toc-list a:hover { color: var(--coral); }
.tut-toc-list a.active {
  color: var(--coral);
  background: var(--coral-soft);
  border-color: rgba(212, 136, 106, 0.25);
  font-weight: 500;
}

/* ---- Article body typography ---- */
.tut-body { min-width: 0; }
.tut-body section { margin-bottom: 52px; }
.tut-body section:last-of-type { margin-bottom: 0; }
.tut-body h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--mauve);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 84px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tut-body h2 i { color: var(--coral); font-size: 1.3rem; }
.tut-body h3 {
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--mauve);
  margin: 26px 0 10px;
  scroll-margin-top: 84px;
}
.tut-body p {
  color: var(--text-soft);
  font-size: 0.97rem;
  line-height: 1.85;
  margin-bottom: 12px;
}
.tut-body ul, .tut-body ol {
  color: var(--text-soft);
  font-size: 0.97rem;
  line-height: 1.85;
  padding-left: 22px;
  margin: 10px 0 14px;
}
.tut-body li { margin-bottom: 6px; }
.tut-body strong { color: var(--text); }
.tut-body a {
  color: var(--coral);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tut-body a:hover { color: var(--coral-dark); }
.tut-body code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88rem;
  font-family: "Cascadia Code", "Consolas", monospace;
}
.tut-body kbd {
  display: inline-block;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

/* ---- Tables (error code reference etc.) ---- */
.tut-table-wrap { overflow-x: auto; margin: 14px 0; }
.tut-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.tut-body th, .tut-body td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  line-height: 1.6;
}
.tut-body th {
  color: var(--mauve);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.25);
}
.tut-body tr:last-child td { border-bottom: none; }

/* ---- Numbered steps ---- */
.tut-steps {
  list-style: none;
  padding: 0;
  margin: 18px 0;
  counter-reset: tut-step;
}
.tut-steps > li {
  position: relative;
  padding: 0 0 26px 56px;
  counter-increment: tut-step;
}
.tut-steps > li:last-child { padding-bottom: 0; }
.tut-steps > li::before {
  content: counter(tut-step);
  position: absolute;
  left: 0;
  top: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tut-steps > li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 18px;
  top: 44px;
  bottom: 6px;
  width: 2px;
  background: rgba(212, 136, 106, 0.2);
}
.tut-step-title {
  font-weight: 600;
  color: var(--mauve);
  font-size: 1rem;
  line-height: 38px;
  margin-bottom: 4px;
}

/* ---- Optional figure (tutorials are text-first; kept for rare illustrations) ---- */
.tut-shot { margin: 18px 0 22px; }
.tut-shot img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
}
.tut-shot figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-soft);
  text-align: center;
  opacity: 0.85;
}

/* ---- Callouts: full-border highlight, no side bars ---- */
.tut-note, .tut-warn {
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 0.93rem;
  line-height: 1.75;
  color: var(--text-soft);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.tut-note {
  border: 1px solid rgba(212, 136, 106, 0.35);
  background: var(--coral-soft);
}
.tut-warn {
  border: 1px solid rgba(168, 124, 76, 0.45);
  background: rgba(168, 124, 76, 0.1);
}
.tut-note > i, .tut-warn > i {
  font-size: 1.15rem;
  flex-shrink: 0;
  margin-top: 3px;
}
.tut-note > i { color: var(--coral); }
.tut-warn > i { color: #a87c4c; }
.tut-note p, .tut-warn p { margin: 0; font-size: inherit; }
.tut-note p + p, .tut-warn p + p { margin-top: 6px; }

/* ---- Prev / next pager ---- */
.tut-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 56px;
}
.tut-pager a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--t), box-shadow var(--t);
  text-decoration: none;
}
.tut-pager a:hover {
  border-color: rgba(212, 136, 106, 0.4);
  box-shadow: var(--shadow-hover);
}
.tut-pager .pager-label {
  font-size: 0.8rem;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tut-pager .pager-title {
  font-weight: 600;
  color: var(--mauve);
  font-size: 0.95rem;
}
.tut-pager a.pager-next { text-align: right; }
.tut-pager a.pager-next .pager-label { justify-content: flex-end; }
.tut-pager a.pager-empty { visibility: hidden; }

/* ---- Hub: category sections & tutorial cards ---- */
.tut-cat { padding: 44px 0; }
.tut-cat .container { max-width: var(--max-w); }
.tut-cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.tut-cat-head i { font-size: 1.5rem; color: var(--coral); }
.tut-cat-head h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--mauve);
}
.tut-cat-sub {
  color: var(--text-soft);
  font-size: 0.95rem;
  margin-bottom: 24px;
}
.tut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}
.tut-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  text-decoration: none;
}
a.tut-card:hover {
  border-color: rgba(212, 136, 106, 0.4);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.tut-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--coral-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--coral);
}
.tut-card h3 {
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--mauve);
  line-height: 1.5;
}
.tut-card p {
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.7;
  flex-grow: 1;
}
.tut-card-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--text-soft);
}
.tut-card-meta span { display: inline-flex; align-items: center; gap: 5px; }
.tut-card-meta i { font-size: 0.95rem; color: var(--coral); }
.tut-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: var(--coral);
  padding: 3px 10px;
  border-radius: 20px;
}
/* Not-yet-written entries: visible but inert */
.tut-card.coming {
  opacity: 0.62;
  pointer-events: none;
}
.tut-card.coming .tut-badge {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-soft);
}
.tut-cat-alt {
  background: linear-gradient(to bottom, var(--bg-deep), var(--bg-deep) 70%, var(--bg));
}

/* ---- Cross-link card to FAQ ---- */
.tut-crosslink {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px 72px;
}
.tut-crosslink-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 28px;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tut-crosslink-card > i {
  font-size: 1.8rem;
  color: var(--coral);
  flex-shrink: 0;
}
.tut-crosslink-card h3 {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--mauve);
  margin-bottom: 2px;
}
.tut-crosslink-card p {
  color: var(--text-soft);
  font-size: 0.9rem;
}
.tut-crosslink-card .btn { margin-left: auto; flex-shrink: 0; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .tut-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 32px 20px 56px;
  }
  .tut-toc { position: static; }
}
@media (max-width: 768px) {
  .tut-hero { padding: 100px 20px 36px; }
  .tut-hero-title { font-size: 1.6rem; }
  .tut-body h2 { font-size: 1.25rem; }
  .tut-pager { grid-template-columns: 1fr; }
  .tut-pager a.pager-empty { display: none; }
  .tut-crosslink-card { flex-direction: column; text-align: center; }
  .tut-crosslink-card .btn { margin-left: 0; }
  .tut-cat { padding: 36px 0; }
}
@media (max-width: 480px) {
  .tut-hero-title { font-size: 1.35rem; }
  .tut-steps > li { padding-left: 48px; }
  .tut-steps > li::before { width: 32px; height: 32px; font-size: 0.85rem; }
  .tut-steps > li:not(:last-child)::after { left: 15px; top: 38px; }
  .tut-step-title { line-height: 32px; }
}
