/* ------------------------------------------------------------------
   cxiaoyu.top — 小宇的 Java 笔记
   Palette: pale lichen paper, deep ink, one cobalt accent.
   Type: Archivo (Latin) + system CJK, Space Mono for data.
------------------------------------------------------------------- */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  font-display: swap;
  src: url("/assets/fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF,
    U+FFFD;
}

@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/spacemono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF,
    U+FFFD;
}

:root {
  --paper: #f1f2ec;
  --paper-2: #e8eae1;
  --ink: #101826;
  --ink-2: #3c4757;
  --muted: #5d6775;
  --line: #d3d7cc;
  --accent: #2545d8;
  --accent-soft: #aebeff;
  --amber: #b9823f;
  --max: 1140px;
  --pad: clamp(20px, 5vw, 60px);
  --sans: "Archivo", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC",
    "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "Space Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono",
    monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body,
h1,
h2,
h3,
p,
figure,
ol,
ul,
pre {
  margin: 0;
  padding: 0;
}

ol,
ul {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

code,
pre {
  font-family: var(--mono);
}

img,
svg {
  display: block;
  max-width: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1;
}

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.wrap {
  width: min(var(--max), calc(100% - var(--pad) * 2));
  margin-inline: auto;
}

.skip {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  transition: top 0.15s ease;
}

.skip:focus {
  top: 12px;
}

/* ------------------------------- header ------------------------------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1;
  border-radius: 1px;
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-text em {
  font-family: var(--mono);
  font-style: normal;
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 28px);
}

.site-nav a {
  position: relative;
  font-size: 14px;
  color: var(--ink-2);
  padding-block: 4px;
  transition: color 0.16s ease;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="true"] {
  color: var(--accent);
}

.site-nav a:hover::after,
.site-nav a[aria-current="true"]::after {
  transform: scaleX(1);
}

/* -------------------------------- hero -------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  gap: clamp(32px, 4.6vw, 64px);
  align-items: start;
  padding-block: clamp(44px, 6.5vw, 88px) clamp(48px, 7vw, 92px);
}

.hero-meta {
  max-width: 36ch;
  margin-bottom: 22px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
}

.hero h1 {
  margin-bottom: 24px;
  font-size: clamp(38px, 5.4vw, 66px);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.015em;
}

.hero-lead {
  max-width: 34em;
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--ink-2);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: 1px solid var(--ink);
  border-radius: 1px;
  font-size: 14.5px;
  font-weight: 500;
  transition: background-color 0.18s ease, border-color 0.18s ease,
    color 0.18s ease;
}

.btn-solid {
  background: var(--ink);
  color: var(--paper);
}

.btn-solid:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-ghost {
  color: var(--ink);
}

.btn-ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.hero-foot {
  margin-top: 26px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* ------------------------------ thread dump ---------------------------- */

.dump {
  padding: 18px 18px 16px;
  background: var(--ink);
  border-top: 3px solid var(--accent);
  color: #e8ecf4;
}

.dump-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 13px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-family: var(--mono);
  font-size: 10px;
  color: #93a0b4;
}

.dump-title {
  color: #d8deea;
}

.lanes {
  display: grid;
  gap: 9px;
}

.lane {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.lane-name {
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1;
  color: #96a2b6;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track {
  position: relative;
  height: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 1px;
}

.blk {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--x);
  width: var(--w);
  border-radius: 1px;
}

.blk.run {
  background: #5070f0;
}

.blk.wait {
  background: #a8783d;
}

.blk.block {
  background: #5d6a80;
}

.blk.stw {
  background: #d9a55b;
}

.dump-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: #96a2b6;
}

.sw {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  vertical-align: 1px;
}

.sw.run {
  background: #5070f0;
}

.sw.wait {
  background: #a8783d;
}

.sw.block {
  background: #5d6a80;
}

.sw.stw {
  background: #d9a55b;
}

.dump figcaption {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11.5px;
  line-height: 1.7;
  color: #8d99ad;
}

/* ------------------------------- sections ------------------------------ */

.section {
  padding-block: clamp(52px, 7vw, 90px);
  border-top: 1px solid var(--line);
  scroll-margin-top: 80px;
}

.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: clamp(28px, 4vw, 44px);
}

.sec-head h2 {
  font-size: clamp(26px, 3.2vw, 34px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.sec-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* -------------------------------- notes -------------------------------- */

.notes {
  border-bottom: 1px solid var(--line);
}

.note {
  border-top: 1px solid var(--line);
}

.note summary {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 120px 22px;
  grid-template-areas: "when main tags toggle";
  gap: 20px;
  align-items: start;
  padding: 22px 4px;
  cursor: pointer;
  list-style: none;
}

.note summary::-webkit-details-marker {
  display: none;
}

.note summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.note-when {
  grid-area: when;
  padding-top: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.note-main {
  grid-area: main;
}

.note-title {
  display: block;
  font-size: clamp(17px, 1.85vw, 20px);
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
  transition: color 0.16s ease;
}

.note-desc {
  display: block;
  max-width: 62ch;
  margin-top: 7px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink-2);
}

.note-desc code {
  padding: 1px 4px;
  background: var(--paper-2);
  border-radius: 2px;
  font-size: 12px;
  color: #2a3547;
}

.note-tags {
  grid-area: tags;
  padding-top: 9px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.9;
  color: var(--muted);
  text-align: right;
}

.note-toggle {
  position: relative;
  grid-area: toggle;
  width: 13px;
  height: 13px;
  margin-top: 9px;
  transition: transform 0.22s ease;
}

.note-toggle::before,
.note-toggle::after {
  content: "";
  position: absolute;
  background: var(--ink-2);
}

.note-toggle::before {
  left: 0;
  right: 0;
  top: 6px;
  height: 1px;
}

.note-toggle::after {
  top: 0;
  bottom: 0;
  left: 6px;
  width: 1px;
}

.note summary:hover .note-title {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.note[open] .note-toggle {
  transform: rotate(45deg);
}

.note[open] .note-toggle::before,
.note[open] .note-toggle::after {
  background: var(--accent);
}

.note[open] .note-title {
  color: var(--accent);
}

.note[open] summary {
  padding-bottom: 12px;
}

.note-more {
  max-width: 74ch;
  padding: 0 28px 26px calc(88px + 20px);
  font-size: 15px;
  line-height: 1.9;
  color: var(--ink-2);
}

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

.note-more code {
  font-size: 12.5px;
  color: #2a3547;
  overflow-wrap: anywhere;
}

/* -------------------------------- stack -------------------------------- */

.classcard {
  margin-bottom: clamp(30px, 4vw, 46px);
  padding: 22px 24px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
  overflow-x: auto;
}

.classcard pre {
  font-size: 12.5px;
  line-height: 2;
  color: var(--ink);
}

.classcard .kw {
  color: var(--accent);
}

.classcard .cm {
  color: var(--muted);
}

.skills {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 3.6vw, 44px);
}

.skill-col {
  padding-top: 14px;
  border-top: 1px solid var(--ink);
}

.skill-col h3 {
  margin-bottom: 9px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.skill-col p {
  font-size: 14.5px;
  line-height: 1.95;
  color: var(--ink-2);
}

/* -------------------------------- path --------------------------------- */

.path {
  border-bottom: 1px solid var(--line);
}

.path li {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 28px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.path-when {
  padding-top: 5px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.85;
  color: var(--muted);
}

.path-when b {
  font-weight: 400;
  color: var(--accent);
}

.path-what h3 {
  font-size: 17.5px;
  font-weight: 600;
  line-height: 1.5;
}

.path-what p {
  max-width: 62ch;
  margin-top: 6px;
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--ink-2);
}

/* ------------------------------- contact ------------------------------- */

.contact {
  margin-top: clamp(40px, 6vw, 76px);
  padding-block: clamp(56px, 8vw, 96px) 26px;
  background: var(--ink);
  color: #e9edf4;
  scroll-margin-top: 64px;
}

.contact h2 {
  max-width: 14ch;
  font-size: clamp(30px, 4.6vw, 48px);
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.015em;
}

.contact-lead {
  max-width: 32em;
  margin-top: 16px;
  font-size: 15px;
  line-height: 1.85;
  color: #b9c2d0;
}

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

.mail {
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  font-size: clamp(20px, 2.6vw, 28px);
  color: #fff;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.mail:hover {
  color: var(--accent-soft);
  border-color: var(--accent-soft);
}

.copy {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 1px;
  font-family: var(--mono);
  font-size: 10px;
  color: #c7d0de;
  transition: border-color 0.18s ease, color 0.18s ease;
}

.copy:hover {
  border-color: var(--accent-soft);
  color: #fff;
}

.copy-status {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent-soft);
  min-width: 3em;
}

.contact-note {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 11px;
  color: #8c97a8;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  margin-top: clamp(48px, 7vw, 80px);
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.8;
  color: #7e8a9c;
}

/* -------------------------------- 404 ---------------------------------- */

.nf {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100svh;
  width: min(640px, calc(100% - var(--pad) * 2));
  margin-inline: auto;
  padding-block: 64px;
}

.nf-code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.nf h1 {
  margin-top: 10px;
  font-size: clamp(34px, 6vw, 52px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.nf-msg {
  margin-top: 18px;
  font-size: 15px;
  line-height: 1.9;
  color: var(--ink-2);
}

.nf-msg code {
  font-size: 12.5px;
  color: var(--muted);
}

.nf-link {
  margin-top: 30px;
}

/* ------------------------------- motion -------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * {
    opacity: 0;
    transform: translateY(14px);
    animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  }

  .hero-copy > :nth-child(1) {
    animation-delay: 0.05s;
  }
  .hero-copy > :nth-child(2) {
    animation-delay: 0.11s;
  }
  .hero-copy > :nth-child(3) {
    animation-delay: 0.17s;
  }
  .hero-copy > :nth-child(4) {
    animation-delay: 0.23s;
  }
  .hero-copy > :nth-child(5) {
    animation-delay: 0.29s;
  }

  .blk {
    transform: scaleX(0);
    transform-origin: left center;
    animation: draw 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
    animation-delay: var(--d);
  }
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes draw {
  to {
    transform: scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------ responsive ----------------------------- */

@media (max-width: 980px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .hero h1 {
    font-size: clamp(38px, 7.4vw, 56px);
  }

  .dump {
    max-width: 640px;
  }

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

@media (max-width: 720px) {
  .note summary {
    grid-template-columns: minmax(0, 1fr) 22px;
    grid-template-areas:
      "when toggle"
      "main main"
      "tags tags";
    gap: 4px 14px;
    padding: 20px 2px;
  }

  .note-when {
    padding-top: 2px;
  }

  .note-title {
    font-size: 18px;
    margin-top: 6px;
  }

  .note-tags {
    padding-top: 8px;
    text-align: left;
  }

  .note-toggle {
    margin-top: 2px;
  }

  .note-more {
    padding: 0 0 22px;
    font-size: 14.5px;
  }

  .path li {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 20px 0;
  }

  .path-when {
    padding-top: 0;
  }

  .skills {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }

  .classcard {
    padding: 18px 16px;
  }

  .classcard pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 11.5px;
  }
}

@media (max-width: 520px) {
  .head-inner {
    min-height: 58px;
  }

  .brand-text em {
    display: none;
  }

  .site-nav {
    gap: 14px;
  }

  .site-nav a {
    font-size: 13px;
  }

  .hero {
    padding-block: 36px 52px;
  }

  .hero-actions {
    gap: 10px;
  }

  .btn {
    padding: 11px 16px;
    font-size: 14px;
  }

  .lane {
    grid-template-columns: 66px minmax(0, 1fr);
    gap: 8px;
  }

  .lane-name {
    font-size: 8.5px;
  }

  .dump {
    padding: 14px 12px 13px;
  }

  .dump-legend {
    gap: 6px 12px;
    font-size: 9px;
  }

  .contact h2 {
    max-width: 12ch;
  }
}
