/* NeuralKoi editorial theme */

/* Design tokens */
:root {
  color-scheme: light;
  --page: #eef2f3;
  --surface: #fff;
  --surface-raised: #f3f6f7;
  --text: #182327;
  --heading: #11191c;
  --copy: #2e3a3f;
  --lede: #3f4c52;
  --nav-text: #3d4b51;
  --post-title: #182327;
  --muted: #526169;
  --faint: #67767d;
  --line: #cbd5d9;
  --line-soft: #e1e7e9;
  --cyan: #007a99;
  --cyan-soft: #005f78;
  --coral: #b83e39;
  --koi-filter: drop-shadow(0 3px 4px rgba(32, 52, 58, 0.24));
  --brand-mark-filter: drop-shadow(0 0 0.75px rgba(24, 32, 36, 0.95));
  --header-shadow: 0 18px 55px rgba(25, 38, 44, 0.13);
  --content-shadow: 0 30px 80px rgba(25, 38, 44, 0.16);
  --code-text: #18383f;
  --code-background: #edf4f5;
  --code-border: #c9dadd;
  --pre-background: #f5f7f8;
  --shell: min(1040px, calc(100vw - 32px));
  --measure: 810px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #050607;
    --surface: #0d0f10;
    --surface-raised: #141719;
    --text: #f1f3f4;
    --heading: #fff;
    --copy: #d9dddf;
    --lede: #c3c8cb;
    --nav-text: #c8cdd0;
    --post-title: #edf0f1;
    --muted: #9aa2a7;
    --faint: #6f777c;
    --line: #292e31;
    --line-soft: #1d2124;
    --cyan: #10bce8;
    --cyan-soft: #7de0f8;
    --coral: #ff5c57;
    --koi-filter: none;
    --brand-mark-filter: none;
    --header-shadow: 0 18px 55px rgba(0, 0, 0, 0.42);
    --content-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    --code-text: #e9f8fc;
    --code-background: #171b1d;
    --code-border: #262c2f;
    --pre-background: #080a0b;
  }
}

/* Base */

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

html {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 40px 0 72px;
  overflow-x: hidden;
  color: var(--text);
  background: var(--page);
  font-family: "Work Sans", Arial, Helvetica, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  text-align: left;
}

.koi-canvas {
  position: fixed !important;
  inset: 0 !important;
  z-index: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  filter: var(--koi-filter);
  opacity: 1;
  pointer-events: none;
}

body.koi-fade .koi-canvas {
  animation: koi-fade-out 3s linear forwards;
  will-change: opacity;
}

@keyframes koi-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  body.koi-fade .koi-canvas {
    animation-duration: 1ms;
  }
}

a {
  color: var(--cyan);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--cyan-soft);
}

a:focus-visible {
  outline: 2px solid var(--cyan-soft);
  outline-offset: 4px;
  border-radius: 2px;
}

img,
iframe {
  max-width: 100%;
}

/* Page shell */

#site-header,
#content {
  position: relative;
  z-index: 1;
  width: var(--shell);
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--line);
}

#site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-height: 132px;
  padding: 24px 34px;
  border-bottom-color: var(--line-soft);
  border-radius: 10px 10px 0 0;
  box-shadow: var(--header-shadow);
}

#content {
  margin-top: -1px;
  margin-bottom: 0;
  padding: 0;
  border-radius: 0 0 10px 10px;
  box-shadow: var(--content-shadow);
}

/* Brand and navigation */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 56px;
  height: 70px;
  flex: 0 0 auto;
  filter: var(--brand-mark-filter);
  object-fit: contain;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.brand-name {
  display: block;
  font-size: 2.55rem;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-primary {
  color: #01bed3;
}

.brand-secondary {
  color: var(--heading);
}

.brand-tagline {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  text-align: right;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li {
  margin: 0;
}

.site-nav a {
  position: relative;
  display: block;
  padding: 10px 0;
  color: var(--nav-text);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.site-nav a::after {
  position: absolute;
  right: 0;
  bottom: 3px;
  left: 0;
  height: 2px;
  content: "";
  background: var(--cyan);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 160ms ease;
}

.site-nav a:hover {
  color: var(--heading);
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Reading surface */

#entry {
  width: 100%;
  min-height: 380px;
  padding: 64px clamp(32px, 8vw, 92px) 72px;
  overflow: hidden;
  background: var(--surface);
}

#entry > * {
  width: min(100%, var(--measure));
  margin-inline: auto;
}

#entry.home-entry > * {
  width: 100%;
}

.entry-header {
  margin-bottom: 42px;
}

.neural-tide {
  width: 100%;
  margin: 14px 0 22px;
  aspect-ratio: 8 / 3;
}

.neural-tide canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--coral);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 2em 0 0.65em;
  color: var(--heading);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: 0;
}

h1 {
  margin-top: 0;
  font-size: 2rem;
}

h2 {
  font-size: 1.7rem;
}

h3 {
  font-size: 1.32rem;
}

p,
ul,
ol,
pre,
table,
figure,
blockquote {
  margin-top: 0;
  margin-bottom: 1.35em;
}

p:last-child,
blockquote:last-child {
  margin-bottom: 0;
}

p:empty {
  display: none;
}

.lede {
  max-width: 620px;
  margin: 0;
  color: var(--lede);
  font-size: 1.18rem;
  line-height: 1.65;
}

.home-entry .lede {
  max-width: none;
}

.publish-date {
  display: block;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.85rem;
}

.recent-writing {
  margin-bottom: 54px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.35rem;
}

.section-heading > a {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Post lists */

.post-list {
  border-top: 1px solid var(--line);
}

.post-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 24px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line-soft);
}

.post-title {
  color: var(--post-title);
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}

.post-title:hover {
  color: var(--cyan-soft);
}

.post-meta {
  display: flex;
  align-items: baseline;
  gap: 9px;
  color: var(--faint);
  font-size: 0.76rem;
  white-space: nowrap;
}

.post-pin {
  color: var(--coral);
  font-weight: 700;
  text-transform: uppercase;
}

/* Article content */

blockquote {
  position: relative;
  padding: 24px 26px 24px 30px;
  color: var(--copy);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--coral);
  font-style: italic;
}

cite {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
}

cite::before {
  content: "— ";
}

.article-entry > p,
.article-entry > ul,
.article-entry > ol {
  color: var(--copy);
}

.article-entry [style*="color: rgb(0, 0, 0)"] {
  color: inherit !important;
}

.article-entry a {
  text-decoration: underline;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

code {
  color: var(--code-text);
  font-size: 0.88em;
}

pre {
  max-width: 100%;
  padding: 20px;
  overflow-x: auto;
  background: var(--pre-background);
  border: 1px solid var(--line);
  border-radius: 4px;
}

pre code {
  padding: 0;
  background: transparent;
  border: 0;
}

#entry.article-entry p.image-caption {
  margin-top: -0.75rem;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  text-align: center;
}

#entry.article-entry img {
  max-width: 100%;
  height: auto;
  margin-bottom: 1.5rem;
}

#entry.article-entry img.image-small {
  max-width: 25%;
  max-height: 12rem;
}

#entry.article-entry img.image-medium {
  max-width: 50%;
  max-height: 18rem;
}

#entry.article-entry img.image-large {
  max-width: 100%;
  max-height: 36rem;
}

#entry.article-entry img.image-align-left {
  display: block;
  margin-left: 0;
  margin-right: auto;
}

#entry.article-entry img.image-align-center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#entry.article-entry img.image-align-right {
  display: block;
  margin-left: auto;
  margin-right: 0;
}

hr {
  margin: 3rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.youtube-embed {
  width: min(100%, var(--measure));
  margin: 54px auto 0;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--line);
}

.youtube-embed iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--line);
}

footer,
#footer {
  color: var(--muted);
}

/* Responsive */

@media (max-width: 760px) {
  body {
    padding-top: 16px;
    font-size: 16px;
  }

  #site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    padding: 22px 24px 18px;
  }

  .brand-mark {
    width: 45px;
    height: 60px;
  }

  .brand-name {
    font-size: 2.15rem;
  }

  .site-nav {
    width: 100%;
    padding-top: 10px;
    border-top: 1px solid var(--line-soft);
  }

  .site-nav ul {
    justify-content: space-between;
    gap: 14px;
  }

  #entry {
    padding: 44px 24px 52px;
  }

  .entry-header {
    margin-bottom: 34px;
  }

  .post-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

@media (max-width: 420px) {
  :root {
    --shell: calc(100vw - 20px);
  }

  .site-nav ul {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 4px 20px;
  }

  .site-nav a {
    padding-block: 8px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

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