/* ==========================================================================
   Linux 复习讲义（linux-notes）· 2026-09-12
   依据《尚硅谷嵌入式技术之 Linux 应用层开发》整理，与 Linux 练习面板同风格。
   ========================================================================== */

.learning-dashboard__inner[data-workspace] > #linux-notes-root {
  display: none;
  width: 100%;
  min-width: 0;
  margin: 0;
  scroll-margin-top: 5rem;
}
.learning-dashboard__inner[data-notes-active="true"] > #linux-notes-root {
  display: block;
  animation: learning-panel-in 360ms ease both;
}
.learning-dashboard__inner[data-notes-active="true"] > #learning-today,
.learning-dashboard__inner[data-notes-active="true"] > #learning-week,
.learning-dashboard__inner[data-notes-active="true"] > #learning-budget,
.learning-dashboard__inner[data-notes-active="true"] > #learning-roadmap,
.learning-dashboard__inner[data-notes-active="true"] > #learning-library,
.learning-dashboard__inner[data-notes-active="true"] > #learning-notes,
.learning-dashboard__inner[data-notes-active="true"] > #learning-memory,
.learning-dashboard__inner[data-notes-active="true"] > #learning-practice {
  display: none !important;
}
.learning-dashboard__inner[data-practice-active="true"] > #linux-notes-root {
  display: none;
}
.learning-deck-nav:has(#learning-deck-linux-notes) {
  grid-template-columns: repeat(9, minmax(0, 1fr));
}

.linux-notes {
  position: relative;
  width: 100%;
  margin-top: clamp(1rem, 3vw, 2rem);
  overflow: hidden;
  border: 1px solid rgb(87 101 75 / 20%);
  border-radius: 1.35rem;
  color: #4d5148;
  background:
    linear-gradient(90deg, rgb(113 137 99 / 4%) 1px, transparent 1px),
    linear-gradient(rgb(113 137 99 / 4%) 1px, transparent 1px),
    radial-gradient(circle at 82% 4%, rgb(176 207 218 / 34%), transparent 25rem),
    rgb(255 253 246 / 72%);
  background-size: 2rem 2rem, 2rem 2rem, auto, auto;
  box-shadow: 0 .9rem 2.1rem rgb(78 65 48 / 10%);
}
.linux-notes::before {
  position: absolute; inset: 0 0 auto; height: 2px; content: "";
  background: linear-gradient(90deg, #829b75, #a8bea0 58%, transparent);
}
.linux-notes button, .linux-notes input { font: inherit; }
.linux-notes button:focus-visible, .linux-notes input:focus-visible {
  outline: 3px solid #a8bea0; outline-offset: 3px;
}

/* ── 头部 ── */
.linux-notes__heading {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem;
  align-items: end; padding: clamp(1.2rem, 3vw, 2rem);
  border-bottom: 1px solid rgb(87 101 75 / 14%);
  background: linear-gradient(135deg, rgb(236 244 229 / 82%), rgb(255 253 246 / 34%));
}
.linux-notes__eyebrow {
  margin: 0; color: #718969; font-family: var(--font-mono); font-size: .72rem;
  font-weight: 700; letter-spacing: .18em;
}
.linux-notes__heading h2 {
  margin: .4rem 0 0; color: #403a33; font-family: var(--font-serif);
  font-size: clamp(1.65rem, 3vw, 2.35rem); font-weight: 600;
}
.linux-notes__intro {
  max-width: 44rem; margin: .7rem 0 0; color: #697064;
  font-size: .96rem; line-height: 1.75;
}
.linux-notes__source {
  margin: .45rem 0 0; color: #848b7e; font-size: .8rem;
}
.linux-notes__stats {
  display: grid; grid-template-columns: repeat(3, minmax(4.4rem, 1fr)); gap: .45rem;
}
.linux-notes__stats > div {
  min-width: 4.6rem; padding: .65rem .7rem;
  border-left: 1px solid rgb(103 126 91 / 18%);
}
.linux-notes__stats strong, .linux-notes__stats span { display: block; }
.linux-notes__stats strong { color: #4c5e47; font-family: var(--font-mono); font-size: 1.18rem; }
.linux-notes__stats span { margin-top: .18rem; color: #7b8676; font-size: .72rem; }

/* ── 工作区 ── */
.linux-notes__workspace {
  display: grid; min-height: 36rem;
  grid-template-columns: minmax(13.5rem, .3fr) minmax(0, 1fr);
}
.linux-notes__rail {
  padding: 1.3rem;
  border-right: 1px solid rgb(87 101 75 / 14%);
  background: rgb(246 242 231 / 74%);
}
.linux-notes__rail-label {
  display: block; margin: 0 0 .55rem; color: #63745c;
  font-family: var(--font-mono); font-size: .7rem; font-weight: 700; letter-spacing: .12em;
}
.linux-notes__chapters { display: grid; gap: .4rem; margin-bottom: 1.4rem; }
.linux-notes__chapters button {
  display: flex; align-items: baseline; gap: .5rem;
  min-height: 2.55rem; padding: .55rem .7rem;
  border: 1px solid transparent; border-radius: .6rem;
  color: #6f776a; text-align: left; cursor: pointer; background: transparent;
}
.linux-notes__chapters button:hover { color: #455140; background: rgb(220 235 212 / 66%); }
.linux-notes__chapters button[aria-pressed="true"] {
  border-color: rgb(113 137 99 / 30%); color: #41503c;
  background: linear-gradient(90deg, rgb(211 229 201 / 90%), rgb(239 246 232 / 54%));
}
.linux-notes__chapter-index {
  flex: none; color: #718069; font-family: var(--font-mono); font-size: .68rem;
}
.linux-notes__chapters button[aria-pressed="true"] .linux-notes__chapter-index { color: #4c5e47; }
.linux-notes__chapter-name { flex: 1 1 auto; min-width: 0; }
.linux-notes__search {
  width: 100%; min-height: 2.4rem; margin-bottom: .6rem; padding: 0 .75rem;
  border: 1px solid rgb(97 119 85 / 24%); border-radius: .6rem;
  color: #4e5849; background: rgb(255 253 246 / 88%);
}
.linux-notes__search::placeholder { color: #97a08f; }
.linux-notes__sections {
  max-height: 26rem; overflow: auto; padding-right: .2rem;
  scrollbar-width: thin;
}
.linux-notes__sections button {
  display: block; width: 100%; padding: .42rem .5rem;
  border: 0; border-radius: .45rem;
  color: #66705f; font-size: .84rem; line-height: 1.45; text-align: left;
  text-decoration: none; cursor: pointer; background: transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.linux-notes__sections button:hover { color: #3f4b3a; background: rgb(220 235 212 / 60%); }
.linux-notes__sections button.is-active {
  color: #3c4a37; font-weight: 600; background: rgb(211 229 201 / 72%);
}
.linux-notes__sections-empty { margin: .4rem 0; color: #848b7e; font-size: .82rem; }

/* ── 内容舞台 ── */
.linux-notes__stage {
  min-width: 0; padding: clamp(1.1rem, 2.6vw, 2rem);
}
.linux-notes__summary {
  margin: 0 0 1.5rem; padding: 1rem 1.2rem;
  border-left: 3px solid #829b75; border-radius: .8rem;
  background: rgb(226 239 216 / 55%);
}
.linux-notes__summary-head {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between;
  margin-bottom: .5rem;
}
.linux-notes__summary-title {
  color: #465240; font-family: var(--font-mono); font-size: .74rem;
  font-weight: 700; letter-spacing: .14em;
}
.linux-notes__summary-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.linux-notes__summary-actions button,
.linux-notes__pager button {
  padding: .45rem .9rem; border: 1px solid #718969; border-radius: .6rem;
  color: #44523f; cursor: pointer; background: rgb(255 253 246 / 82%);
}
.linux-notes__summary-actions button:hover,
.linux-notes__pager button:hover { background: rgb(226 239 216 / 90%); }
.linux-notes__summary > p { margin: 0; color: #5a6353; font-size: .92rem; line-height: 1.8; }

.linux-notes__loading {
  padding: 3rem 1rem; color: #7b8676; font-family: var(--font-mono);
  font-size: .82rem; letter-spacing: .1em; text-align: center;
}

/* ── 正文排版 ── */
.linux-notes__content {
  font-size: .95rem; line-height: 1.9; word-break: break-word;
}
.linux-notes__content h1 { display: none; }
.linux-notes__content h2, .linux-notes__content h3, .linux-notes__content h4,
.linux-notes__content h5, .linux-notes__content h6 {
  color: #403a33; font-family: var(--font-serif); font-weight: 600; line-height: 1.5;
  scroll-margin-top: 6.5rem;
}
.linux-notes__content h2 {
  margin: 2.2rem 0 1rem; padding-bottom: .45rem;
  border-bottom: 1px solid rgb(113 137 99 / 24%);
  font-size: 1.5rem;
}
.linux-notes__content h2:first-child { margin-top: 0; }
.linux-notes__content h3 { margin: 1.8rem 0 .8rem; font-size: 1.24rem; }
.linux-notes__content h4 { margin: 1.5rem 0 .7rem; font-size: 1.08rem; }
.linux-notes__content h5 { margin: 1.3rem 0 .6rem; font-size: .99rem; color: #4c5e47; }
.linux-notes__content h6 {
  margin: 1.1rem 0 .5rem; color: #5c6a52; font-family: var(--font-mono);
  font-size: .86rem; font-weight: 700;
}
.linux-notes__content p { margin: .7rem 0; color: #4d5148; }
.linux-notes__content li { margin: .3rem 0; }
.linux-notes__content li::marker { color: #718969; }
.linux-notes__content ul, .linux-notes__content ol { padding-left: 1.4rem; }
.linux-notes__content strong { color: #3f4b3a; }
.linux-notes__content blockquote {
  margin: 1rem 0; padding: .7rem 1rem;
  border-left: 3px solid rgb(113 137 99 / 45%);
  color: #5a6353; background: rgb(240 244 232 / 60%);
}
.linux-notes__content code {
  padding: .1rem .35rem; border-radius: .35rem;
  color: #4c5e47; font-family: var(--font-mono); font-size: .85em;
  background: rgb(211 229 201 / 38%);
}
.linux-notes__content .hl {
  margin: 1rem 0; padding: .9rem 1rem; overflow-x: auto;
  border: 1px solid rgb(113 137 99 / 22%); border-radius: .8rem;
  background: rgb(252 251 244 / 92%);
  scrollbar-width: thin;
}
.linux-notes__content .hl pre { margin: 0; background: transparent; }
.linux-notes__content .hl code {
  padding: 0; border-radius: 0; background: transparent;
  font-family: var(--font-mono); font-size: .8rem; line-height: 1.7; white-space: pre;
}
.linux-notes__content table {
  width: 100%; margin: 1.1rem 0; border-collapse: collapse;
  font-size: .88rem;
}
.linux-notes__content th, .linux-notes__content td {
  padding: .55rem .7rem; border: 1px solid rgb(113 137 99 / 25%);
  text-align: left; vertical-align: top;
}
.linux-notes__content th { color: #465240; background: rgb(226 239 216 / 55%); }
.linux-notes__content tr:nth-child(even) td { background: rgb(246 242 231 / 55%); }
.linux-notes__content hr {
  margin: 1.6rem 0; border: 0; border-top: 1px dashed rgb(113 137 99 / 30%);
}

/* ── 底部翻页 ── */
.linux-notes__pager {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between;
  margin-top: 1.8rem; padding-top: 1.1rem;
  border-top: 1px solid rgb(87 101 75 / 14%);
}
.linux-notes__pager-info { color: #848b7e; font-size: .8rem; }
.linux-notes__pager-group { display: flex; gap: .5rem; }
.linux-notes__pager button:disabled { opacity: .45; cursor: not-allowed; }

.linux-notes__footer {
  display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between;
  padding: .9rem clamp(1.2rem, 3vw, 2rem);
  border-top: 1px solid rgb(87 101 75 / 14%);
  color: #848b7e; font-size: .78rem;
}
.linux-notes__footer button {
  padding: .35rem .7rem; border: 1px solid rgb(113 137 99 / 35%); border-radius: .5rem;
  color: #6f776a; cursor: pointer; background: transparent;
}
.linux-notes__footer button:hover { color: #455140; background: rgb(220 235 212 / 60%); }

/* ── 响应式 ── */
@media (max-width: 900px) {
  .linux-notes__heading { grid-template-columns: 1fr; }
  .linux-notes__stats { grid-template-columns: repeat(3, 1fr); }
  .linux-notes__workspace { grid-template-columns: 1fr; min-height: 0; }
  .linux-notes__rail { border-right: 0; border-bottom: 1px solid rgb(87 101 75 / 14%); }
  .linux-notes__sections { max-height: 11rem; }
  .linux-notes__chapters {
    grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto;
    padding-bottom: .3rem;
  }
  .linux-notes__chapters button { white-space: nowrap; }
}
@media (max-width: 480px) {
  .linux-notes__stats { gap: .3rem; }
  .linux-notes__stats > div { min-width: 0; }
  .linux-notes__content { font-size: .92rem; }
}

/* ── 打印 ── */
@media print {
  .learning-deck-navigation, .linux-notes__rail, .linux-notes__footer,
  .linux-notes__summary-actions, .linux-notes__pager, .grain, .vignette { display: none !important; }
  .linux-notes__workspace { height: auto !important; }
  .linux-notes__stage { display: block; overflow: visible; }
  .linux-notes__scroll { overflow: visible; }
  .linux-notes { border: 0; box-shadow: none; background: #fff; }
  .linux-notes__content .hl { break-inside: avoid; }
}

/* ── 代码高亮（pygments xcode） ── */
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.linux-notes__content .hl .hll { background-color: #ffffcc }
.linux-notes__content .hl { background: #ffffff; }
.linux-notes__content .hl .c { color: #177500 } /* Comment */
.linux-notes__content .hl .err { color: #000000 } /* Error */
.linux-notes__content .hl .k { color: #A90D91 } /* Keyword */
.linux-notes__content .hl .l { color: #1C01CE } /* Literal */
.linux-notes__content .hl .n { color: #000000 } /* Name */
.linux-notes__content .hl .o { color: #000000 } /* Operator */
.linux-notes__content .hl .ch { color: #177500 } /* Comment.Hashbang */
.linux-notes__content .hl .cm { color: #177500 } /* Comment.Multiline */
.linux-notes__content .hl .cp { color: #633820 } /* Comment.Preproc */
.linux-notes__content .hl .cpf { color: #177500 } /* Comment.PreprocFile */
.linux-notes__content .hl .c1 { color: #177500 } /* Comment.Single */
.linux-notes__content .hl .cs { color: #177500 } /* Comment.Special */
.linux-notes__content .hl .kc { color: #A90D91 } /* Keyword.Constant */
.linux-notes__content .hl .kd { color: #A90D91 } /* Keyword.Declaration */
.linux-notes__content .hl .kn { color: #A90D91 } /* Keyword.Namespace */
.linux-notes__content .hl .kp { color: #A90D91 } /* Keyword.Pseudo */
.linux-notes__content .hl .kr { color: #A90D91 } /* Keyword.Reserved */
.linux-notes__content .hl .kt { color: #A90D91 } /* Keyword.Type */
.linux-notes__content .hl .ld { color: #1C01CE } /* Literal.Date */
.linux-notes__content .hl .m { color: #1C01CE } /* Literal.Number */
.linux-notes__content .hl .s { color: #C41A16 } /* Literal.String */
.linux-notes__content .hl .na { color: #836C28 } /* Name.Attribute */
.linux-notes__content .hl .nb { color: #A90D91 } /* Name.Builtin */
.linux-notes__content .hl .nc { color: #3F6E75 } /* Name.Class */
.linux-notes__content .hl .no { color: #000000 } /* Name.Constant */
.linux-notes__content .hl .nd { color: #000000 } /* Name.Decorator */
.linux-notes__content .hl .ni { color: #000000 } /* Name.Entity */
.linux-notes__content .hl .ne { color: #000000 } /* Name.Exception */
.linux-notes__content .hl .nf { color: #000000 } /* Name.Function */
.linux-notes__content .hl .nl { color: #000000 } /* Name.Label */
.linux-notes__content .hl .nn { color: #000000 } /* Name.Namespace */
.linux-notes__content .hl .nx { color: #000000 } /* Name.Other */
.linux-notes__content .hl .py { color: #000000 } /* Name.Property */
.linux-notes__content .hl .nt { color: #000000 } /* Name.Tag */
.linux-notes__content .hl .nv { color: #000000 } /* Name.Variable */
.linux-notes__content .hl .ow { color: #000000 } /* Operator.Word */
.linux-notes__content .hl .mb { color: #1C01CE } /* Literal.Number.Bin */
.linux-notes__content .hl .mf { color: #1C01CE } /* Literal.Number.Float */
.linux-notes__content .hl .mh { color: #1C01CE } /* Literal.Number.Hex */
.linux-notes__content .hl .mi { color: #1C01CE } /* Literal.Number.Integer */
.linux-notes__content .hl .mo { color: #1C01CE } /* Literal.Number.Oct */
.linux-notes__content .hl .sa { color: #C41A16 } /* Literal.String.Affix */
.linux-notes__content .hl .sb { color: #C41A16 } /* Literal.String.Backtick */
.linux-notes__content .hl .sc { color: #2300CE } /* Literal.String.Char */
.linux-notes__content .hl .dl { color: #C41A16 } /* Literal.String.Delimiter */
.linux-notes__content .hl .sd { color: #C41A16 } /* Literal.String.Doc */
.linux-notes__content .hl .s2 { color: #C41A16 } /* Literal.String.Double */
.linux-notes__content .hl .se { color: #C41A16 } /* Literal.String.Escape */
.linux-notes__content .hl .sh { color: #C41A16 } /* Literal.String.Heredoc */
.linux-notes__content .hl .si { color: #C41A16 } /* Literal.String.Interpol */
.linux-notes__content .hl .sx { color: #C41A16 } /* Literal.String.Other */
.linux-notes__content .hl .sr { color: #C41A16 } /* Literal.String.Regex */
.linux-notes__content .hl .s1 { color: #C41A16 } /* Literal.String.Single */
.linux-notes__content .hl .ss { color: #C41A16 } /* Literal.String.Symbol */
.linux-notes__content .hl .bp { color: #5B269A } /* Name.Builtin.Pseudo */
.linux-notes__content .hl .fm { color: #000000 } /* Name.Function.Magic */
.linux-notes__content .hl .vc { color: #000000 } /* Name.Variable.Class */
.linux-notes__content .hl .vg { color: #000000 } /* Name.Variable.Global */
.linux-notes__content .hl .vi { color: #000000 } /* Name.Variable.Instance */
.linux-notes__content .hl .vm { color: #000000 } /* Name.Variable.Magic */
.linux-notes__content .hl .il { color: #1C01CE } /* Literal.Number.Integer.Long */
/* ── 桌面端固定高度阅读区：左侧导航常驻，右侧内容内部滚动 ── */
@media (min-width: 960px) {
  .linux-notes__workspace {
    height: clamp(30rem, calc(100vh - 12.5rem), 66rem);
  }
  .linux-notes__stage {
    display: flex; flex-direction: column;
    min-height: 0; overflow: hidden;
  }
  .linux-notes__summary { flex: none; }
  .linux-notes__scroll {
    flex: 1; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain;
    padding-right: 0.35rem;
    scrollbar-width: thin; scrollbar-color: rgb(113 137 99 / 45%) transparent;
  }
  .linux-notes__scroll :is(h2, h3, h4, h5, h6) { scroll-margin-top: 0.9rem; }
  .linux-notes__rail {
    display: flex; flex-direction: column;
    min-height: 0; overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: rgb(113 137 99 / 45%) transparent;
  }
  .linux-notes__chapters { flex: none; }
  .linux-notes__sections {
    flex: 1; min-height: 6rem;
    max-height: none; overflow: visible;
  }
}

/* ── 工作区联动（与 Linux 练习同模式：顶部胶囊按钮 data-workspace 驱动） ── */
.learning-dashboard__inner[data-workspace="linux-notes"] > #linux-notes-root {
  display: block !important;
  order: 2;
  width: 100%;
  animation: learning-workspace-enter 320ms ease both;
}
.learning-dashboard__inner[data-workspace="linux-notes"] > #learning-today,
.learning-dashboard__inner[data-workspace="linux-notes"] > #learning-week,
.learning-dashboard__inner[data-workspace="linux-notes"] > #learning-budget,
.learning-dashboard__inner[data-workspace="linux-notes"] > #learning-roadmap,
.learning-dashboard__inner[data-workspace="linux-notes"] > #learning-library,
.learning-dashboard__inner[data-workspace="linux-notes"] > #learning-notes,
.learning-dashboard__inner[data-workspace="linux-notes"] > #learning-memory {
  display: none !important;
}
@media (min-width: 960px) {
  .learning-dashboard__inner[data-workspace] > #linux-notes-root {
    grid-column: 2;
    grid-row: 3;
  }
}
@media (max-width: 959px) {
  .learning-dashboard__inner[data-notes-active="true"] > #linux-notes-root {
    order: 2;
  }
}

/* ── 重点速记 / 完整讲义 模式切换 ── */
.linux-notes__mode {
  display: inline-flex;
  border: 1px solid rgb(113 137 99 / 35%);
  border-radius: .6rem;
  overflow: hidden;
}
.linux-notes__mode button {
  padding: .42rem .8rem;
  border: 0; border-radius: 0;
  color: #6f776a;
  cursor: pointer;
  background: rgb(255 253 246 / 85%);
  font-size: .84rem;
}
.linux-notes__mode button + button { border-left: 1px solid rgb(113 137 99 / 25%); }
.linux-notes__mode button:hover { color: #455140; background: rgb(226 239 216 / 70%); }
.linux-notes__mode button[aria-pressed="true"] {
  color: #fffdf6;
  font-weight: 600;
  background: #718969;
}
