:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f0f6f4;
  --ink: #102033;
  --muted: #607086;
  --line: #d8e1eb;
  --line-strong: #b9c7d6;
  --blue: #2357d6;
  --blue-dark: #173b8f;
  --green: #0f8a6a;
  --green-soft: #def4ed;
  --amber: #9a6b00;
  --amber-soft: #fff4d8;
  --danger: #b42318;
  --danger-soft: #fee9e7;
  --shadow: 0 14px 32px rgba(20, 39, 63, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
  sans-serif;
  letter-spacing: 0;
}

body.tutorial-modal-open {
  overflow: hidden;
}

a {
  color: inherit;
}

.tutorial-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.tutorial-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1240px, calc(100% - 40px));
  min-height: 62px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-link,
.brand-text {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 76px;
  height: auto;
  flex: 0 0 auto;
}

.brand-logo-uoa {
  width: 90px;
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--line);
}

.brand-text {
  min-width: 0;
  font-size: 0.96rem;
  font-weight: 760;
  line-height: 1.2;
}

.brand-link:hover,
.brand-link:focus-visible,
.brand-text:hover,
.brand-text:focus-visible {
  outline: none;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 680;
  text-decoration: none;
}

.top-nav a:hover,
.top-nav a:focus-visible,
.top-nav a[aria-current="page"] {
  background: #eef2f7;
  color: var(--ink);
  outline: none;
}

.tutorial-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 34px;
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 54px;
}

.sidebar {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(20, 39, 63, 0.05);
}

.sidebar-title {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 820;
  text-transform: uppercase;
}

.sidebar nav {
  display: grid;
  gap: 4px;
}

.sidebar a {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 10px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 660;
  line-height: 1.28;
  text-decoration: none;
}

.sidebar a:hover,
.sidebar a:focus-visible,
.sidebar a[aria-current="page"] {
  background: var(--surface-soft);
  color: var(--ink);
  outline: none;
}

.chapter-index {
  color: var(--green);
  font-weight: 820;
}

.article {
  min-width: 0;
}

.article-inner {
  max-width: 900px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 820;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 2rem;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin: 36px 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 1.36rem;
  line-height: 1.25;
}

h3 {
  margin: 26px 0 10px;
  font-size: 1.05rem;
  line-height: 1.28;
}

p,
li {
  color: #435166;
  font-size: 1rem;
  line-height: 1.62;
}

ol,
ul {
  padding-left: 1.3rem;
}

li + li {
  margin-top: 5px;
}

code {
  padding: 0.08rem 0.28rem;
  border-radius: 5px;
  background: #edf2f7;
  color: var(--ink);
  font-size: 0.92em;
}

.chapter-lead {
  max-width: 760px;
  margin-bottom: 22px;
  color: #44546a;
  font-size: 1.04rem;
}

.chapter-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 24px;
}

.chapter-nav.bottom {
  margin: 38px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  max-width: 48%;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 760;
  line-height: 1.2;
  text-decoration: none;
}

.nav-button:hover,
.nav-button:focus-visible {
  border-color: var(--green);
  background: var(--green-soft);
  outline: none;
}

.nav-button.disabled {
  color: #9aa7b6;
  pointer-events: none;
}

.callout {
  margin: 18px 0 24px;
  padding: 14px 16px 14px 18px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(20, 39, 63, 0.04);
}

.callout p {
  margin: 0;
  color: #37465a;
  font-size: 0.96rem;
  line-height: 1.55;
}

.callout strong {
  color: var(--ink);
}

.callout a {
  color: var(--blue-dark);
  font-weight: 720;
}

.callout a:hover,
.callout a:focus-visible {
  color: var(--green);
  outline: none;
}

.callout-info {
  border-color: #b9d9d0;
  border-left-color: var(--green);
  background: linear-gradient(90deg, #f2fbf7 0%, #ffffff 72%);
}

.callout-warning {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.callout-danger {
  border-color: #f1b7b2;
  border-left-color: var(--danger);
  background: linear-gradient(90deg, #fff3f2 0%, #ffffff 72%);
}

.steps {
  margin: 14px 0 24px;
  padding-left: 1.3rem;
}

.steps li {
  padding-left: 0.1rem;
}

.tutorial-image {
  margin: 14px 0 24px;
}

.tutorial-image--compact {
  max-width: 560px;
}

.tutorial-image--narrow {
  max-width: 430px;
}

.tutorial-image--wide {
  max-width: 100%;
}

.image-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  margin: 14px 0 24px;
}

.image-pair .tutorial-image {
  margin: 0;
}

.tutorial-shot {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #ffffff;
  cursor: zoom-in;
}

.button-list {
  margin: 12px 0 22px;
  padding-left: 1.3rem;
}

.button-list li {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.icon-guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 24px;
}

.icon-guide__item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.icon-guide__item iconify-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--green);
  font-size: 1.35rem;
}

.icon-guide__item div {
  min-width: 0;
  color: #435166;
  font-size: 0.95rem;
  line-height: 1.45;
}

.icon-guide__item strong {
  color: var(--ink);
}

.tutorial-note {
  margin: 10px 0 18px;
}

.tutorial-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}

.tutorial-lightbox.is-open {
  display: block;
}

.tutorial-lightbox__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(16, 32, 51, 0.72);
  cursor: zoom-out;
}

.tutorial-lightbox__panel {
  position: absolute;
  inset: 28px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(16, 32, 51, 0.28);
}

.tutorial-lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 8px 12px 8px 16px;
  border-bottom: 1px solid var(--line);
}

.tutorial-lightbox__title {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 720;
}

.tutorial-lightbox__controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tutorial-lightbox__control {
  min-width: 38px;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 760;
  cursor: pointer;
}

.tutorial-lightbox__control:hover,
.tutorial-lightbox__control:focus-visible {
  border-color: var(--green);
  background: var(--green-soft);
  outline: none;
}

.tutorial-lightbox__viewport {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: #f3f6f9;
}

.tutorial-lightbox__image {
  display: block;
  max-width: none;
  height: auto;
  margin: 0 auto;
  cursor: zoom-in;
}

.tutorial-progress {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  height: 4px;
  background: rgba(16, 32, 51, 0.12);
}

.tutorial-progress__bar {
  width: 0%;
  height: 100%;
  background: var(--green);
  transition: width 80ms linear;
}

@media (max-width: 940px) {
  .tutorial-shell {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .article-inner {
    max-width: none;
  }

  .icon-guide,
  .image-pair {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .tutorial-header__inner,
  .tutorial-shell {
    width: min(100% - 28px, 1240px);
  }

  .tutorial-header__inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 10px 0;
  }

  .brand {
    gap: 8px;
  }

  .brand-logo {
    width: 58px;
  }

  .brand-logo-uoa {
    width: 70px;
  }

  .brand-divider {
    display: none;
  }

  .brand-text {
    font-size: 0.86rem;
  }

  .top-nav {
    justify-content: flex-start;
  }

  h1 {
    font-size: 1.72rem;
  }

  h2 {
    font-size: 1.28rem;
  }

  .sidebar nav {
    grid-template-columns: 1fr;
  }

  .chapter-nav {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-button {
    max-width: none;
  }

  .tutorial-lightbox__panel {
    inset: 10px;
  }

  .tutorial-lightbox__bar {
    align-items: flex-start;
    flex-direction: column;
  }
}
