/**
 * 功能说明：定义 iOS 面试复习页面的阅读优先版式、专题索引与浏览器本地复习状态控件。
 * 职责边界：只扩展 /interview/ 的静态视觉与交互，不改写主站通用组件或保存个人学习数据。
 */

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent-deep);
  color: #fff;
  translate: 0 -160%;
}

.skip-link:focus-visible {
  translate: 0 0;
}

.page-interview {
  --interview-ink: #293631;
  --interview-paper: #f7f4ed;
  --interview-rule: rgba(70, 83, 76, 0.16);
  --interview-warm: #a96d42;
  background: #fffefb;
}

.page-interview .site-header {
  background: rgba(255, 254, 251, 0.9);
}

.interview-intro,
.interview-topic-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(72px, 9vw, 132px) 0 clamp(56px, 7vw, 92px);
  border-bottom: 1px solid var(--interview-rule);
  background:
    linear-gradient(90deg, rgba(88, 104, 94, 0.06) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(180deg, #f9f7f1 0%, #fffefb 76%);
}

.interview-intro::after,
.interview-topic-hero::after {
  content: "";
  position: absolute;
  right: clamp(-170px, -8vw, -96px);
  bottom: clamp(-178px, -14vw, -112px);
  width: clamp(340px, 40vw, 620px);
  aspect-ratio: 1;
  border: 1px solid rgba(90, 140, 120, 0.24);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(169, 109, 66, 0.04), 0 0 0 92px rgba(90, 140, 120, 0.035);
  pointer-events: none;
}

.interview-intro-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 0.48fr);
  gap: clamp(36px, 8vw, 140px);
  align-items: end;
}

.interview-intro-copy {
  max-width: 760px;
}

.interview-intro h1,
.interview-topic-hero h1 {
  max-width: 12ch;
  margin-top: 14px;
  color: var(--interview-ink);
  font-size: clamp(3rem, 7.4vw, 6.2rem);
  font-weight: 560;
  line-height: 0.98;
  letter-spacing: 0;
}

.interview-intro-copy > p:last-of-type,
.interview-topic-hero > .shell > p:last-child {
  max-width: 43ch;
  margin-top: 24px;
  color: rgba(41, 54, 49, 0.76);
  font-size: 1.08rem;
  line-height: 1.9;
}

.interview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 22px;
  align-items: center;
  margin-top: 32px;
}

.interview-text-link {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  color: var(--accent-deep);
  font-size: 0.96rem;
  font-weight: 660;
  text-decoration: underline;
  text-decoration-color: rgba(58, 95, 78, 0.28);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: color 180ms ease, text-decoration-color 180ms ease, transform 180ms ease;
}

.interview-text-link:hover,
.interview-text-link:focus-visible {
  color: #294b3b;
  text-decoration-color: currentColor;
  transform: translateX(2px);
}

.interview-margin-note {
  max-width: 28ch;
  padding: 18px 0 18px 20px;
  border-left: 2px solid rgba(169, 109, 66, 0.52);
}

.interview-intro-side {
  display: grid;
  gap: 18px;
  align-content: end;
}

.interview-cover {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(41, 54, 49, 0.12);
  background: #fffefb;
}

.interview-cover img {
  display: block;
  width: 100%;
  height: auto;
}

/* 封面已经承担首屏的视觉落点，避免与旧的同心圆装饰争夺注意力。 */
.page-interview-index .interview-intro::after {
  display: none;
}

.interview-margin-note p {
  color: rgba(41, 54, 49, 0.68);
  font-size: 0.9rem;
  line-height: 1.72;
}

.interview-margin-note p + p {
  margin-top: 10px;
}

.interview-section {
  padding: clamp(64px, 8vw, 112px) 0;
}

.interview-section-heading {
  display: grid;
  gap: 14px;
  max-width: 680px;
}

.interview-section-heading h2,
.interview-boundary h2,
.study-content h2 {
  color: var(--interview-ink);
  font-size: clamp(1.82rem, 3.2vw, 3.05rem);
  font-weight: 590;
  line-height: 1.15;
}

.interview-section-heading > p:last-child,
.interview-boundary-grid > p {
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.82;
}

.interview-method {
  background: var(--interview-paper);
}

.method-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: clamp(40px, 6vw, 72px);
  border-top: 1px solid var(--interview-rule);
}

.method-steps li {
  display: grid;
  gap: 24px;
  min-height: 230px;
  padding: 28px 24px 24px 0;
  border-bottom: 1px solid var(--interview-rule);
}

.method-steps li + li {
  padding-left: 24px;
  border-left: 1px solid var(--interview-rule);
}

.method-step-number {
  color: var(--interview-warm);
  font-size: 0.82rem;
  font-weight: 760;
  letter-spacing: 0.09em;
}

.method-steps h3 {
  color: var(--interview-ink);
  font-size: 1.18rem;
  font-weight: 650;
}

.method-steps p {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 0.94rem;
  line-height: 1.75;
}

.interview-library {
  background: #fffefb;
}

.topic-list {
  display: grid;
  margin-top: clamp(36px, 5vw, 62px);
  border-top: 1px solid var(--interview-rule);
}

.topic-entry {
  display: grid;
  grid-template-columns: minmax(130px, 0.26fr) minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 30px 0;
  border-bottom: 1px solid var(--interview-rule);
}

a.topic-entry {
  transition: background-color 180ms ease, padding-inline 180ms ease;
}

a.topic-entry:hover,
a.topic-entry:focus-visible {
  padding-right: 18px;
  padding-left: 18px;
  background: rgba(90, 140, 120, 0.055);
}

.topic-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 680;
}

.topic-entry-meta span:last-child {
  color: var(--text-muted);
}

.topic-entry-main h3 {
  color: var(--interview-ink);
  font-size: clamp(1.2rem, 2vw, 1.58rem);
  font-weight: 620;
  line-height: 1.34;
}

.topic-entry-main p {
  max-width: 70ch;
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 0.96rem;
  line-height: 1.7;
}

.topic-entry-link {
  color: var(--accent-deep);
  font-size: 0.92rem;
  font-weight: 660;
  white-space: nowrap;
}

.topic-entry--planned {
  opacity: 0.64;
}

.topic-entry--planned .topic-entry-link {
  color: var(--text-muted);
  font-weight: 500;
}

.interview-library-note {
  max-width: 56ch;
  margin-top: 22px;
  padding-left: 18px;
  border-left: 2px solid rgba(169, 109, 66, 0.42);
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.78;
}

.interview-boundary {
  border-top: 1px solid var(--interview-rule);
  background: #eef3ee;
}

.interview-boundary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.72fr);
  gap: clamp(36px, 8vw, 128px);
  align-items: end;
}

.interview-topic-hero {
  padding-bottom: clamp(50px, 6vw, 76px);
}

.interview-topic-hero h1 {
  max-width: 16ch;
  font-size: clamp(2.72rem, 6.4vw, 5.5rem);
}

.interview-topic-hero > .shell > p:last-child {
  max-width: 55ch;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 28px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.breadcrumbs a {
  color: var(--text-soft);
  text-decoration: underline;
  text-decoration-color: rgba(64, 60, 54, 0.18);
  text-underline-offset: 4px;
}

.interview-reading-shell {
  display: grid;
  grid-template-columns: minmax(180px, 0.28fr) minmax(0, 1fr);
  gap: clamp(38px, 8vw, 122px);
  align-items: start;
  padding-top: clamp(52px, 7vw, 96px);
  padding-bottom: clamp(74px, 9vw, 130px);
}

.study-toc {
  position: sticky;
  top: calc(var(--header-height) + 28px);
  display: grid;
  gap: 14px;
  padding: 18px 0 18px 18px;
  border-left: 2px solid rgba(90, 140, 120, 0.3);
}

.study-toc > p {
  color: var(--interview-ink);
  font-size: 0.82rem;
  font-weight: 720;
}

.study-toc nav {
  display: grid;
  gap: 9px;
}

.study-toc a {
  color: var(--text-soft);
  font-size: 0.87rem;
  line-height: 1.5;
}

.study-toc a:hover,
.study-toc a:focus-visible {
  color: var(--accent-deep);
}

.study-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: clamp(64px, 8vw, 104px);
  max-width: 780px;
}

.study-content section {
  scroll-margin-top: calc(var(--header-height) + 28px);
}

.study-content h2 {
  max-width: 17ch;
  margin-top: 12px;
  font-size: clamp(1.72rem, 3vw, 2.55rem);
}

.study-content p,
.study-content li {
  max-width: 66ch;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.9;
}

.study-content h2 + p,
.study-content p + p {
  margin-top: 18px;
}

.study-content code {
  color: #254f3d;
  font-size: 0.92em;
}

.study-content pre {
  overflow-x: auto;
  margin: 26px 0;
  padding: 20px 22px;
  border: 1px solid rgba(41, 54, 49, 0.12);
  border-radius: 12px;
  background: #f4f6f1;
  color: #2d4639;
  font-size: 0.88rem;
  line-height: 1.72;
}

.study-content pre code {
  color: inherit;
  font-size: inherit;
}

.study-content blockquote {
  max-width: 68ch;
  margin: 28px 0 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid rgba(169, 109, 66, 0.55);
}

.study-content blockquote p {
  color: rgba(41, 54, 49, 0.78);
}

.concept-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin-top: 28px;
}

.concept-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  color: var(--text-soft);
  font-size: 0.91rem;
  line-height: 1.68;
}

.concept-table th,
.concept-table td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--interview-rule);
  text-align: left;
  vertical-align: top;
}

.concept-table thead th {
  color: var(--interview-ink);
  font-size: 0.8rem;
  font-weight: 720;
}

.concept-table tbody th {
  width: 18%;
  color: var(--interview-ink);
  font-weight: 650;
}

.method-chain {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 30px;
  border-top: 1px solid var(--interview-rule);
  border-bottom: 1px solid var(--interview-rule);
}

.method-chain > div {
  display: grid;
  gap: 10px;
  min-height: 178px;
  padding: 24px 18px 22px 0;
}

.method-chain > div + div {
  padding-left: 18px;
  border-left: 1px solid var(--interview-rule);
}

.method-chain span {
  color: var(--interview-warm);
  font-size: 0.76rem;
  font-weight: 740;
  letter-spacing: 0.08em;
}

.method-chain strong {
  color: var(--interview-ink);
  font-size: 1.05rem;
}

.method-chain p {
  font-size: 0.9rem;
  line-height: 1.66;
}

.study-note {
  max-width: 68ch;
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px solid rgba(90, 140, 120, 0.2);
  background: rgba(90, 140, 120, 0.075);
  color: rgba(41, 54, 49, 0.82);
  font-size: 0.95rem;
  line-height: 1.82;
}

.study-review {
  padding-top: 34px;
  border-top: 1px solid var(--interview-rule);
}

.study-review-copy {
  margin-top: 18px;
}

.review-state {
  display: grid;
  gap: 14px;
  margin-top: 24px;
  padding: 18px 0;
  border-top: 1px dashed var(--interview-rule);
  border-bottom: 1px dashed var(--interview-rule);
}

.review-state p {
  color: rgba(41, 54, 49, 0.7);
  font-size: 0.92rem;
}

.review-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.review-state button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(90, 140, 120, 0.28);
  border-radius: 999px;
  background: #fffefb;
  color: #345847;
  font-size: 0.88rem;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.review-state button:hover,
.review-state button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent-deep);
}

.review-state button[aria-pressed="true"] {
  border-color: var(--accent-deep);
  background: var(--accent-deep);
  color: #fffefb;
}

.review-state .review-reset {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.review-questions {
  display: grid;
  gap: 0;
  margin-top: 26px;
  border-top: 1px solid var(--interview-rule);
}

.review-questions details {
  border-bottom: 1px solid var(--interview-rule);
}

.review-questions summary {
  position: relative;
  padding: 19px 34px 19px 0;
  color: var(--interview-ink);
  font-size: 1rem;
  font-weight: 620;
  line-height: 1.62;
  cursor: pointer;
}

.review-questions summary::marker {
  color: var(--accent-deep);
}

.review-questions summary::after {
  content: "+";
  position: absolute;
  top: 17px;
  right: 2px;
  color: var(--accent-deep);
  font-size: 1.3rem;
  font-weight: 400;
}

.review-questions details[open] summary::after {
  content: "−";
}

.review-questions details > div {
  padding: 0 0 18px;
}

.review-questions details > div p {
  max-width: 62ch;
  font-size: 0.95rem;
}

.study-next {
  padding-top: 34px;
  border-top: 1px solid var(--interview-rule);
}

.study-next h2 {
  max-width: 21ch;
}

.study-next .interview-text-link {
  margin-top: 20px;
}

.page-interview a:focus-visible,
.page-interview button:focus-visible,
.review-questions summary:focus-visible {
  outline: 2px solid var(--interview-warm);
  outline-offset: 4px;
}

@media (max-width: 900px) {
  .interview-intro-grid,
  .interview-boundary-grid,
  .interview-reading-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .interview-margin-note {
    max-width: 54ch;
  }

  .method-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .method-steps li:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .study-toc {
    position: static;
    grid-template-columns: auto 1fr;
    align-items: start;
  }

  .study-toc nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 18px;
  }
}

@media (max-width: 680px) {
  .interview-intro,
  .interview-topic-hero {
    padding-top: 56px;
  }

  .interview-intro h1,
  .interview-topic-hero h1 {
    max-width: 10ch;
    font-size: clamp(2.7rem, 14vw, 4.5rem);
  }

  .interview-intro-copy > p:last-of-type,
  .interview-topic-hero > .shell > p:last-child {
    margin-top: 18px;
    font-size: 1rem;
  }

  .method-steps,
  .method-chain {
    grid-template-columns: 1fr;
  }

  .method-steps li,
  .method-steps li + li,
  .method-steps li:nth-child(3),
  .method-chain > div,
  .method-chain > div + div {
    min-height: 0;
    padding: 22px 0;
    border-left: 0;
  }

  .method-steps li + li,
  .method-chain > div + div {
    border-top: 1px solid var(--interview-rule);
  }

  .topic-entry {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 24px 0;
  }

  a.topic-entry:hover,
  a.topic-entry:focus-visible {
    padding-right: 12px;
    padding-left: 12px;
  }

  .topic-entry-link {
    white-space: normal;
  }

  .study-toc {
    grid-template-columns: 1fr;
  }

  .study-toc nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .study-content {
    gap: 64px;
  }

  .study-content h2 {
    max-width: 15ch;
  }

  .study-content pre {
    margin-right: -4px;
    padding: 17px;
    font-size: 0.8rem;
  }

  .review-state-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .review-state button {
    width: 100%;
  }
}

/* 面试正文是长期回看的静态知识，不因尚未滚动到某段而隐藏。 */
.page-interview.reveal-ready [data-reveal] {
  opacity: 1;
  translate: 0 0;
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .interview-text-link,
  .review-state button,
  a.topic-entry {
    transition: none;
  }
}
