@import "tailwindcss";
@plugin "@tailwindcss/typography";

.prose code::before,
.prose code::after {
  content: "" !important;
}

@theme {
  --font-sans: var(--font-instrument-sans);
  --font-mono: var(--font-ibm-plex-mono);

  --color-paper: #f6f7f3;
  --color-paper-strong: #fffefa;
  --color-paper-overlay: rgba(246, 247, 243, 0.94);
  --color-ink: #151718;
  --color-ink-soft: #28302f;
  --color-muted: #596461;
  --color-muted-strong: #6f7a76;
  --color-line: rgba(21, 23, 24, 0.12);
  --color-line-strong: rgba(21, 23, 24, 0.22);
  --color-accent: #176b5d;
  --color-accent-soft: rgba(23, 107, 93, 0.12);

  --animate-fade-in: fade-in 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  --animate-fade-up: fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;

  @keyframes fade-in {
    from {
      opacity: 0.82;
      transform: translateY(4px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes fade-up {
    from {
      opacity: 0.7;
      transform: translateY(8px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

:root {
  color-scheme: light;
  --background: var(--color-paper);
  --foreground: var(--color-ink);
  --page-wash: rgba(23, 107, 93, 0.08);
  --page-shadow: rgba(255, 255, 255, 0.24);
  --grain-opacity: 0.03;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #111315;
  --foreground: #eff4ef;
  --color-paper: #111315;
  --color-paper-strong: #181c1d;
  --color-paper-overlay: rgba(17, 19, 21, 0.94);
  --color-ink: #eff4ef;
  --color-ink-soft: #d9e2dc;
  --color-muted: #aab7b1;
  --color-muted-strong: #c2d0c9;
  --color-line: rgba(239, 244, 239, 0.12);
  --color-line-strong: rgba(239, 244, 239, 0.22);
  --color-accent: #7bc7b5;
  --color-accent-soft: rgba(123, 199, 181, 0.16);
  --page-wash: rgba(88, 161, 172, 0.1);
  --page-shadow: rgba(255, 255, 255, 0.02);
  --grain-opacity: 0.055;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #111315;
    --foreground: #eff4ef;
    --color-paper: #111315;
    --color-paper-strong: #181c1d;
    --color-paper-overlay: rgba(17, 19, 21, 0.94);
    --color-ink: #eff4ef;
    --color-ink-soft: #d9e2dc;
    --color-muted: #aab7b1;
    --color-muted-strong: #c2d0c9;
    --color-line: rgba(239, 244, 239, 0.12);
    --color-line-strong: rgba(239, 244, 239, 0.22);
    --color-accent: #7bc7b5;
    --color-accent-soft: rgba(123, 199, 181, 0.16);
    --page-wash: rgba(88, 161, 172, 0.1);
    --page-shadow: rgba(255, 255, 255, 0.02);
    --grain-opacity: 0.055;
  }
}

html {
  scroll-behavior: smooth;
  background: var(--background);
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans), sans-serif;
  min-height: 100vh;
  position: relative;
  background-image: linear-gradient(180deg, var(--page-shadow), transparent 28%);
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
}

h1, h2, h3, h4, h5, h6 {
  letter-spacing: 0;
}

body::before,
body::after {
  content: "";
  inset: 0;
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: var(--grain-opacity);
}

body::after {
  background:
    radial-gradient(60rem 24rem at 50% -8%, var(--page-wash), transparent 70%),
    radial-gradient(24rem 18rem at 0% 0%, rgba(63, 92, 120, 0.03), transparent 74%);
  opacity: 1;
}

::selection {
  background: rgba(141, 106, 66, 0.18);
  color: var(--foreground);
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid rgba(141, 106, 66, 0.5);
  outline-offset: 4px;
}

.site-shell {
  position: relative;
  z-index: 10;
}

.page-frame {
  margin: 0 auto;
  max-width: 84rem;
  padding-inline: clamp(1.25rem, 3vw, 2.5rem);
}

.eyebrow {
  color: var(--color-muted-strong);
  font-family: var(--font-mono), monospace;
  font-size: 0.68rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ambient-canvas {
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: 0;
}

.ambient-canvas__wash {
  inset: 0;
  position: absolute;
  background-image:
    radial-gradient(68rem 28rem at 50% -10%, var(--page-wash), transparent 72%),
    radial-gradient(40rem 24rem at 100% 0%, rgba(63, 92, 120, 0.05), transparent 76%);
  opacity: 0.9;
}

.theme-toggle {
  position: relative;
}

.theme-toggle__sun,
.theme-toggle__moon {
  position: absolute;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.theme-toggle__moon {
  opacity: 0;
  transform: scale(0.8);
}

:root[data-theme="dark"] .theme-toggle__sun {
  opacity: 0;
  transform: scale(0.8);
}

:root[data-theme="dark"] .theme-toggle__moon {
  opacity: 1;
  transform: scale(1);
}

.essay-prose {
  color: var(--color-ink-soft);
  font-size: 1.04rem;
  line-height: 1.85;
}

.essay-prose > :first-child {
  margin-top: 0;
}

.essay-prose > :last-child {
  margin-bottom: 0;
}

.essay-prose img {
  display: block;
  height: auto;
  margin-block: 2.25rem;
  max-width: 100%;
  border: 1px solid var(--color-line);
  border-radius: 0.75rem;
  background: var(--color-paper-strong);
}

.essay-prose pre code,
.essay-prose code[data-language] {
  background: transparent;
  padding: 0;
}

.side-note {
  display: block;
  margin-block: 1.6rem;
  border-left: 1px solid var(--color-line-strong);
  padding-left: 0.95rem;
  color: var(--color-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.side-note strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--color-ink);
  font-weight: 600;
}

.graph-project {
  --graph-paper: #f4f1e8;
  --graph-panel: #fffdf6;
  --graph-ink: #161512;
  --graph-soft: #39362d;
  --graph-muted: #6d675a;
  --graph-line: rgba(22, 21, 18, 0.16);
  --graph-accent: #0f6f77;
  --graph-accent-strong: #0c4f58;
  --graph-warm: #e28f45;
  --graph-code: #171813;
  --graph-code-text: #f2ead9;
  background:
    linear-gradient(90deg, rgba(22, 21, 18, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(22, 21, 18, 0.035) 1px, transparent 1px),
    var(--graph-paper);
  background-size: 4.5rem 4.5rem;
  color: var(--graph-ink);
}

:root[data-theme="dark"] .graph-project {
  --graph-paper: #111315;
  --graph-panel: #181c1d;
  --graph-ink: #f5f0e6;
  --graph-soft: #ddd5c5;
  --graph-muted: #a9a091;
  --graph-line: rgba(245, 240, 230, 0.15);
  --graph-accent: #78c7cf;
  --graph-accent-strong: #93dbe2;
  --graph-warm: #e3a15f;
  --graph-code: #0d0f10;
  --graph-code-text: #f5f0e6;
}

.graph-project .text-graph-ink {
  color: var(--graph-ink);
}

.graph-project .text-graph-soft {
  color: var(--graph-soft);
}

.graph-project .text-graph-muted {
  color: var(--graph-muted);
}

.graph-project .text-graph-accent {
  color: var(--graph-accent);
}

.graph-project .text-graph-code-text {
  color: var(--graph-code-text);
}

.graph-project .bg-graph-paper {
  background-color: var(--graph-paper);
}

.graph-project .bg-graph-panel {
  background-color: var(--graph-panel);
}

.graph-project .bg-graph-line {
  background-color: var(--graph-line);
}

.graph-project .bg-graph-code {
  background-color: var(--graph-code);
}

.graph-project .border-graph-line {
  border-color: var(--graph-line);
}

.graph-project .bg-graph-accent {
  background-color: var(--graph-accent);
}

.graph-project .hover\:text-graph-accent:hover {
  color: var(--graph-accent);
}

.graph-project .hover\:border-graph-accent:hover {
  border-color: var(--graph-accent);
}

.graph-hero {
  background:
    radial-gradient(42rem 24rem at 16% 18%, rgba(226, 143, 69, 0.18), transparent 70%),
    radial-gradient(38rem 24rem at 82% 10%, rgba(15, 111, 119, 0.16), transparent 72%);
}

.graph-hero-card {
  overflow: hidden;
  border: 1px solid var(--graph-line);
  border-radius: 0.5rem;
  background: var(--graph-panel);
  box-shadow: 0 34px 80px rgba(22, 21, 18, 0.12);
}

.graph-card-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--graph-line);
  padding: 0.85rem 1rem;
  color: var(--graph-muted);
  font-family: var(--font-mono), monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.graph-matrix {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: min(17rem, 58vw);
  overflow: hidden;
  border: 1px solid var(--graph-line);
  background: #202f33;
}

.graph-matrix span {
  aspect-ratio: 1;
  border-right: 1px solid rgba(244, 241, 232, 0.14);
  border-bottom: 1px solid rgba(244, 241, 232, 0.14);
  background: #275b63;
}

.graph-matrix span.is-hot {
  background: #f0d83a;
}

.graph-kicker {
  color: var(--graph-muted);
  font-family: var(--font-mono), monospace;
  font-size: 0.72rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

@media (min-width: 1280px) {
  .side-note {
    float: right;
    clear: right;
    width: 12rem;
    margin-top: 0.25rem;
    margin-right: -14rem;
    margin-bottom: 1.5rem;
    margin-left: 1.75rem;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
