/* TechPulse Daily – style.css */
:root {
  --bg: #f1f5f4;
  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, .72);
  --ink: #14201f;
  --muted: #52625f;
  --line: #d6e0de;
  --accent: #0b7a75;
  --accent-ink: #ffffff;
  --accent-soft: #dff1ef;
  --shadow: 0 1px 2px rgba(20, 32, 31, .06), 0 8px 24px rgba(20, 32, 31, .06);
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-theme="dark"] {
  --bg: #0d1514;
  --surface: #152120;
  --surface-glass: rgba(21, 33, 32, .72);
  --ink: #e8f1ef;
  --muted: #9db2ae;
  --line: #28403d;
  --accent: #4fd1c5;
  --accent-ink: #062321;
  --accent-soft: #123432;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.65 var(--sans); overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .6em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.container { width: min(1180px, 100% - 2rem); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: .6rem 1rem; z-index: 100; }
.skip-link:focus { left: 0; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface-glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 64px; }
.logo { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.25rem; }
.logo svg { color: var(--accent); }
.main-nav { display: flex; gap: .15rem; margin-left: auto; }
.main-nav a { color: var(--ink); text-decoration: none; padding: .45rem .7rem; border-radius: 8px; font-size: .95rem; font-weight: 500; }
.main-nav a:hover { background: var(--accent-soft); }
.main-nav a.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.header-actions { display: flex; gap: .3rem; }
.icon-btn { width: 40px; height: 40px; border: 1px solid transparent; background: transparent; color: var(--ink); border-radius: 10px; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--accent-soft); }
.menu-btn { display: none; }
.search-panel { border-top: 1px solid var(--line); padding: .8rem 0; }
.search-form { display: flex; gap: .5rem; }
.search-form input {
  flex: 1; min-width: 0; padding: .65rem .9rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}

/* Buttons */
.btn { display: inline-block; font: inherit; font-weight: 600; font-size: .95rem; padding: .62rem 1.15rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }

/* Hero */
.hero { padding: clamp(2rem, 6vw, 4.5rem) 0; border-bottom: 1px solid var(--line); background:
  radial-gradient(900px 300px at 85% 0%, var(--accent-soft), transparent 70%), var(--bg); }
.hero-inner { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2.5rem; align-items: center; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); margin-bottom: .4em; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 52ch; margin-bottom: 1.6rem; }
.hero-panel { background: var(--surface-glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 18px; padding: 1.2rem 1.3rem; box-shadow: var(--shadow); }
.hero-panel h2 { font-size: 1rem; font-family: var(--sans); margin-bottom: .8rem; color: var(--muted); font-weight: 600; }
.hero-panel ul { list-style: none; margin: 0; padding: 0; }
.hero-panel li + li { border-top: 1px solid var(--line); }
.hero-panel a { display: block; padding: .75rem 0; color: var(--ink); text-decoration: none; font-family: var(--serif); font-weight: 600; line-height: 1.35; }
.hero-panel a:hover { color: var(--accent); }
.hero-panel small { display: block; font-family: var(--sans); font-weight: 400; color: var(--muted); margin-top: .2rem; }

/* Ads */
.ad-wrap { padding: 1.2rem 0 0; }
.ad-slot, .sidebar-ad {
  position: relative; max-width: 100%; margin: 0 auto; padding: 1.35rem .5rem .5rem;
  text-align: center; overflow: hidden;
  border: 1px dashed var(--line); border-radius: 10px; background: var(--surface);
}
.ad-slot > span, .sidebar-ad > span {
  position: absolute; top: .3rem; left: 0; right: 0; font-size: .68rem; color: var(--muted); letter-spacing: .04em;
}
.ad-banner-468 { width: 468px; min-height: 92px; }
.native-ad { margin: 1.6rem 0; min-height: 120px; }
.sidebar-ad { width: 100%; max-width: 200px; min-height: 340px; margin-bottom: 1.5rem; }
.native-holder { position: absolute; left: 0; width: 100%; height: 0; overflow: hidden; visibility: hidden; }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2.2rem; padding: 2rem 0 3rem; align-items: start; }
.sidebar { position: sticky; top: 84px; }
.widget { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1.5rem; }
.widget-title { font-size: 1.05rem; margin-bottom: .8rem; }
.side-list { margin: 0; padding-left: 1.2rem; }
.side-list.plain { list-style: none; padding: 0; }
.side-list li { padding: .45rem 0; border-top: 1px solid var(--line); line-height: 1.4; }
.side-list li:first-child { border-top: 0; padding-top: 0; }
.side-list a, .cat-list a { color: var(--ink); text-decoration: none; font-size: .95rem; }
.side-list a:hover, .cat-list a:hover { color: var(--accent); text-decoration: underline; }
.side-list small { display: block; color: var(--muted); }
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list li { display: flex; justify-content: space-between; padding: .4rem 0; }
.cat-list span { color: var(--muted); font-size: .85rem; }

/* Cards */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.3rem; margin-bottom: 2rem; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.card-img { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; background: var(--accent-soft); }
.card-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; flex: 1; }
.cat-tag { display: inline-block; align-self: flex-start; font-size: .78rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: .15rem .6rem; border-radius: 99px; margin-bottom: .6rem; text-decoration: none; }
.card h3 { margin-bottom: .4rem; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card p { color: var(--muted); font-size: .94rem; margin-bottom: .9rem; }
.card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: .6rem; font-size: .85rem; color: var(--muted); }
.card-foot .btn { padding: .35rem .8rem; font-size: .85rem; }
.featured-grid .card:first-child { grid-column: 1 / -1; flex-direction: row; }
.featured-grid .card:first-child .card-img { width: 48%; aspect-ratio: auto; min-height: 220px; }

/* Resource box */
.resource-box { background: var(--accent-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; margin: 1.5rem 0 2rem; display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.resource-box h2, .resource-box h3 { margin: 0 0 .2rem; }
.resource-box p { margin: 0; color: var(--muted); }
.resource-box small { display: block; color: var(--muted); font-size: .75rem; margin-top: .3rem; }

/* Article */
.breadcrumb { font-size: .88rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--muted); }
.article-meta { color: var(--muted); font-size: .92rem; display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-bottom: 1.2rem; }
.article-hero { width: 100%; border-radius: var(--radius); margin-bottom: 1.6rem; aspect-ratio: 16 / 8; object-fit: cover; }
.article-body { font-size: 1.07rem; max-width: 70ch; }
.article-body h2 { margin-top: 1.8em; }
.article-body ul, .article-body ol { padding-left: 1.3rem; margin: 0 0 1.2em; }
.article-body li { margin-bottom: .45em; }
.article-body p { line-height: 1.75; }
.back-row { margin: 2rem 0 1rem; }
.page-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.2rem, 3vw, 2.2rem); }
.page-card h2 { margin-top: 1.6em; font-size: 1.3rem; }
.page-card h2:first-of-type { margin-top: 1em; }
.page-card ul { padding-left: 1.3rem; }
.page-card .updated { color: var(--muted); font-size: .9rem; }

/* Forms */
.form-row { margin-bottom: 1rem; }
.form-row label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .93rem; }
.form-row input, .form-row textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .65rem .8rem; }
.form-row textarea { min-height: 150px; resize: vertical; }
.form-row .err { display: none; color: #c0392b; font-size: .85rem; margin-top: .25rem; }
[data-theme="dark"] .form-row .err { color: #ff8a7a; }
.form-row.invalid input, .form-row.invalid textarea { border-color: #c0392b; }
.form-row.invalid .err { display: block; }
.notice { background: var(--accent-soft); border-left: 4px solid var(--accent); padding: .8rem 1rem; border-radius: 8px; font-size: .92rem; margin-bottom: 1.2rem; }
.form-status { margin-top: 1rem; font-weight: 600; }
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.5rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 2.2rem 0 1.2rem; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 1.5rem; }
.footer-grid nav { display: flex; flex-direction: column; gap: .35rem; }
.footer-grid nav a { color: var(--ink); text-decoration: none; }
.footer-grid nav a:hover { color: var(--accent); text-decoration: underline; }
.footer-brand { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; margin: 0; }
.copyright { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }

.to-top { position: fixed; right: 1rem; bottom: 1rem; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--accent); color: var(--accent-ink); cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow); z-index: 40; }
.to-top[hidden] { display: none; }

/* Responsive */
@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; }
  .sidebar-ad { display: none; } /* 160x300 is a desktop-sidebar unit */
}
@media (max-width: 860px) {
  .menu-btn { display: grid; }
  .header-actions { margin-left: auto; }
  .main-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: .5rem 1rem 1rem; margin: 0;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: .75rem .5rem; }
  .hero-inner { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .grid { grid-template-columns: 1fr; }
  .featured-grid .card:first-child { flex-direction: column; }
  .featured-grid .card:first-child .card-img { width: 100%; aspect-ratio: 16 / 9; min-height: 0; }
  .sidebar { grid-template-columns: 1fr; }
  .two-col, .footer-grid { grid-template-columns: 1fr; }
  .ad-banner-468 { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
