/* SCU AI · scuai.cn
   World: the commutative diagram of learn.scuai.cn, extended to three course entrances.
   Hand-edited, no build step. */

:root {
  --paper: #f5f6f8;
  --paper-2: #eceef2;
  --ink: #15171e;
  --ink-2: #474c59;
  --rule: #c9cdd6;

  --alg: #2b3fd6;
  --infra: #0a7a6c;
  --api: #f0a818;
  --agent: #d93a22;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
  --math: "Latin Modern Roman", "STIX Two Text", "Cambria", "Times New Roman", "Songti SC", serif;

  --wrap: 1180px;
  --gutter: clamp(20px, 4vw, 48px);
  --shaft: 2px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.8; letter-spacing: 0.01em;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--alg); outline-offset: 3px; }
h1, h2, h3 { line-height: 1.3; text-wrap: balance; margin: 0; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.nb { white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 6px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- Header ---------- */
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 24px;
  min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; text-decoration: none; letter-spacing: 0; white-space: nowrap; }
.brand .mark { width: 28px; height: 28px; flex: none; }
.site-nav ul { display: flex; align-items: center; gap: 8px clamp(16px, 2.4vw, 32px); list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.site-nav a { text-decoration: none; font-size: 15px; padding: 6px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { border-bottom-color: currentColor; }
.site-nav a.signin { background: var(--ink); color: #fff; padding: 6px 16px; border: 0; }
.site-nav a.signin:hover { background: var(--alg); }

/* ---------- Thesis ---------- */
.thesis { padding-top: clamp(36px, 6vw, 72px); }
.thesis h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.thesis .sub { margin-top: 10px; font-size: clamp(1.25rem, 2.2vw, 1.75rem); font-weight: 700; }
.thesis .lede { margin-top: 14px; font-size: clamp(1rem, 1.4vw, 1.15rem); color: var(--ink-2); max-width: 36em; }

/* ---------- Diagram: Learn →练→ IaCDeck →交→ 课程门户 ---------- */
.cd {
  margin-top: clamp(28px, 4vw, 48px);
  display: grid; grid-template-columns: 1fr;
  grid-template-areas: "learn" "f" "deck" "g" "portal";
  position: relative; padding-left: 52px;
}
.obj {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  min-height: 172px; padding: clamp(18px, 2.2vw, 28px);
  text-decoration: none; color: #fff;
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}
.obj:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -18px rgba(21, 23, 30, 0.55); }
.obj h2 { font-size: clamp(1.45rem, 2.5vw, 2.25rem); font-weight: 800; letter-spacing: -0.01em; }
.obj-learn h2 { padding-right: 2.4em; }
.obj p { margin: 8px 0 0; font-size: 15px; line-height: 1.6; max-width: 22em; }
.obj .go { font-size: 14px; font-weight: 600; display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; }
.obj .go > span:first-child::after { content: "→"; display: inline-block; margin-left: 6px; transition: transform 0.4s var(--ease-out); }
.obj:hover .go > span:first-child::after { transform: translateX(4px); }
.tag { font-weight: 500; font-size: 12px; padding: 0 8px; border: 1px solid currentColor; line-height: 1.7; }

.obj-learn { grid-area: learn; background: #fff; color: var(--ink); border: 1px solid var(--ink); }
.obj-deck { grid-area: deck; background: var(--infra); }
.obj-portal { grid-area: portal; background: var(--ink); }

/* Learn carries the four topic colours as a quadrant, echoing its own diagram */
.quad {
  position: absolute; top: clamp(14px, 1.8vw, 22px); right: clamp(16px, 2vw, 26px);
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 44px; height: 44px;
}
.quad i:nth-child(1) { background: var(--alg); }
.quad i:nth-child(2) { background: var(--infra); }
.quad i:nth-child(3) { background: var(--agent); }
.quad i:nth-child(4) { background: var(--api); }

.arr { position: relative; min-height: 84px; display: flex; align-items: center; color: var(--ink); transition: color 0.3s var(--ease-out); }
.arr-f { grid-area: f; } .arr-g { grid-area: g; }
.shaft { position: absolute; left: 28px; top: 10px; bottom: 10px; width: var(--shaft); background: currentColor; }
.shaft::after {
  content: ""; position: absolute; left: 50%; bottom: -2px; width: 14px; height: 12px;
  transform: translateX(-50%); background: currentColor; clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.lbl { margin-left: 52px; font-size: 17px; font-weight: 700; line-height: 1.5; padding: 2px 0; }
.lbl small { display: block; color: var(--ink-2); font-size: 13px; font-weight: 400; }

/* Composite course = 交 ∘ 练, dashed */
.arr-course { position: absolute; left: 0; top: 0; bottom: 0; width: 44px; min-height: 0; }
.arr-course .shaft { left: 14px; top: 40px; bottom: 40px; width: 0; background: none; border-left: var(--shaft) dashed currentColor; }
.arr-course .shaft::after { left: -1px; bottom: -4px; transform: translateX(-50%); }
.arr-course .lbl {
  position: absolute; top: 50%; left: 24px; margin: 0; background: var(--paper);
  writing-mode: vertical-rl; transform: translateY(-50%);
  font-family: var(--math); font-weight: 400; white-space: nowrap; padding: 8px 0;
}

@media (prefers-reduced-motion: no-preference) {
  .cd .shaft { animation: draw-v 0.7s var(--ease-out) both; }
  .cd .arr-f .shaft { animation-delay: 0.15s; }
  .cd .arr-g .shaft { animation-delay: 0.6s; }
  .cd .arr-course .shaft { animation-delay: 1.15s; animation-duration: 1s; }
}
@keyframes draw-v { from { clip-path: inset(-20px -20px 100% -20px); } to { clip-path: inset(-20px); } }
@keyframes draw-h { from { clip-path: inset(-20px 100% -20px -20px); } to { clip-path: inset(-20px); } }

.cd:has(.obj-deck:hover) .arr-f,
.cd:has(.obj-portal:hover) :is(.arr-f, .arr-g, .arr-course) { color: var(--alg); }

@media (min-width: 880px) {
  .cd {
    padding-left: 0; padding-bottom: 76px;
    grid-template-columns: minmax(0, 1fr) clamp(96px, 11vw, 160px) minmax(0, 1fr) clamp(96px, 11vw, 160px) minmax(0, 1fr);
    grid-template-areas: "learn f deck g portal";
  }
  .obj { min-height: clamp(230px, 22vw, 280px); }
  .arr { min-height: 0; justify-content: center; }
  .arr-f .shaft, .arr-g .shaft { left: 12px; right: 12px; top: 50%; bottom: auto; width: auto; height: var(--shaft); }
  .arr-f .shaft::after, .arr-g .shaft::after {
    left: auto; right: -2px; bottom: auto; top: 50%; width: 12px; height: 14px;
    transform: translateY(-50%); clip-path: polygon(0 0, 100% 50%, 0 100%);
  }
  .arr-f .lbl, .arr-g .lbl {
    margin: 0; position: absolute; left: 50%; bottom: calc(50% + 10px); transform: translateX(-50%);
    text-align: center; width: 100%; padding: 0 6px;
  }
  .arr-f .lbl small, .arr-g .lbl small { margin-top: 2px; }

  /* Composite runs under all three objects: down from Learn, across, up into the portal */
  .arr-course { left: calc((100% - 2 * clamp(96px, 11vw, 160px)) / 6); right: calc((100% - 2 * clamp(96px, 11vw, 160px)) / 6); top: auto; bottom: 0; width: auto; height: 76px; }
  .arr-course .shaft {
    left: 0; right: 0; top: 0; bottom: 30px; width: auto; height: auto;
    border: var(--shaft) dashed currentColor; border-top: 0;
  }
  .arr-course .shaft::after {
    left: auto; right: -8px; bottom: auto; top: -4px; width: 14px; height: 12px;
    transform: none; clip-path: polygon(50% 0, 100% 100%, 0 100%);
  }
  .arr-course .lbl {
    writing-mode: horizontal-tb; top: auto; bottom: 14px; left: 50%; transform: translateX(-50%);
    padding: 0 14px; font-size: 18px;
  }
  @media (prefers-reduced-motion: no-preference) {
    .cd .arr-f .shaft, .cd .arr-g .shaft { animation-name: draw-h; }
    .cd .arr-course .shaft { animation-name: draw-h; }
  }
}

/* ---------- Sections ---------- */
.section { margin-top: clamp(72px, 10vw, 128px); }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px 24px; flex-wrap: wrap;
  border-top: 2px solid var(--ink); padding-top: 18px;
}
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 800; letter-spacing: -0.01em; }
.section-head .more { font-size: 15px; font-weight: 600; white-space: nowrap; }
.section-head .more::after { content: " ↗"; }
.intro { margin-top: 14px; color: var(--ink-2); max-width: 40em; }

.topics { list-style: none; margin: 28px 0 0; padding: 0; border-top: 1px solid var(--rule); }
.topics li { border-bottom: 1px solid var(--rule); }
.topics a {
  display: grid; grid-template-columns: 76px 1fr; grid-template-areas: "chip t" "chip d";
  column-gap: 20px; align-items: center; padding: 16px 0; text-decoration: none;
  transition: background-color 0.3s var(--ease-out);
}
.topics a:hover { background: var(--paper-2); }
.topics a:hover .t { text-decoration: underline; text-decoration-thickness: 2px; }
.chip { grid-area: chip; font-family: var(--math); font-weight: 700; letter-spacing: 0; color: #fff; text-align: center; padding: 4px 0; font-size: 18px; line-height: 1.4; }
.c-alg { background: var(--alg); } .c-infra { background: var(--infra); }
.c-api { background: var(--api); color: var(--ink); } .c-agent { background: var(--agent); }
.topics .t { grid-area: t; font-weight: 700; font-size: 18px; line-height: 1.5; }
.topics .d { grid-area: d; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
@media (min-width: 880px) {
  .topics a { grid-template-columns: 96px minmax(0, 18em) 1fr; grid-template-areas: "chip t d"; padding: 18px 12px 18px 0; }
}

.book {
  margin-top: 32px; display: flex; align-items: stretch; gap: 20px; text-decoration: none;
  border: 1px solid var(--ink); background: #fff; padding: 20px 24px 20px 20px;
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}
.book:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -20px rgba(21, 23, 30, 0.55); }
.book .spine { flex: none; width: 14px; background: var(--infra); }
.book .bt { display: flex; flex-direction: column; flex: 1; line-height: 1.5; }
.book .k { font-size: 13px; color: var(--ink-2); }
.book strong { font-size: clamp(1.25rem, 2.2vw, 1.6rem); font-weight: 800; margin: 2px 0 4px; }
.book .bt > span:last-child { font-size: 15px; color: var(--ink-2); }
.book .arrow { align-self: center; font-size: 24px; transition: transform 0.4s var(--ease-out); }
.book:hover .arrow { transform: translateX(4px); }

.split { display: grid; gap: 32px; margin-top: 28px; }
.facts { margin: 0; border-top: 1px solid var(--rule); }
.facts > div { display: grid; grid-template-columns: 7.5em 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; color: var(--ink-2); }
.signin-box { background: var(--ink); color: #fff; padding: 28px; align-self: start; }
.signin-box p { margin: 0; }
.signin-box .btn {
  display: inline-block; margin: 18px 0; background: #fff; color: var(--ink); font-weight: 700;
  padding: 10px 22px; text-decoration: none; transition: background-color 0.3s var(--ease-out), color 0.3s var(--ease-out);
}
.signin-box .btn:hover { background: var(--api); }
.signin-box .btn:focus-visible { outline-color: var(--api); }
.signin-box .hint { font-size: 14px; color: #b9bdc8; }
@media (min-width: 880px) { .split { grid-template-columns: minmax(0, 1fr) 340px; gap: 56px; } }
@media (max-width: 420px) { .facts > div { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Footer ---------- */
.site-foot { margin-top: clamp(64px, 10vw, 128px); border-top: 1px solid var(--ink); font-size: 14px; color: var(--ink-2); }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; padding-top: 28px; padding-bottom: 40px; }
.site-foot p { margin: 0; }
.site-foot .eq { font-family: var(--math); font-size: 16px; color: var(--ink); }
