/*
Theme Name: MonkOS Flow
Theme URI: https://bikasha.org
Author: Monk Open System
Description: A quiet editorial WordPress theme for Bikasha, the publication flow of the MonkOS Signal Ecosystem.
Version: 1.2.0
Requires at least: 6.4
Requires PHP: 8.1
Text Domain: monkos-flow
*/

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

:root {
  --serif: "Inter", "Segoe UI", system-ui, sans-serif;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
  --flow-strip-height: 36px;
  --flow-header-height: 78px;
  --bg: #080b20;
  --bg-deep: #050717;
  --surface: rgb(25 31 72 / 50%);
  --surface-strong: rgb(32 40 89 / 76%);
  --text: #e7e8ef;
  --strong: #fff;
  --muted: #acb1c4;
  --quiet: #737b98;
  --line: rgb(146 157 219 / 19%);
  --line-strong: rgb(155 166 226 / 40%);
  --accent: #8d9aeb;
  --header: rgb(8 11 32 / 84%);
  --strip: rgb(5 7 23 / 94%);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f3efe5;
  --bg-deep: #e7e0d3;
  --surface: rgb(255 255 255 / 55%);
  --surface-strong: rgb(255 255 255 / 86%);
  --text: #34384b;
  --strong: #121525;
  --muted: #5f6478;
  --quiet: #7b7f8e;
  --line: rgb(45 53 104 / 14%);
  --line-strong: rgb(47 58 125 / 31%);
  --accent: #4758b7;
  --header: rgb(243 239 229 / 85%);
  --strip: rgb(231 224 211 / 95%);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--flow-strip-height) + var(--flow-header-height) + 1rem);
}

body {
  min-height: 100vh;
  margin: 0;
  padding-top: calc(var(--flow-strip-height) + var(--flow-header-height));
  background:
    radial-gradient(circle at 75% 7%, rgb(64 76 166 / 25%), transparent 34rem),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  color: var(--text);
  font-family: var(--sans);
  text-rendering: optimizelegibility;
}

a {
  color: inherit;
}

button {
  font: inherit;
}

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

::selection {
  background: var(--accent);
  color: var(--bg-deep);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.screen-reader-text,
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
}

.skip-link:focus {
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  width: auto;
  height: auto;
  padding: 0.8rem 1rem;
  clip: auto;
  background: var(--bg);
}

.flow-strip {
  position: fixed;
  z-index: 120;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  min-height: var(--flow-strip-height);
  padding: 0 4vw;
  align-items: center;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
  background: var(--strip);
  backdrop-filter: blur(18px);
}

.flow-strip-home {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-decoration: none;
  text-transform: uppercase;
}

.flow-strip nav {
  display: flex;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(0.65rem, 1.6vw, 1.6rem);
  scrollbar-width: none;
}

.flow-strip nav::-webkit-scrollbar {
  display: none;
}

.flow-strip nav a {
  padding: 0.7rem 0;
  color: var(--quiet);
  font-size: 0.57rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.flow-strip nav a:hover,
.flow-strip nav a[aria-current="page"] {
  color: var(--strong);
}

.flow-header {
  position: fixed;
  z-index: 110;
  top: var(--flow-strip-height);
  right: 0;
  left: 0;
  display: flex;
  min-height: var(--flow-header-height);
  padding: 0 4vw;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--header);
  backdrop-filter: blur(20px);
}

.flow-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--strong);
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 500;
  text-decoration: none;
}

.flow-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.flow-brand em {
  color: var(--accent);
  font-weight: 400;
}

.flow-header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.flow-header-actions a,
.theme-toggle {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-decoration: none;
  text-transform: uppercase;
}

.flow-shell {
  width: min(1400px, 92vw);
  margin: 0 auto;
}

.flow-hero {
  display: grid;
  min-height: calc(82svh - 114px);
  padding: clamp(5rem, 9vw, 9rem) 0;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr);
  align-items: center;
  gap: 6vw;
}

.kicker {
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.flow-hero h1,
.archive-title,
.single-header h1,
.page-header h1 {
  margin: 0;
  color: var(--strong);
  font-family: var(--serif);
  font-size: clamp(3rem, 5.35vw, 5.85rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.flow-hero h1 em {
  color: var(--accent);
  font-weight: 400;
}

.lead {
  max-width: 48rem;
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: clamp(1.02rem, 1.45vw, 1.3rem);
  font-weight: 300;
  line-height: 1.8;
}

.signal-orbit {
  position: relative;
  display: grid;
  width: min(36vw, 460px);
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  box-shadow: 0 0 100px rgb(67 79 178 / 23%);
}

.signal-orbit::before,
.signal-orbit::after {
  content: "";
  position: absolute;
  inset: 13%;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.signal-orbit::after {
  inset: 31%;
  background: radial-gradient(circle, rgb(125 139 232 / 27%), transparent 65%);
}

.signal-orbit span {
  z-index: 1;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 2rem;
}

.category-ribbon {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.category-ribbon a {
  min-height: 95px;
  padding: 1.25rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--strong);
  font-family: var(--serif);
  font-size: 1.15rem;
  text-decoration: none;
}

.post-section {
  padding: clamp(5rem, 9vw, 9rem) 0;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 4rem;
}

.section-heading h2 {
  margin: 0;
  color: var(--strong);
  font-family: var(--serif);
  font-size: clamp(2rem, 3.45vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.04em;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.post-card {
  position: relative;
  display: flex;
  min-height: 440px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.post-card-media {
  display: block;
  height: 180px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.post-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
  transition: opacity 300ms ease, transform 500ms ease;
}

.post-card:hover .post-card-media img {
  transform: scale(1.03);
  opacity: 0.92;
}

.post-card-signal {
  display: grid;
  height: 180px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle, rgb(125 139 232 / 22%), transparent 48%),
    linear-gradient(135deg, var(--surface), var(--bg-deep));
  color: var(--accent);
  font-family: var(--serif);
  font-size: 1.4rem;
  place-items: center;
}

.post-card-copy {
  display: flex;
  padding: 1.5rem;
  flex: 1;
  flex-direction: column;
}

.post-meta,
.post-meta a {
  color: var(--quiet);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
}

.post-card h2 {
  margin: 1rem 0 0;
  color: var(--strong);
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.12;
}

.post-card h2 a {
  text-decoration: none;
}

.post-card .excerpt {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 300;
  line-height: 1.7;
}

.read-more {
  margin-top: auto;
  padding-top: 1.6rem;
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.pagination {
  margin-top: 3rem;
}

.pagination .nav-links {
  display: flex;
  gap: 0.5rem;
}

.pagination a,
.pagination span {
  display: grid;
  min-width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.7rem;
  text-decoration: none;
  place-items: center;
}

.pagination .current {
  border-color: var(--accent);
  color: var(--strong);
}

.archive-header,
.single-header,
.page-header {
  padding: clamp(5rem, 9vw, 9rem) 0;
  border-bottom: 1px solid var(--line);
}

.archive-title,
.single-header h1,
.page-header h1 {
  max-width: 1050px;
  font-size: clamp(2.8rem, 5vw, 5.4rem);
}

.single-article,
.page-article {
  width: min(1160px, 92vw);
  margin: 0 auto;
}

.single-layout {
  display: grid;
  padding: clamp(4rem, 8vw, 8rem) 0;
  grid-template-columns: minmax(140px, 0.22fr) minmax(0, 0.78fr);
  gap: clamp(2rem, 6vw, 6rem);
}

.single-aside {
  color: var(--quiet);
  font-size: 0.65rem;
  line-height: 1.8;
}

.single-aside a {
  color: var(--accent);
  text-decoration: none;
}

.single-content {
  width: min(760px, 100%);
}

.single-content,
.single-content p,
.single-content li {
  color: var(--muted);
  font-size: 1.03rem;
  font-weight: 300;
  line-height: 1.92;
}

.single-content p {
  margin: 0 0 1.5rem;
}

.single-content h2,
.single-content h3 {
  margin: 3.5rem 0 1.3rem;
  color: var(--strong);
  font-family: var(--serif);
  font-weight: 600;
}

.single-content h2 {
  font-size: clamp(2rem, 3.5vw, 3.2rem);
}

.single-content h3 {
  font-size: 1.7rem;
}

.single-content blockquote {
  margin: 3rem 0;
  padding: 1.5rem 0 1.5rem 2rem;
  border-left: 1px solid var(--accent);
  color: var(--strong);
  font-family: var(--serif);
  font-size: 1.5rem;
}

.single-content figure {
  margin: 3rem 0;
}

.editorial-note {
  width: min(760px, 100%);
  margin: 0 0 clamp(4rem, 8vw, 8rem) auto;
  padding: 2rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.editorial-note strong {
  color: var(--accent);
  font-size: 0.64rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.editorial-note p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 300;
  line-height: 1.7;
}

.empty-flow {
  padding: 4rem;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
}

.empty-flow h2 {
  color: var(--strong);
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 400;
}

.empty-flow p {
  color: var(--muted);
}

.flow-footer {
  display: flex;
  min-height: 160px;
  padding: 2.4rem 4vw;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  border-top: 1px solid var(--line);
  color: var(--quiet);
  font-size: 0.65rem;
}

.flow-footer p {
  margin: 0;
}

.flow-footer em {
  color: var(--text);
  font-style: normal;
}

.flow-footer a {
  color: var(--accent);
  text-decoration: none;
}

@media (max-width: 980px) {
  .flow-strip {
    overflow-x: auto;
  }

  .flow-strip nav {
    width: max-content;
    justify-content: flex-start;
  }

  .flow-hero {
    grid-template-columns: 1fr;
  }

  .signal-orbit {
    width: min(62vw, 410px);
  }

  .post-grid,
  .category-ribbon {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  :root {
    --flow-header-height: 68px;
  }

  .flow-header {
    min-height: var(--flow-header-height);
  }

  .flow-header-actions > a {
    display: none;
  }

  .flow-hero h1,
  .archive-title,
  .single-header h1,
  .page-header h1 {
    font-size: clamp(2.45rem, 11.5vw, 3.7rem);
  }

  .post-grid,
  .category-ribbon {
    grid-template-columns: 1fr;
  }

  .single-layout {
    grid-template-columns: 1fr;
  }

  .flow-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}
