/*
Theme Name: 科技脉冲 · 暖色手绘
Theme URI: https://www.zszydn.cn/
Author: Codex
Description: A warm hand-drawn editorial technology magazine theme for WordPress.
Version: 1.4.0
Requires at least: 6.0
Text Domain: techpulse
*/

:root {
  --paper: #fff7e9;
  --paper-deep: #f9ecd8;
  --ink: #34291f;
  --muted: #78685b;
  --coral: #dd6548;
  --terracotta: #b94d35;
  --mustard: #eeb85d;
  --line: #dfcbb3;
  --card: #fffdf8;
  --shadow: 0 12px 30px rgba(101, 65, 39, .10);
  --max: 1200px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  min-width: 320px;
  margin: 0;
  overflow-wrap: break-word;
  color: var(--ink);
  font-family: "Microsoft YaHei", ui-rounded, "Segoe UI", system-ui, sans-serif;
  line-height: 1.75;
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(180, 119, 72, .09) .7px, transparent .7px),
    linear-gradient(135deg, rgba(255, 255, 255, .38), rgba(244, 217, 181, .22));
  background-size: 8px 8px, 100% 100%;
}

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--terracotta); outline-offset: 3px; }
img, video, iframe { display: block; max-width: 100%; }
img { height: auto; }
.wrap { width: min(var(--max), calc(100% - 48px)); margin-inline: auto; }
.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 9px 13px;
  transform: translateY(-160%);
  border: 2px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: var(--mustard);
  font-weight: 800;
}
.skip-link:focus { transform: translateY(0); }

/* Header and navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(185, 77, 53, .17);
  background: rgba(255, 247, 233, .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.header-inner {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.045em;
  line-height: 1.22;
}
.brand-name { min-width: 0; }
.brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: 11px 11px 11px 4px;
  color: #fffaf0;
  background: var(--coral);
  box-shadow: 4px 4px 0 rgba(185, 77, 53, .18);
  transform: rotate(-4deg);
}
.main-nav {
  min-width: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.main-nav > ul,
.main-nav .menu {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.main-nav a {
  position: relative;
  display: block;
  padding: 8px 0;
  white-space: nowrap;
}
.main-nav a::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 3px;
  left: 4px;
  height: 3px;
  border-radius: 10px;
  background: var(--mustard);
  transform: scaleX(0);
  transition: transform .2s ease;
}
.main-nav a:hover,
.current-menu-item > a { color: var(--terracotta); }
.main-nav a:hover::after,
.current-menu-item > a::after { transform: scaleX(1); }
.header-search {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 50%;
  color: var(--terracotta);
  font-size: 17px;
}

/* Homepage hero */
.hero {
  position: relative;
  min-height: 430px;
  margin-top: 26px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(185, 77, 53, .16);
  border-radius: 26px 26px 26px 8px;
  background:
    linear-gradient(90deg, rgba(255, 247, 233, .99) 0%, rgba(255, 247, 233, .88) 40%, rgba(255, 247, 233, .08) 72%),
    url('assets/hero-warm-handdrawn.webp') center right / cover no-repeat;
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  bottom: -17px;
  left: 36%;
  width: 160px;
  height: 42px;
  border-radius: 50%;
  background: var(--mustard);
  opacity: .5;
  transform: rotate(-2deg);
}
.hero-copy {
  position: relative;
  z-index: 1;
  width: min(535px, 100%);
  padding: 52px;
}
.eyebrow {
  color: var(--terracotta);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 500px;
  margin: 12px 0;
  font-size: clamp(36px, 4.5vw, 58px);
  line-height: 1.12;
  letter-spacing: -.06em;
}
.hero p {
  max-width: 430px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}
#latest { scroll-margin-top: 96px; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 11px 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  color: #fffdf6;
  background: var(--coral);
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 900;
  transition: transform .2s ease, box-shadow .2s ease;
}
.button:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }

/* Lists, cards and archives */
.section { padding: 62px 0; }
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.section-title {
  margin: 0;
  font-size: 29px;
  line-height: 1.25;
  letter-spacing: -.045em;
}
.section-title::after {
  content: "";
  display: block;
  width: 62px;
  height: 7px;
  margin-top: 7px;
  border-radius: 99px;
  background: var(--mustard);
  transform: rotate(-2deg);
}
.section-link { flex: 0 0 auto; color: var(--terracotta); font-size: 14px; font-weight: 800; }
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 305px;
  gap: 24px;
  align-items: start;
}
.posts-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.section > .posts-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px 18px 18px 6px;
  background: var(--card);
  box-shadow: 0 6px 0 rgba(185, 77, 53, .08);
  transition: transform .24s ease, box-shadow .24s ease, border-color .24s ease;
}
.card:hover {
  border-color: rgba(221, 101, 72, .55);
  box-shadow: 0 15px 25px rgba(111, 66, 36, .14);
  transform: translateY(-5px) rotate(-.35deg);
}
.card > a { height: 100%; display: flex; flex-direction: column; }
.card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--paper-deep);
}
.card-image { object-position: center; }
.card-body { padding: 18px 19px 20px; }
.card h3 {
  margin: 6px 0 8px;
  font-size: 19px;
  line-height: 1.38;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.card-meta { color: var(--terracotta); font-size: 12px; font-weight: 800; }
.side-panel {
  position: sticky;
  top: 94px;
  align-self: start;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px 22px 6px 22px;
  background: #f9e6c9;
  box-shadow: 4px 4px 0 rgba(185, 77, 53, .13);
}
.side-panel::before {
  content: "✦";
  position: absolute;
  top: 8px;
  right: 18px;
  color: var(--coral);
  font-size: 28px;
  transform: rotate(15deg);
}
.side-panel h3 { margin: 5px 0 0; font-size: 22px; }
.category-list { margin: 14px 0 0; padding: 0; list-style: none; }
.category-list li { padding: 10px 0; border-top: 1px dashed rgba(120, 104, 91, .35); color: #604a3b; }
.category-list a { display: flex; justify-content: space-between; gap: 8px; font-weight: 750; }
.category-list a:hover { color: var(--terracotta); }
.pagination { margin-top: 32px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
.pagination .page-numbers { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }

/* Article reading layout */
.single-layout {
  width: min(780px, calc(100% - 48px));
  margin: 58px auto 72px;
}
.single-layout h1 {
  margin: 10px 0 0;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.16;
  letter-spacing: -.055em;
  text-wrap: balance;
}
.single-layout > img {
  width: 100%;
  max-height: 440px;
  margin: 22px 0 28px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 22px 22px 22px 5px;
  box-shadow: var(--shadow);
}
.entry-content {
  min-width: 0;
  margin-top: 20px;
  color: #493b31;
  font-size: 17px;
  line-height: 1.9;
}
.entry-content > * { max-width: 100%; }
.entry-content p { margin: 0 0 1.25em; }
.entry-content a {
  color: var(--terracotta);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: var(--mustard);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.entry-content h2,
.entry-content h3 { color: var(--ink); line-height: 1.35; }
.entry-content h2 { margin: 40px 0 16px; font-size: 28px; }
.entry-content h3 { margin: 30px 0 12px; font-size: 21px; }
.entry-content ul,
.entry-content ol { margin: 0 0 1.35em; padding-left: 1.5em; }
.entry-content li { margin-bottom: .5em; }
.entry-content li::marker { color: var(--coral); font-weight: 800; }
.entry-content blockquote {
  margin: 28px 0;
  padding: 18px 22px;
  border-left: 5px solid var(--coral);
  border-radius: 0 14px 14px 0;
  color: #654b39;
  background: #fff0d6;
}
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content pre {
  max-width: 100%;
  margin: 24px 0;
  padding: 16px 18px;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #4d3a2f;
  background: #fff0d6;
  font: 14px/1.75 Consolas, "Microsoft YaHei", monospace;
}
.entry-content code { overflow-wrap: anywhere; font-size: .9em; }
.entry-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.entry-content th,
.entry-content td { padding: 10px 12px; border: 1px solid var(--line); }
.entry-content iframe { width: 100%; }

/* Footer */
.site-footer {
  margin-top: 12px;
  padding: 34px 0;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  background: rgba(238, 184, 93, .13);
  font-size: 13px;
}
.site-footer .brand { color: var(--ink); }
.site-footer p { max-width: 430px; margin: 12px 0; }
.site-footer small { display: block; }
.filing-info { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
.filing-info a { color: var(--terracotta); font-weight: 800; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

/* Medium screens */
@media (max-width: 1080px) {
  .section > .posts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  .header-inner {
    min-height: 68px;
    flex-wrap: wrap;
    gap: 6px 12px;
    padding: 10px 0 8px;
  }
  .brand { font-size: 18px; }
  .main-nav {
    order: 3;
    width: 100%;
    margin: 0;
    gap: 18px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav > ul,
  .main-nav .menu { width: max-content; min-width: 100%; gap: 18px; }
  .main-nav a { padding: 5px 0 7px; }
  .content-grid { grid-template-columns: 1fr; }
  .side-panel { position: static; }
}

/* Phones and small tablets */
@media (max-width: 700px) {
  .wrap { width: calc(100% - 28px); }
  .hero {
    min-height: 440px;
    margin-top: 16px;
    border-radius: 22px 22px 22px 6px;
    background:
      linear-gradient(180deg, rgba(255, 247, 233, .99) 0%, rgba(255, 247, 233, .92) 58%, rgba(255, 247, 233, .40) 100%),
      url('assets/hero-warm-handdrawn.webp') 62% center / cover no-repeat;
  }
  .hero-copy { padding: 30px 24px; }
  .hero h1 { font-size: clamp(32px, 10vw, 39px); letter-spacing: -.05em; }
  .hero p { max-width: 360px; font-size: 15px; line-height: 1.75; }
  .button { min-height: 44px; padding: 10px 16px; }
  .section { padding: 44px 0; }
  .section-head { align-items: center; margin-bottom: 20px; }
  .section-title { font-size: 27px; }
  .posts-grid,
  .section > .posts-grid { grid-template-columns: 1fr; }
  .card img { aspect-ratio: 16 / 9; }
  .card-body { padding: 17px 18px 19px; }
  .card h3 { font-size: 18px; }
  .side-panel { padding: 20px; }
  .single-layout {
    width: calc(100% - 28px);
    margin: 38px auto 54px;
  }
  .single-layout h1 { font-size: clamp(30px, 9vw, 40px); letter-spacing: -.045em; }
  .single-layout > img {
    max-height: none;
    margin: 18px 0 24px;
    aspect-ratio: 16 / 10;
    border-radius: 18px 18px 18px 5px;
  }
  .entry-content { font-size: 16px; line-height: 1.82; }
  .entry-content h2 { margin-top: 34px; font-size: 24px; }
  .entry-content h3 { margin-top: 26px; font-size: 20px; }
  .entry-content ul,
  .entry-content ol { padding-left: 1.35em; }
  .entry-content blockquote { margin: 24px 0; padding: 16px 17px; }
  .entry-content pre { padding: 14px; font-size: 13px; }
  .site-footer { padding: 30px 0; }
}

/* Narrow phones */
@media (max-width: 420px) {
  .header-inner { gap: 6px 9px; }
  .brand { max-width: calc(100% - 44px); font-size: 16px; letter-spacing: -.03em; }
  .brand-mark { width: 30px; height: 30px; flex-basis: 30px; }
  .header-search { width: 32px; height: 32px; flex-basis: 32px; }
  .main-nav { font-size: 12px; }
  .main-nav { gap: 15px; }
  .main-nav > ul,
  .main-nav .menu { gap: 15px; }
  .hero { min-height: 420px; }
  .hero-copy { padding: 26px 20px; }
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 14px; }
  .section-head { align-items: flex-start; }
  .section-link { padding-top: 7px; font-size: 13px; }
  .section-title { font-size: 25px; }
  .single-layout h1 { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
