:root {
  --bg: #fff;
  --surface: #f5f5f3;
  --text: #141414;
  --muted: #6b6b6b;
  --line: #e6e6e3;
  --accent: #0f766e;
  --accent-ink: #fff;
  --max: 1240px;
  --sans:
    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: var(--sans);
}
:root[data-theme="dark"] {
  --bg: #101112;
  --surface: #191a1c;
  --text: #ededeb;
  --muted: #9a9a96;
  --line: #2a2b2e;
  --accent: #2dd4bf;
  --accent-ink: #06201d;
}
* {
  box-sizing: border-box;
}
html {
  scroll-padding-top: 2rem;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--accent);
  text-decoration: none;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
img {
  display: block;
  max-width: 100%;
  height: auto;
}
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem);
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.5rem 1rem;
  z-index: 30;
}
/* top bar */
.topbar {
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}
.topbar .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 2.4rem;
}
.soc a {
  color: var(--muted);
  margin-left: 1.1rem;
}
.soc a:hover {
  color: var(--text);
}
/* header */
header.site {
  border-bottom: 1px solid var(--line);
}
.bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 5.5rem;
}
.logo {
  font-family: var(--sans);
  font-weight: 800;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}
.logo b {
  color: var(--accent);
}
.burger {
  justify-self: start;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0 0.55rem;
  border: 0;
  background: none;
  cursor: pointer;
}
.burger span {
  display: block;
  height: 2px;
  background: var(--text);
}
.burger span:nth-child(2) {
  width: 65%;
}
#theme {
  justify-self: end;
  border: 1px solid var(--line);
  background: none;
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  font: 500 0.82rem var(--sans);
  cursor: pointer;
}
#theme:hover {
  border-color: var(--text);
}
nav.main {
  display: flex;
  justify-content: center;
  gap: 2.2rem;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  border-top: 1px solid var(--line);
}
nav.main a {
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.8rem 0;
  border-bottom: 2px solid transparent;
}
nav.main a:hover,
nav.main a[aria-current] {
  color: var(--accent);
  border-color: var(--accent);
}
/* drawer */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 20;
}
#drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(320px, 85vw);
  background: var(--bg);
  z-index: 21;
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
}
#drawer[hidden],
#overlay[hidden] {
  display: none;
}
#drawer a {
  display: block;
  padding: 0.75rem 0;
  color: var(--text);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
}
#drawer a.logo {
  border: 0;
  padding: 0;
  font-size: 1.6rem;
}
#drawer hr {
  border: 0;
  margin: 0.6rem 0;
}
.drawer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
#close {
  border: 0;
  background: none;
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}
main {
  padding: 2.25rem 0 4rem;
}
h1,
h2,
h3 {
  font-family: var(--serif);
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 0 0 0.6rem;
  font-weight: 700;
}
h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
}
h3 {
  font-size: 1.35rem;
}
.meta {
  color: var(--muted);
  font-size: 0.85rem;
}
.tag {
  display: inline-block;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}
.tag:hover {
  text-decoration: underline;
}
h2 a,
h3 a {
  color: inherit;
}
h2 a:hover,
h3 a:hover {
  color: var(--accent);
}
.side-h {
  font: 600 1.05rem var(--sans);
  letter-spacing: 0;
  padding-bottom: 0.7rem;
  margin: 0 0 1.2rem;
  border-bottom: 1px solid var(--text);
}
/* hero */
.hero {
  display: grid;
  grid-template-columns: 2.1fr 1fr;
  gap: 2.5rem;
}
.feature {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: #000;
  min-height: 460px;
}
.feature img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.feature::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.82),
    rgba(0, 0, 0, 0.05) 65%
  );
}
.over {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  color: #fff;
}
.over .tag,
.over .meta {
  color: #d7f5f1;
}
.over p {
  color: #e5e5e5;
  margin: 0.2rem 0 0.7rem;
  max-width: 60ch;
}
.over h2 {
  font-size: clamp(1.8rem, 3.8vw, 2.8rem);
  color: #fff;
}
.over h2 a:hover {
  color: #fff;
  text-decoration: underline;
}
.trend li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.trend li:first-child {
  padding-top: 0;
}
.trend a:not(.tag) {
  display: block;
  font: 700 1.12rem/1.35 var(--serif);
  color: var(--text);
}
.trend a:not(.tag):hover {
  color: var(--accent);
}
.trend .tag {
  margin-bottom: 0.2rem;
}
/* columns */
.cols {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 3rem;
  margin-top: 3.5rem;
}
.item {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  padding-bottom: 1.75rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--line);
}
.item:last-child {
  border: 0;
}
.thumb {
  display: block;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface);
  aspect-ratio: 3/2;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.item p,
.card p {
  color: var(--muted);
  margin: 0.2rem 0 0.6rem;
}
.plain li {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}
.plain li:first-child {
  padding-top: 0;
}
.plain a {
  display: block;
  color: var(--text);
  font: 700 1.05rem/1.35 var(--serif);
}
.plain a:hover {
  color: var(--accent);
}
.counts li {
  display: flex;
  justify-content: space-between;
}
.counts a {
  font: 500 0.98rem var(--sans);
}
.counts span {
  color: var(--muted);
}
.sidebar section {
  margin-bottom: 2.5rem;
}
/* grids / category / post */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
.card .thumb {
  margin-bottom: 0.9rem;
}
.crumbs {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.crumbs a {
  color: var(--muted);
}
.crumbs a:hover {
  color: var(--text);
}
.cathead {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}
.cathead p {
  color: var(--muted);
  margin: 0;
}
.phead {
  max-width: 820px;
  margin: 1rem auto 1.75rem;
  text-align: center;
}
.cover {
  max-width: 1000px;
  margin: 0 auto 2.5rem;
}
.cover img {
  width: 100%;
  aspect-ratio: 2/1;
  object-fit: cover;
  border-radius: 4px;
}
article.post .body {
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.12rem;
  line-height: 1.85;
}
article.post .body h2 {
  margin-top: 2.4rem;
  font-size: 1.7rem;
}
article.post .body figure {
  margin: 2rem 0;
}
article.post .body figure img {
  width: 100%;
  border-radius: 4px;
}
article.post .body figcaption {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
article.post .body li {
  margin-bottom: 0.4rem;
}
article.post .body ul,
article.post .body ol {
  padding-left: 1.4rem;
}
article.post .body ul {
  list-style: disc;
}
.related {
  margin-top: 4rem;
}
.page {
  max-width: 760px;
  margin: 0 auto;
}
/* footer (always dark) */
footer.site {
  background: #0e1012;
  color: #a8abb0;
  padding: 3.5rem 0 1.5rem;
  font-size: 0.92rem;
}
.fcols {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 2rem;
}
footer.site .logo {
  color: #fff;
  font-size: 1.8rem;
}
footer.site .logo b {
  color: #2dd4bf;
}
footer.site h4 {
  color: #fff;
  font: 600 1rem var(--sans);
  margin: 0 0 1rem;
}
footer.site li {
  margin-bottom: 0.5rem;
}
footer.site a {
  color: #a8abb0;
}
footer.site a:hover {
  color: #fff;
}
.copy {
  border-top: 1px solid #23262a;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
}
@media (max-width: 960px) {
  .hero,
  .cols {
    grid-template-columns: 1fr;
  }
  .feature {
    min-height: 380px;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .fcols {
    grid-template-columns: 1fr 1fr;
  }
  nav.main {
    display: none;
  }
}
@media (max-width: 600px) {
  .item {
    grid-template-columns: 1fr;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .fcols {
    grid-template-columns: 1fr;
  }
  .soc a:nth-child(n + 3) {
    display: none;
  }
  .topbar span:first-child {
    display: none;
  }
  .topbar .wrap {
    justify-content: flex-end;
  }
  article.post .body {
    font-size: 1.05rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* ===== KnowDaily additions ===== */
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tools { justify-self: end; display: flex; align-items: center; gap: 0.6rem; }
.logo small.tagline { display: block; margin-top: 0.45rem; font-size: 0.72rem; font-weight: 500; letter-spacing: 0.02em; color: var(--muted); }
.sf, .sbig { display: flex; gap: 0.4rem; }
.sf input, .sbig input, .newsletter input { font: inherit; padding: 0.5rem 0.8rem; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--text); min-width: 0; }
.sf input { width: 11rem; }
.sbig input { flex: 1; max-width: 32rem; padding: 0.7rem 1rem; }
.sf button, .sbig button, .newsletter button, .more { font: inherit; font-weight: 600; padding: 0.5rem 1rem; border: 0; border-radius: 4px; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.more { display: block; margin: 1.5rem auto; padding: 0.7rem 1.8rem; }
.readmore { display: inline-block; margin-left: 0.8rem; color: #fff; font-weight: 600; }
.catcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 2.5rem; }
.catcard { display: flex; flex-direction: column; gap: 0.4rem; padding: 1.2rem; border-radius: 6px; border: 1px solid var(--line); border-top: 4px solid var(--c2); background: var(--surface); color: var(--text); transition: transform .15s; }
.catcard:hover { transform: translateY(-2px); }
.catcard h3 { margin: 0; }
.catcard p { margin: 0; color: var(--muted); font-size: 0.9rem; flex: 1; }
.catcard .count { font-weight: 700; color: var(--accent); font-size: 0.85rem; }
.spot { margin: 3rem 0; }
.empty, .note { padding: 1.2rem; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); }
.note { margin-top: 2rem; font-size: 0.9rem; border-style: solid; background: var(--surface); }
.dek { font-size: 1.15rem; color: var(--muted); margin: 0.6rem 0; }
.toc { margin: 1.5rem 0; padding: 1rem 1.4rem; background: var(--surface); border-radius: 6px; }
.toc ol { margin: 0.5rem 0 0; padding-left: 1.2rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.5rem 0; }
.tags a { padding: 0.2rem 0.7rem; border: 1px solid var(--line); border-radius: 999px; font-size: 0.85rem; color: var(--muted); }
.share { display: flex; flex-wrap: wrap; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0; }
.prevnext a { padding: 1rem; border: 1px solid var(--line); border-radius: 6px; color: var(--text); font-weight: 600; }
.prevnext small { display: block; color: var(--muted); font-weight: 500; }
.prevnext .next { grid-column: 2; text-align: right; }
.newsletter { margin: 3rem 0; padding: 2rem; background: var(--surface); border-radius: 6px; text-align: center; }
.newsletter form { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.newsletter input { width: min(22rem, 100%); }
@media (max-width: 720px) { .sf, .logo small.tagline { display: none; } .prevnext { grid-template-columns: 1fr; } .prevnext .next { grid-column: auto; } }
.hero { margin-bottom: 2.5rem; }
#theme { white-space: nowrap; }
