/* ==========================================================================
   三亩地 · 编程学习日记 - 组件样式
   ========================================================================== */

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: var(--r-pill);
  transition: all 0.32s ease;
  cursor: pointer;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--ink);
  color: var(--cream);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--pink-ink);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-pink {
  background: var(--pink-deep);
  color: #fff;
  box-shadow: 0 12px 30px rgba(216, 155, 148, 0.32);
}
.btn-pink:hover {
  background: var(--pink-ink);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(168, 103, 96, 0.36);
}

.btn-yellow {
  background: var(--yellow-deep);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(217, 180, 90, 0.30);
}
.btn-yellow:hover {
  background: var(--yellow);
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow-yellow);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn-ghost:hover {
  border-color: var(--pink-deep);
  color: var(--pink-ink);
  background: var(--cream);
}

.btn-soft {
  background: var(--yellow-mist);
  color: var(--ink);
}
.btn-soft:hover {
  background: var(--yellow-soft);
  color: var(--pink-ink);
  transform: translateY(-2px);
}

.btn-lg { padding: 16px 34px; font-size: 15.5px; }
.btn-sm { padding: 9px 18px; font-size: 13px; }

/* ---------- 标签 / 徽章 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  font-size: 11.5px;
  border-radius: var(--r-pill);
  background: var(--yellow-mist);
  color: var(--yellow-deep);
  letter-spacing: 0.04em;
}

.tag.pink { background: var(--pink-mist); color: var(--pink-ink); }
.tag.sprout { background: rgba(168, 193, 138, 0.18); color: var(--sprout-deep); }
.tag.ink { background: var(--cream-2); color: var(--body); }

.badge-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--cream);
  border: 1.5px dashed var(--pink-soft);
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--pink-ink);
  font-weight: 700;
}

/* ---------- 面包屑 ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 32px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}

.breadcrumb a { color: var(--body); }
.breadcrumb a:hover { color: var(--pink-ink); }
.breadcrumb span { color: var(--line); }
.breadcrumb .current { color: var(--pink-ink); font-weight: 600; }

/* ---------- 页面 Hero（内页通用） ---------- */
.page-hero {
  position: relative;
  padding: calc(var(--nav-h) + 70px) 0 56px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--pink-mist) 0%, var(--cream) 100%);
}

.page-hero::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -60px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--yellow-soft) 0%, transparent 70%);
  opacity: 0.5;
}

.page-hero::after {
  content: "";
  position: absolute;
  bottom: -80px;
  left: -40px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--pink-soft) 0%, transparent 70%);
  opacity: 0.4;
}

.page-hero .container { position: relative; z-index: 2; }

.page-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4.4vw, 3rem);
  margin-bottom: 14px;
  position: relative;
  display: inline-block;
}

.page-hero h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 60%;
  height: 12px;
  background: var(--yellow-soft);
  z-index: -1;
  border-radius: 3px;
}

.page-hero .lead {
  font-size: 16px;
  color: var(--body);
  max-width: 620px;
}

.page-hero .crumb-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
}

/* ---------- 卡片基础 ---------- */
.card {
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(236, 223, 200, 0.5);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--pink-soft);
}

/* ---------- 资讯列表项 ---------- */
.news-list {
  margin-bottom: 24px;
}

.news-item {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 26px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  border-radius: var(--r-lg);
  border: 1px solid rgba(236, 223, 200, 0.55);
  transition: all 0.4s ease;
  position: relative;
}

.news-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 24px;
  bottom: 24px;
  width: 3px;
  background: var(--yellow-soft);
  border-radius: 2px;
  transition: background 0.3s ease;
}

.news-item:hover {
  transform: translateX(6px);
  box-shadow: var(--shadow-md);
  border-color: var(--pink-soft);
  background: var(--white);
}

.news-item:hover::before {
  background: var(--pink-deep);
}

.n-thumb {
  border-radius: var(--r-md);
  overflow: hidden;
  aspect-ratio: 16 / 11;
  position: relative;
}

.n-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.news-item:hover .n-thumb img {
  transform: scale(1.06);
}

.n-body { display: flex; flex-direction: column; }

.n-body h4 {
  font-size: 18px;
  margin-bottom: 10px;
  line-height: 1.5;
  transition: color 0.3s ease;
}

.news-item:hover .n-body h4 { color: var(--pink-ink); }

.n-excerpt {
  font-size: 13.5px;
  color: var(--body);
  line-height: 1.8;
  margin-bottom: auto;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.n-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
  color: var(--muted);
}

.n-foot .read {
  color: var(--pink-ink);
  font-weight: 600;
  transition: gap 0.3s ease;
}

.news-item:hover .n-foot .read { letter-spacing: 0.04em; }

/* 资讯列表页布局 */
.news-page-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  align-items: start;
}

.news-page-main { display: flex; flex-direction: column; }

/* 侧边栏 */
.news-side {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.side-card {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  border-radius: var(--r-lg);
  border: 1px solid rgba(236, 223, 200, 0.55);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.side-card h4 {
  font-size: 15px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}

.side-card h4::before {
  content: "";
  width: 4px;
  height: 16px;
  background: var(--pink-soft);
  border-radius: 2px;
}

.side-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  font-size: 13.5px;
  color: var(--body);
  border-bottom: 1px dashed transparent;
}

.side-link + .side-link { border-top: 1px dashed var(--line); }

.side-link:hover {
  color: var(--pink-ink);
  padding-left: 6px;
}

.side-link .arr { color: var(--pink-deep); }

/* 迷你资讯项（详情页侧边） */
.news-mini + .news-mini { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }

.mini-item {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
}

.m-thumb {
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.m-thumb img { width: 100%; height: 100%; object-fit: cover; }

.m-body h5 {
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.3s ease;
}

.mini-item:hover .m-body h5 { color: var(--pink-ink); }

.m-date {
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- 文章详情 ---------- */
.article-wrap {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 48px;
  box-shadow: var(--shadow-paper);
  border: 1px solid var(--line);
  position: relative;
}

.article-wrap::before {
  content: "";
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 54px;
  height: 18px;
  background: rgba(242, 217, 138, 0.55);
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(217, 180, 90, 0.2);
}

.article-head { margin-bottom: 28px; padding-top: 24px; }

.article-head h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
  line-height: 1.4;
  margin-bottom: 18px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 13px;
  color: var(--muted);
  padding-bottom: 24px;
  border-bottom: 1px dashed var(--line);
}

.article-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.article-content {
  font-size: 15.5px;
  line-height: 2;
  color: var(--body);
}

.article-content img {
  border-radius: var(--r-md);
  margin: 28px 0;
  box-shadow: var(--shadow-sm);
}

.article-content p { margin-bottom: 18px; }

.article-content h2,
.article-content h3 {
  font-family: var(--font-serif);
  margin: 32px 0 16px;
  color: var(--ink);
}

.article-content h2 { font-size: 22px; }
.article-content h3 { font-size: 18px; }

.article-content ul,
.article-content ol {
  margin: 0 0 18px 4px;
  list-style: none;
}

.article-content ul li,
.article-content ol li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 10px;
}

.article-content ul li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pink-deep);
}

.article-content ol { counter-reset: olc; }
.article-content ol li { counter-increment: olc; }
.article-content ol li::before {
  content: counter(olc);
  position: absolute;
  left: 0;
  top: 2px;
  width: 18px;
  height: 18px;
  background: var(--yellow-mist);
  color: var(--yellow-deep);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-content blockquote {
  margin: 24px 0;
  padding: 18px 24px;
  background: var(--yellow-mist);
  border-left: 4px solid var(--yellow-deep);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--ink);
  font-style: italic;
}

.article-content pre {
  margin: 24px 0;
  padding: 22px 24px;
  background: #2d2a22;
  border-radius: var(--r-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: #f0e6d2;
}

.article-content code {
  font-family: var(--font-mono);
  background: var(--cream-2);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--pink-ink);
}

.article-content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.article-foot {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px dashed var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.article-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.article-tags a {
  padding: 6px 14px;
  font-size: 12.5px;
  background: var(--cream-2);
  color: var(--body);
  border-radius: var(--r-pill);
  transition: all 0.3s ease;
}

.article-tags a:hover {
  background: var(--pink-soft);
  color: var(--pink-ink);
}

/* ---------- 表单 ---------- */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-field { margin-bottom: 16px; }

.form-field label,
.form-row label {
  display: block;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 8px;
  font-weight: 600;
}

.form-field input,
.form-field textarea,
.form-row input,
.form-field select {
  width: 100%;
  padding: 13px 16px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--cream);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  transition: all 0.3s ease;
}

.form-field input:focus,
.form-field textarea:focus,
.form-row input:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--pink-deep);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(240, 201, 196, 0.18);
}

.form-field textarea { resize: vertical; min-height: 130px; }

.form-tip {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- FAQ ---------- */
.faq-item {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(236, 223, 200, 0.55);
  border-radius: var(--r-md);
  margin-bottom: 14px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.faq-item.open {
  box-shadow: var(--shadow-md);
  border-color: var(--pink-soft);
}

.faq-q {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.faq-q .q-ico {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--yellow-mist);
  color: var(--yellow-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.3s ease;
}

.faq-item.open .q-ico {
  background: var(--pink-deep);
  color: #fff;
  transform: rotate(45deg);
}

.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
  padding: 0 24px;
  font-size: 14px;
  color: var(--body);
  line-height: 1.9;
}

.faq-item.open .faq-a {
  max-height: 360px;
  padding: 0 24px 22px;
}

/* ---------- 时间线 ---------- */
.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--yellow-soft), var(--pink-soft));
}

.tl-item {
  position: relative;
  padding-bottom: 32px;
}

.tl-item::before {
  content: "";
  position: absolute;
  left: -34px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cream);
  border: 3px solid var(--pink-deep);
  box-shadow: 0 0 0 4px var(--cream);
}

.tl-item .tl-date {
  font-size: 12.5px;
  color: var(--pink-ink);
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.tl-item h4 {
  font-size: 16px;
  margin-bottom: 6px;
}

.tl-item p {
  font-size: 13.5px;
  color: var(--body);
  line-height: 1.8;
}

/* ---------- 通用网格 ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

/* 信息行 */
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px dashed var(--line);
}

.info-row:last-child { border-bottom: none; }

.info-ico {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: var(--r-sm);
  background: var(--yellow-mist);
  color: var(--yellow-deep);
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-row h5 { font-size: 15px; margin-bottom: 4px; }
.info-row p { font-size: 13.5px; color: var(--body); }

/* 响应式 */
@media (max-width: 900px) {
  .news-page-grid { grid-template-columns: 1fr; }
  .news-side { position: static; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .article-wrap { padding: 30px 24px; border-radius: var(--r-lg); }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .news-item { grid-template-columns: 1fr; gap: 16px; }
  .n-thumb { aspect-ratio: 16 / 9; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .article-wrap { padding: 24px 18px; }
  .article-wrap::before { display: none; }
  .article-head { padding-top: 0; }
}
