/* ============================================================
   Tech Forest — "Tech, Explained Simply"
   A clean, professional tech-blog theme.
   ============================================================ */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fc;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --gold: #f59e0b;
  --dark: #0b1220;
  --dark-soft: #111c33;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.06);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --maxw: 1140px;
  --maxw-article: 760px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

.container { width: min(var(--maxw), 92%); margin: 0 auto; }

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.02em; color: var(--ink); }

.section { padding: 64px 0; }
.section-soft { background: var(--bg-soft); }
.section-title {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  margin-bottom: 8px;
}
.section-sub { color: var(--muted); margin-bottom: 32px; max-width: 640px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.25s ease;
}
.site-header.scrolled { box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; gap: 16px;
}
.logo { font-size: 1.5rem; font-weight: 800; color: var(--ink); letter-spacing: -0.03em; }
.logo .dot { color: var(--accent); }
.logo small {
  display: block; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin-top: -2px;
}
.main-nav { display: flex; align-items: center; gap: 28px; }
.main-nav a { color: var(--ink-soft); font-weight: 600; font-size: 0.95rem; }
.main-nav a:hover, .main-nav a.active { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.search-wrap { position: relative; }
.search-wrap input {
  border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 16px 9px 38px; font-size: 0.9rem; width: 210px;
  background: var(--bg-soft); color: var(--ink); outline: none;
  transition: border-color 0.2s, width 0.25s;
}
.search-wrap input:focus { border-color: var(--accent); width: 250px; background: #fff; }
.search-wrap svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; stroke: var(--muted);
}
.btn {
  display: inline-block; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 0.95rem;
  padding: 12px 26px; border-radius: 999px;
  transition: background 0.2s, transform 0.15s;
}
.btn:hover { background: var(--accent-dark); color: #fff; transform: translateY(-1px); }
.btn-outline {
  background: transparent; color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: #fff; transform: none; }
.btn-sm { padding: 9px 20px; font-size: 0.88rem; }
.hamburger {
  display: none; background: none; border: none; cursor: pointer; padding: 8px;
}
.hamburger span {
  display: block; width: 24px; height: 2.5px; background: var(--ink);
  margin: 5px 0; border-radius: 2px; transition: 0.25s;
}

/* ---------- Hero ---------- */
.hero {
  position: relative; color: #fff; overflow: hidden;
  background: var(--dark);
}
.hero-bg {
  position: absolute; inset: 0;
  background: url("../images/hero.jpg") center/cover no-repeat;
  opacity: 0.55;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(11,18,32,0.92) 20%, rgba(11,18,32,0.55) 60%, rgba(11,18,32,0.25));
}
.hero-inner { position: relative; z-index: 2; padding: 96px 0 104px; max-width: 640px; }
.hero-kicker {
  display: inline-block; font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold);
  margin-bottom: 16px;
}
.hero h1 { color: #fff; font-size: clamp(2.1rem, 4.6vw, 3.4rem); margin-bottom: 16px; }
.hero p { color: #cbd5e1; font-size: 1.1rem; margin-bottom: 28px; max-width: 540px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero .btn-outline { color: #fff; border-color: rgba(255,255,255,0.4); }
.hero .btn-outline:hover { border-color: #fff; color: #fff; background: rgba(255,255,255,0.08); }

/* ---------- Featured post ---------- */
.featured {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 0;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  margin-top: -48px; position: relative; z-index: 3;
}
.featured-img img { width: 100%; height: 100%; object-fit: cover; min-height: 320px; }
.featured-body { padding: 40px; display: flex; flex-direction: column; justify-content: center; }
.tag {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}
.featured-body h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); margin-bottom: 12px; }
.featured-body h2 a { color: var(--ink); }
.featured-body h2 a:hover { color: var(--accent); }
.featured-body p { color: var(--muted); margin-bottom: 18px; }
.byline {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 0.86rem; margin-top: 6px;
}
.byline .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff; font-weight: 800; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
}
.byline strong { color: var(--ink-soft); }
.dot-sep::before { content: "·"; margin: 0 6px; }

/* ---------- Post grid ---------- */
.posts-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px;
}
.post-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.post-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.post-card-img { aspect-ratio: 16/9; overflow: hidden; background: var(--bg-soft); }
.post-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.post-card:hover .post-card-img img { transform: scale(1.05); }
.post-card-body { padding: 22px; display: flex; flex-direction: column; flex: 1; }
.post-card-body h3 { font-size: 1.12rem; margin-bottom: 10px; }
.post-card-body h3 a { color: var(--ink); }
.post-card-body h3 a:hover { color: var(--accent); }
.post-card-body > p { color: var(--muted); font-size: 0.93rem; margin-bottom: 16px; flex: 1; }
.post-card .byline { border-top: 1px solid var(--line); padding-top: 14px; margin-top: auto; }

/* ---------- Categories strip ---------- */
.cat-chips { display: flex; gap: 12px; flex-wrap: wrap; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  padding: 10px 20px; border-radius: 999px; font-weight: 600; font-size: 0.92rem;
  transition: 0.2s;
}
.cat-chip:hover { border-color: var(--accent); color: var(--accent); }
.cat-chip .count {
  background: var(--bg-soft); border-radius: 999px; font-size: 0.75rem;
  padding: 2px 9px; color: var(--muted); font-weight: 700;
}

/* ---------- Newsletter ---------- */
.newsletter {
  background: linear-gradient(120deg, var(--dark) 0%, var(--dark-soft) 100%);
  border-radius: calc(var(--radius) + 6px); color: #fff;
  padding: 56px; text-align: center; position: relative; overflow: hidden;
}
.newsletter::before {
  content: ""; position: absolute; width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,0.35), transparent 70%);
  top: -120px; right: -80px;
}
.newsletter h2 { color: #fff; margin-bottom: 10px; font-size: clamp(1.4rem, 2.6vw, 2rem); }
.newsletter p { color: #94a3b8; margin-bottom: 26px; max-width: 520px; margin-left: auto; margin-right: auto; }
.newsletter form { display: flex; gap: 10px; max-width: 480px; margin: 0 auto; position: relative; z-index: 2; }
.newsletter input[type="email"] {
  flex: 1; border: 1px solid rgba(255,255,255,0.2); border-radius: 999px;
  padding: 13px 22px; font-size: 0.95rem; background: rgba(255,255,255,0.08);
  color: #fff; outline: none;
}
.newsletter input[type="email"]::placeholder { color: #64748b; }
.newsletter input[type="email"]:focus { border-color: var(--accent); }
.form-note { font-size: 0.82rem; color: #64748b; margin-top: 14px; }
.form-success {
  display: none; background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.4);
  color: #86efac; padding: 14px 22px; border-radius: 12px; font-weight: 600;
  max-width: 480px; margin: 0 auto;
}

/* ---------- Article ---------- */
.article-hero { padding: 56px 0 0; }
.article-hero .container { max-width: var(--maxw-article); }
.article-hero h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); margin: 14px 0 18px; }
.article-hero .lede { font-size: 1.15rem; color: var(--muted); margin-bottom: 22px; }
.article-hero .byline { margin-bottom: 28px; }
.article-cover { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 8px; }
.article-cover img { width: 100%; aspect-ratio: 21/10; object-fit: cover; }
.article-body { max-width: var(--maxw-article); margin: 0 auto; padding: 40px 0 24px; }
.article-body p { margin-bottom: 1.4em; font-size: 1.06rem; color: var(--ink-soft); }
.article-body h2 { font-size: 1.55rem; margin: 2em 0 0.7em; padding-top: 0.4em; }
.article-body h3 { font-size: 1.22rem; margin: 1.6em 0 0.6em; }
.article-body ul, .article-body ol { margin: 0 0 1.4em 1.4em; color: var(--ink-soft); font-size: 1.04rem; }
.article-body li { margin-bottom: 0.55em; }
.article-body li::marker { color: var(--accent); font-weight: 700; }
.article-body blockquote {
  border-left: 4px solid var(--accent); background: var(--accent-soft);
  padding: 18px 24px; border-radius: 0 12px 12px 0; margin: 1.8em 0;
  font-style: italic; color: var(--ink-soft);
}
.article-body strong { color: var(--ink); }
.tip-box {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px;
  padding: 20px 24px; margin: 1.8em 0;
}
.tip-box strong { color: #92400e; }
.tip-box p { margin: 6px 0 0; font-size: 0.98rem; }
.article-tags { display: flex; gap: 10px; flex-wrap: wrap; margin: 32px 0; }
.article-tags span {
  font-size: 0.82rem; background: var(--bg-soft); border: 1px solid var(--line);
  padding: 6px 14px; border-radius: 999px; color: var(--muted); font-weight: 600;
}
.author-card {
  display: flex; gap: 18px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; background: var(--bg-soft); margin: 8px 0 48px;
}
.author-card .avatar {
  width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.author-card h4 { margin-bottom: 6px; }
.author-card p { color: var(--muted); font-size: 0.94rem; margin: 0; }
.progress-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--accent), #7c3aed); z-index: 200;
}

/* ---------- Categories page ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.cat-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 34px;
  background: #fff; transition: 0.2s;
}
.cat-card:hover { box-shadow: var(--shadow); transform: translateY(-4px); }
.cat-card h3 { font-size: 1.35rem; margin-bottom: 8px; }
.cat-card p { color: var(--muted); font-size: 0.95rem; margin-bottom: 16px; }
.page-head { padding: 64px 0 8px; }
.page-head h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 10px; }
.page-head p { color: var(--muted); max-width: 640px; font-size: 1.05rem; }

/* ---------- About / Contact ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.about-img { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 40px; }
.value-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; background: #fff;
}
.value-card .icon {
  width: 46px; height: 46px; border-radius: 12px; margin-bottom: 16px;
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.value-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.value-card p { color: var(--muted); font-size: 0.93rem; }
.contact-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: start; }
.form-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 36px; background: #fff; box-shadow: var(--shadow-sm);
}
.field { margin-bottom: 20px; }
.field label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 8px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; font-size: 0.96rem; font-family: inherit;
  color: var(--ink); outline: none; transition: border-color 0.2s;
  background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field textarea { min-height: 140px; resize: vertical; }
.field .error { display: none; color: #dc2626; font-size: 0.82rem; margin-top: 6px; }
.info-list { list-style: none; }
.info-list li {
  display: flex; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line);
  color: var(--ink-soft); font-size: 0.96rem;
}
.info-list li:last-child { border-bottom: none; }
.info-list .icon {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}

/* ---------- Footer ---------- */
.site-footer { background: var(--dark); color: #94a3b8; margin-top: 72px; }
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px;
  padding: 64px 0 48px;
}
.footer-brand .logo { color: #fff; }
.footer-brand p { font-size: 0.93rem; margin: 14px 0 20px; max-width: 300px; }
.socials { display: flex; gap: 10px; }
.socials a {
  width: 40px; height: 40px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: #cbd5e1; font-size: 0.85rem; font-weight: 700; transition: 0.2s;
}
.socials a:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.site-footer h4 { color: #fff; font-size: 0.95rem; margin-bottom: 18px; letter-spacing: 0.02em; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 12px; }
.footer-links a { color: #94a3b8; font-size: 0.93rem; }
.footer-links a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 22px 0; display: flex; justify-content: space-between; gap: 12px;
  font-size: 0.86rem; flex-wrap: wrap;
}

/* ---------- Utilities ---------- */
.no-results {
  display: none; text-align: center; padding: 48px 20px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius); grid-column: 1 / -1;
}
.breadcrumb { font-size: 0.86rem; color: var(--muted); margin-bottom: 12px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .featured { grid-template-columns: 1fr; }
  .featured-img img { min-height: 240px; }
  .cat-grid, .two-col, .contact-grid { grid-template-columns: 1fr; }
  .values { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .search-wrap input { width: 150px; }
  .search-wrap input:focus { width: 170px; }
}
@media (max-width: 720px) {
  .main-nav {
    position: fixed; top: 68px; left: 0; right: 0; z-index: 99;
    background: #fff; border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px 4%; max-height: 0; overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
  }
  .main-nav.open { max-height: 320px; padding: 12px 4% 20px; box-shadow: var(--shadow); }
  .main-nav a { padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .main-nav a:last-child { border-bottom: none; }
  .hamburger { display: block; }
  .hamburger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
  .hamburger.open span:nth-child(2) { opacity: 0; }
  .hamburger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
  .header-cta { display: none; }
  .posts-grid { grid-template-columns: 1fr; }
  .newsletter { padding: 40px 24px; }
  .newsletter form { flex-direction: column; }
  .values { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .section { padding: 48px 0; }
  .hero-inner { padding: 72px 0 120px; }
}
