/* ---------- tokens ---------- */

:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --ink: #0e0e12;
  --ink-soft: #63636b;
  --line: #e7e5df;
  --accent: #ff4b2b;
  --accent-2: #3d5afe;
  --accent-soft: #ffe8e0;
  --code-bg: #f1efe9;
  --shadow: 0 1px 2px rgba(14, 14, 18, 0.06);

  --font-display: "Familjen Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Work Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0d;
    --surface: #131318;
    --ink: #f3f2ef;
    --ink-soft: #9d9da7;
    --line: #232329;
    --accent: #ff6a45;
    --accent-2: #7c8cff;
    --accent-soft: #2a1610;
    --code-bg: #17171d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  --bg: #0a0a0d;
  --surface: #131318;
  --ink: #f3f2ef;
  --ink-soft: #9d9da7;
  --line: #232329;
  --accent: #ff6a45;
  --accent-2: #7c8cff;
  --accent-soft: #2a1610;
  --code-bg: #17171d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ---------- reset ---------- */

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

html {
  color-scheme: light dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a {
  color: inherit;
}

::selection {
  background: var(--accent);
  color: #fff;
}

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

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

.shell {
  max-width: 56rem;
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.shell--article {
  max-width: 42rem;
}

/* ---------- cursor glow ---------- */

.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(
    480px circle at var(--x, 50%) var(--y, 20%),
    color-mix(in srgb, var(--accent) 14%, transparent),
    transparent 70%
  );
}

.glow.is-active {
  opacity: 1;
}

/* ---------- bar ---------- */

.bar {
  position: relative;
  z-index: 2;
  border-bottom: 1px solid var(--line);
  padding-block: 1.1rem;
}

.bar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.mark__dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.nav__links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.nav__links a {
  position: relative;
  text-decoration: none;
  color: var(--ink-soft);
  display: inline-block;
  padding-bottom: 2px;
}

.nav__links a span {
  position: relative;
}

.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.25s var(--ease);
}

.nav__links a:hover {
  color: var(--ink);
}

.nav__links a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.bar__controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.knob {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s var(--ease), color 0.15s ease, border-color 0.15s ease;
}

.knob:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(-8deg) scale(1.05);
}

.knob .icon-moon {
  display: block;
}
.knob .icon-sun {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .knob .icon-moon {
    display: none;
  }
  :root:not([data-theme="light"]) .knob .icon-sun {
    display: block;
  }
}
:root[data-theme="dark"] .knob .icon-moon {
  display: none;
}
:root[data-theme="dark"] .knob .icon-sun {
  display: block;
}

.knob--menu {
  display: none;
}

@media (max-width: 640px) {
  .nav__links {
    display: none;
  }
  .knob--menu {
    display: inline-flex;
  }
  .nav--open .nav__links {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 0.75rem var(--gutter) 1.1rem;
  }
  .nav--open .nav__links a {
    display: block;
    padding: 0.65rem 0;
  }
  .bar__row {
    position: relative;
  }
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  z-index: 1;
  padding-block: clamp(3rem, 10vw, 6rem) clamp(2rem, 6vw, 3rem);
  overflow: hidden;
}

.hero--compact {
  padding-block: clamp(2.5rem, 7vw, 4rem) 1.75rem;
}

.hero--article {
  padding-block: clamp(2.25rem, 6vw, 3.5rem) 1.5rem;
}

.hero__kicker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 auto 1.1rem;
  max-width: 56rem;
  padding-inline: var(--gutter);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
}

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

.hero__kicker a:hover {
  text-decoration: underline;
}

.hero__avatar {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}

.hero__title {
  margin: 0 auto;
  max-width: 56rem;
  padding-inline: var(--gutter);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.02;
  font-size: clamp(2.4rem, 8vw, 4.75rem);
  max-width: 20ch;
}

.hero--compact .hero__title,
.hero--article .hero__title {
  font-size: clamp(2rem, 6vw, 3.25rem);
}

.hero__lede {
  margin: 1.1rem auto 0;
  max-width: 40rem;
  padding-inline: var(--gutter);
  color: var(--ink-soft);
  font-size: 1.15rem;
}

[data-split] {
  animation: reveal-up 0.7s var(--ease) both;
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(0.6em);
    clip-path: inset(0 0 100% 0);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    clip-path: inset(0 0 0% 0);
  }
}

/* ---------- scroll reveal ---------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
}

[data-reveal].is-visible {
  animation: rise-in 0.6s var(--ease) both;
}

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- marquee ---------- */

.marquee {
  border-block: 1px solid var(--line);
  overflow: hidden;
  background: var(--surface);
  position: relative;
  z-index: 1;
}

.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee 32s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .marquee__track {
    animation: none;
  }
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.marquee__item {
  flex: none;
  padding: 0.7rem 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--ink-soft);
  border-right: 1px solid var(--line);
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}

.marquee__item:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- index (post list) ---------- */

.index {
  list-style: none;
  margin: 0;
  padding: 2.5rem 0 4rem;
  counter-reset: none;
}

.index__row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding-block: 1.75rem;
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: transform 0.25s var(--ease);
}

.index__row:first-child {
  border-top: 1px solid var(--line);
}

.index__row:hover {
  transform: translateX(6px);
}

.index__num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  padding-top: 0.3rem;
  flex: none;
  width: 2ch;
}

.index__row--latest .index__num::after {
  content: "";
  display: block;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 0.4rem;
}

.index__body {
  flex: 1;
  min-width: 0;
}

.index__title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
}

.index__title a {
  text-decoration: none;
  color: var(--ink);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 2px;
  transition: background-size 0.25s var(--ease);
}

.index__row:hover .index__title a {
  background-size: 100% 2px;
}

.index__excerpt {
  color: var(--ink-soft);
  font-size: 0.98rem;
  margin: 0 0 0.5rem;
  max-width: 58ch;
}

.index__meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  display: flex;
  gap: 0.5em;
  align-items: baseline;
  margin: 0;
}

.index__tag {
  color: var(--accent-2);
  text-decoration: none;
}

.index__tag:hover {
  text-decoration: underline;
}

.index__dot {
  opacity: 0.5;
}

.index__thumb {
  flex: none;
  width: 6rem;
  height: 6rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform 0.25s var(--ease);
}

.index__row:hover .index__thumb {
  transform: rotate(-2deg) scale(1.03);
}

.index__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 480px) {
  .index__thumb {
    width: 4rem;
    height: 4rem;
  }
  .index__row:hover {
    transform: none;
  }
}

/* ---------- badges ---------- */

.badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.15em 0.5em;
  border-radius: 4px;
  vertical-align: middle;
}

.badge--lg {
  font-size: 0.75rem;
  padding: 0.4em 0.85em;
  margin: 0 auto 1.1rem;
  max-width: 56rem;
}

.hero--article .badge--lg {
  margin-inline: var(--gutter);
}

/* ---------- feature image ---------- */

.feature {
  margin: 2rem 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.feature img {
  width: 100%;
  max-height: 24rem;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.feature:hover img {
  transform: scale(1.03);
}

.feature--post img {
  max-height: 28rem;
}

/* ---------- prose ---------- */

.prose {
  font-size: 1.05rem;
  line-height: 1.75;
  padding-bottom: 1rem;
}

.prose > * + * {
  margin-top: 1.35em;
}

.prose h1,
.prose h2,
.prose h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-top: 2em;
}

.prose h2 {
  font-size: 1.5rem;
}

.prose h3 {
  font-size: 1.2rem;
}

.prose a {
  color: var(--accent-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.prose blockquote {
  margin: 1.75em 0;
  padding-left: 1.15em;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1.1em;
}

.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1em 1.15em;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.55;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose figure {
  margin: 0;
}

.prose figcaption {
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
  margin-top: 0.6em;
}

.prose img {
  border-radius: 10px;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 0.5em 0.7em;
  text-align: left;
}

/* ---------- chips ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}

.chip {
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35em 0.9em;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s var(--ease);
}

.chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- share / progress ---------- */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 5;
  background: transparent;
}

.progress__bar {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.1s linear;
}

.share {
  display: flex;
  gap: 0.6rem;
  margin-top: 2.5rem;
}

.share__btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  width: 2.4rem;
  height: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s var(--ease);
}

.share__btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- author ---------- */

.author {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 2rem 0 3rem;
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.author__mark {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  margin-top: 0.1rem;
}

.author__name {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.author__bio {
  margin: 0;
  max-width: 42rem;
}

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.foot__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.foot a {
  color: var(--ink-soft);
  text-decoration: none;
}

.foot a:hover {
  color: var(--accent);
}

.foot__links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
