/* =========================================================
   Responsive Blog Layout
   Hybrid edition: editorial structure + restrained card UI
   ========================================================= */

:root {
  --page-max: 1200px;
  --page-pad: 24px;

  --heading: #151821;
  --text: #303642;
  --body: #59616e;
  --muted: #8a919d;

  --accent: #2563eb;
  --page-bg: #f7f8fa;
  --card-bg: #ffffff;
  --line: #e9ebef;

  --radius-lg: 16px;
  --radius-md: 13px;
  --radius-sm: 10px;

  --shadow: 0 2px 10px rgba(20, 27, 45, .035);
  --shadow-hover: 0 10px 28px rgba(20, 27, 45, .075);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-search-open {
  overflow: hidden;
}

img,
svg {
  display: block;
}

img {
  max-width: 100%;
}

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

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.site {
  min-height: 100vh;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================
   Header
   ========================= */

.site-header {
  padding: 24px var(--page-pad) 0;
}

.header-inner {
  width: min(100%, var(--page-max));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.blog-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  position: relative;
  flex: 0 0 auto;
  color: var(--heading);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 2px;
  background: var(--heading);
  border-radius: 999px;
}

.nav-divider {
  width: 1px;
  height: 17px;
  flex: 0 0 auto;
  background: #c5c9d0;
}

.nav-scroll {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 30px;
}

.nav-scroll a {
  flex: 0 0 auto;
  color: #4c535f;
  font-size: 13px;
  font-weight: 600;
  transition: color 180ms ease;
}

.nav-scroll a:hover,
.nav-scroll a:focus-visible {
  color: var(--heading);
}

.search-open,
.search-close {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.search-open {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #4d5560;
  background: var(--card-bg);
  border: 1px solid #e2e5e9;
  border-radius: 999px;
  transition: color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.search-open:hover,
.search-open:focus-visible {
  color: var(--heading);
  border-color: #cfd4db;
  box-shadow: 0 4px 14px rgba(20, 27, 45, .055);
}

.search-open svg,
.search-form button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

/* =========================
   Shared
   ========================= */

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

.post-media {
  display: block;
  overflow: hidden;
  background: #eef0f4;
}

.post-media img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform 360ms cubic-bezier(.2, .7, .2, 1);
}

article:hover .post-media img {
  transform: scale(1.016);
}

.post-body {
  min-width: 0;
}

.post-category {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-bottom: 9px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  transition: filter 180ms ease;
}

.post-category:hover,
.post-category:focus-visible {
  filter: brightness(.96);
}

/* restrained category palette */
.cat-product {
  color: #2563eb;
  background: #eaf2ff;
}

.cat-wordpress {
  color: #7c3aed;
  background: #f3e8ff;
}

.cat-insight {
  color: #0f8b76;
  background: #e7f7f1;
}

.cat-case {
  color: #c05621;
  background: #fff0e3;
}

.cat-research {
  color: #087ea4;
  background: #eaf7fb;
}

.cat-performance {
  color: #b83280;
  background: #fceaf4;
}

.cat-ai {
  color: #0d9468;
  background: #e9f8f1;
}

.post-title {
  margin: 0;
  color: var(--heading);
  font-size: 18px;
  font-weight: 750;
  line-height: 1.42;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.post-title a {
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition: background-size 220ms ease;
}

.post-title a:hover,
.post-title a:focus-visible {
  background-size: 100% 1px;
}

.post-title-main {
  display: -webkit-box;
  overflow: hidden;
  font-size: clamp(24px, 2vw, 26px);
  font-weight: 760;
  line-height: 1.3;
  letter-spacing: -0.035em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.post-excerpt {
  display: -webkit-box;
  margin: 10px 0 0;
  overflow: hidden;
  color: var(--body);
  font-size: 14px;
  line-height: 1.72;
  text-wrap: pretty;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

/* =========================
   Featured
   ========================= */

.featured {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: 24px;
  align-items: stretch;
  margin-top: 34px;
}

.featured-main {
  min-width: 0;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.featured-media {
  position: relative;
  min-width: 0;
}

.featured-category {
  position: absolute;
  z-index: 2;
  left: 22px;
  bottom: 18px;
  margin: 0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .10);
}

.featured-main:hover {
  transform: translateY(-2px);
  border-color: #e1e4e9;
  box-shadow: var(--shadow-hover);
}

.featured-main .post-media {
  height: 100%;
  border-radius: 0;
}

.featured-main .post-media img {
  height: 100%;
}

.featured-main .post-body {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 21px 26px 24px;
}

.featured-main .post-excerpt {
  max-width: 94%;
  margin-top: 11px;
  font-size: 14.5px;
  line-height: 1.72;
}

.featured-main .post-meta {
  margin-top: auto;
  padding-top: 14px;
}

.featured-list {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.featured-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 48%) minmax(0, 52%);
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.featured-item:hover {
  transform: translateY(-2px);
  border-color: #e1e4e9;
  box-shadow: var(--shadow-hover);
}

.featured-item .post-media {
  align-self: stretch;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.featured-item .post-media img {
  height: 100%;
  aspect-ratio: auto;
  object-fit: cover;
}

.featured-item .post-body {
  align-self: center;
  padding: 15px 16px;
}

.featured-item .post-category {
  margin-bottom: 7px;
  padding: 3px 8px;
  font-size: 10.5px;
}

.featured-item .post-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 16px;
  font-weight: 730;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.featured-item .post-meta {
  margin-top: 9px;
  font-size: 11.5px;
}

/* =========================
   Latest
   ========================= */

.latest {
  margin-top: 76px;
  padding-bottom: 58px;
}

.section-head {
  margin-bottom: 27px;
}

.section-title {
  margin: 0;
  color: var(--heading);
  font-size: clamp(27px, 2.7vw, 32px);
  font-weight: 780;
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 24px;
}

.post-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: #e0e3e8;
  box-shadow: var(--shadow-hover);
}

.post-card .post-media {
  border-radius: 0;
}

.post-card .post-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 18px 19px;
}

.post-card .post-category {
  margin-bottom: 8px;
}

.post-card .post-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 17px;
  line-height: 1.43;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.post-card .post-excerpt {
  min-height: 48px;
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.72;
}

.post-card .post-meta {
  margin-top: auto;
  padding-top: 14px;
}

.section-action {
  display: flex;
  justify-content: center;
  margin-top: 36px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 23px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  box-shadow: 0 5px 16px rgba(37, 99, 235, .17);
  font-size: 12.5px;
  font-weight: 750;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
  background: #1d4ed8;
  box-shadow: 0 8px 22px rgba(37, 99, 235, .23);
}

/* =========================
   Search dialog
   ========================= */

.search-dialog[hidden] {
  display: none;
}

.search-dialog {
  position: fixed;
  z-index: 1000;
  inset: 0;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 20, 29, .42);
  backdrop-filter: blur(6px);
}

.search-panel {
  position: relative;
  width: min(calc(100% - 32px), 760px);
  margin: clamp(80px, 13vh, 150px) auto 0;
  padding: 72px 52px 56px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 28px 80px rgba(11, 13, 20, .18);
}

.search-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
}

.search-close:hover,
.search-close:focus-visible {
  background: #f3f5f7;
}

.search-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .025em;
}

.search-content h2 {
  margin: 0 0 24px;
  color: var(--heading);
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  border-bottom: 2px solid var(--heading);
}

.search-form input {
  min-width: 0;
  padding: 14px 0;
  border: 0;
  outline: 0;
  color: var(--heading);
  background: transparent;
  font-size: clamp(18px, 3vw, 24px);
}

.search-form input::placeholder {
  color: #a1a7b0;
}

.search-form button {
  width: 52px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.search-tip {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}


/* =========================
   Featured desktop alignment
   ========================= */

@media (min-width: 1024px) {
  .featured {
    --featured-height: 605px;
    --featured-image-height: 380px;
    height: var(--featured-height);
  }

  .featured-main {
    display: flex;
    height: var(--featured-height);
    flex-direction: column;
  }

  .featured-main .featured-media {
    flex: 0 0 var(--featured-image-height);
    height: var(--featured-image-height);
  }

  .featured-main .post-media img {
    width: 100%;
    height: var(--featured-image-height);
    aspect-ratio: auto;
    object-fit: cover;
  }

  .featured-list {
    height: var(--featured-height);
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }

  .featured-item {
    min-height: 0;
  }
}

/* =========================
   Tablet
   ========================= */

@media (max-width: 1023px) {
  .nav-scroll {
    gap: 22px;
  }

  .featured {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .featured-main {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
    height: auto;
  }

  .featured-main .featured-media {
    height: auto;
  }

  .featured-main .post-media {
    height: 100%;
  }

  .featured-main .post-media img {
    width: 100%;
    height: 100%;
    min-height: 100%;
    aspect-ratio: auto;
    object-fit: cover;
  }

  .featured-main .post-body {
    align-self: stretch;
  }

  .featured-main .post-excerpt {
    max-width: none;
  }

  .featured-list {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .featured-item {
    grid-template-columns: minmax(220px, 36%) minmax(0, 64%);
  }

  .featured-item .post-body {
    padding: 18px 20px;
  }

  .featured-item .post-title {
    font-size: 17px;
  }

  .posts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px 22px;
  }
}

/* =========================
   Mobile
   ========================= */

@media (max-width: 767px) {
  :root {
    --page-pad: 16px;
    --radius-lg: 14px;
    --radius-md: 12px;
  }

  .site-header {
    padding-top: 18px;
  }

  .header-inner {
    align-items: flex-start;
    gap: 12px;
  }

  .blog-nav {
    min-width: 0;
    flex: 1;
    gap: 12px;
    flex-wrap: wrap;
  }

  .brand {
    padding-top: 9px;
  }

  .brand.active::after {
    bottom: 2px;
  }

  .nav-divider {
    display: none;
  }

  .nav-scroll {
    order: 3;
    width: 100%;
    overflow-x: auto;
    gap: 20px;
    padding: 9px 0 5px;
    scrollbar-width: none;
  }

  .nav-scroll::-webkit-scrollbar {
    display: none;
  }

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

  .search-open {
    width: 38px;
    height: 38px;
  }

  .featured {
    margin-top: 24px;
    gap: 24px;
  }

  .featured-main {
    display: block;
  }

  .featured-main .featured-media {
    height: auto;
  }

  .featured-main .post-media {
    height: auto;
  }

  .featured-main .post-media img {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
  }

  .featured-category {
    left: 16px;
    bottom: 14px;
  }

  .featured-main .post-body {
    padding: 18px 18px 21px;
  }

  .post-title-main {
    font-size: 24px;
    line-height: 1.32;
  }

  .featured-main .post-excerpt {
    font-size: 14px;
  }

  .featured-list {
    gap: 14px;
  }

  .featured-item {
    display: grid;
    grid-template-columns: minmax(0, 40%) minmax(0, 60%);
  }

  .featured-item .post-media {
    align-self: stretch;
    height: 100%;
  }

  .featured-item .post-media img {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    object-fit: cover;
  }

  .featured-item .post-body {
    padding: 11px 12px;
  }

  .featured-item .post-category {
    margin-bottom: 5px;
    padding: 3px 7px;
    font-size: 10px;
  }

  .featured-item .post-title {
    font-size: 15px;
    line-height: 1.4;
  }

  .featured-item .post-meta {
    margin-top: 7px;
    font-size: 11px;
  }

  .latest {
    margin-top: 56px;
    padding-bottom: 44px;
  }

  .section-head {
    margin-bottom: 21px;
  }

  .section-title {
    font-size: 28px;
  }

  .posts-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .post-card .post-body {
    padding: 16px 17px 18px;
  }

  .post-card .post-title {
    font-size: 18px;
  }

  .post-card .post-excerpt {
    min-height: 0;
    font-size: 14px;
  }

  .post-card .post-meta {
    margin-top: 0;
    padding-top: 13px;
  }

  .section-action {
    margin-top: 30px;
  }

  .search-panel {
    width: calc(100% - 24px);
    margin-top: 54px;
    padding: 68px 24px 36px;
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
