/* ============================================================
   landonwisely.com -- minimalist full-bleed media site
   Inspiration: Pitchfork longform, NYT features, Frank Chimero,
   Ghost reading view. Photo-forward, type-led, restrained motion.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --bg: #0a0a0a;
  --fg: #ededed;
  --muted: #8b8b8b;
  --rule: #1c1c1c;

  --card-bg: rgba(10, 10, 10, 0.10);
  --card-fg: #f4f4f5;
  --card-muted: #b4b4b4;
  --card-rule: rgba(255, 255, 255, 0.08);
  --card-highlight: rgba(255, 255, 255, 0.05);
  --card-shade: rgba(0, 0, 0, 0.15);

  --blur: 32px;
  --sat: 1.6;

  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Fraunces", ui-serif, "New York", "Iowan Old Style", "Apple Garamond", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  --measure: 38rem;
  --measure-post: 42rem;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 360ms;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fafaf9;
    --fg: #18181b;
    --muted: #71717a;
    --rule: #e7e5e4;

    --card-bg: rgba(255, 255, 255, 0.18);
    --card-fg: #0a0a0a;
    --card-muted: #3f3f46;
    --card-rule: rgba(0, 0, 0, 0.08);
    --card-highlight: rgba(255, 255, 255, 0.42);
    --card-shade: rgba(0, 0, 0, 0.05);
  }
}

/* ---------- Fonts ---------- */
@font-face {
  font-family: "Inter";
  src: url("/fonts/InterVariable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/Fraunces.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Reset + base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-feature-settings: "ss01", "cv11";
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

a, a:visited {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in oklab, currentColor 30%, transparent);
  transition: text-decoration-color var(--dur) var(--ease), color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 1px;
}

.skip {
  position: absolute;
  left: -9999px;
  z-index: 100;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--bg);
  color: var(--fg);
  padding: 0.5rem 0.75rem;
  border: 1px solid currentColor;
  text-decoration: none;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout ---------- */
main {
  flex: 1;
  width: 100%;
  max-width: var(--measure-post);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 2rem;
}

.is-index main {
  max-width: var(--measure);
  padding-top: 6rem;
}


/* ---------- Post: full-bleed background ---------- */
.is-post { background: var(--bg); }

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-position: center;
  background-attachment: scroll;
  isolation: isolate;
}

/* Subtle grain (CSP-safe: data:image/svg+xml allowed under img-src) */
.bg::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Vignette: depth at edges, subtle so image still reads */
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 35%, transparent 35%, rgba(0,0,0,0.45) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 75%, rgba(0,0,0,0.30) 100%);
}

@media (prefers-color-scheme: light) {
  .bg::after {
    background:
      radial-gradient(120% 90% at 50% 35%, transparent 40%, rgba(0,0,0,0.28) 100%),
      linear-gradient(180deg, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 75%, rgba(0,0,0,0.18) 100%);
  }
}

/* ---------- Card ---------- */
.card {
  background: var(--card-bg);
  color: var(--card-fg);
  padding: 2.5rem 2rem 2.25rem;
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  border: 1px solid var(--card-rule);
  box-shadow:
    inset 0 1px 0 var(--card-highlight),
    inset 0 -1px 0 var(--card-shade),
    0 30px 60px -30px rgba(0,0,0,0.4);
  animation: rise var(--dur) var(--ease) both;
}

.card header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--card-rule);
}

.card h1 {
  margin: 0 0 0.6rem;
  font-family: var(--display);
  font-size: clamp(2.125rem, 5.5vw, 3.75rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  font-weight: 800;
  font-variation-settings: "opsz" 96, "SOFT" 30, "WONK" 0;
  text-wrap: balance;
}

.card time {
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--card-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Prose ---------- */
.prose {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--card-fg);
  text-wrap: pretty;
}
.prose > * + * { margin-top: 1em; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li + li { margin-top: 0.25rem; }
.prose code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: color-mix(in oklab, currentColor 12%, transparent);
  padding: 0.08em 0.4em;
  border-radius: 3px;
}
.prose pre {
  background: rgba(0,0,0,0.55);
  color: #f4f4f5;
  padding: 1rem 1.1rem;
  overflow: auto;
  font-size: 0.92em;
  line-height: 1.55;
}
.prose pre code { background: transparent; padding: 0; }
.prose blockquote {
  border-left: 2px solid var(--card-muted);
  padding-left: 1.1rem;
  color: var(--card-muted);
  font-style: italic;
}
.prose h2, .prose h3 {
  font-family: var(--display);
  text-wrap: balance;
  letter-spacing: -0.02em;
}
.prose h2 {
  font-size: 1.625rem;
  font-weight: 700;
  font-variation-settings: "opsz" 36, "SOFT" 30, "WONK" 0;
  margin-top: 1.75em;
  margin-bottom: 0.4em;
  line-height: 1.15;
}
.prose h3 {
  font-size: 1.25rem;
  font-weight: 650;
  font-variation-settings: "opsz" 24, "SOFT" 30, "WONK" 0;
  margin-top: 1.4em;
  margin-bottom: 0.35em;
  line-height: 1.25;
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--card-rule);
  margin: 1.75em auto;
  width: 4rem;
}
.prose a, .prose a:visited {
  text-decoration-color: color-mix(in oklab, currentColor 55%, transparent);
}

/* ---------- Post nav (just arrows) ---------- */
.post-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding: 0.75rem 1.75rem;
  background: var(--card-bg);
  color: var(--card-fg);
  font-family: var(--mono);
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  border: 1px solid var(--card-rule);
  box-shadow:
    inset 0 1px 0 var(--card-highlight),
    inset 0 -1px 0 var(--card-shade);
  animation: rise var(--dur) var(--ease) both;
  animation-delay: 80ms;
}
.post-nav a, .post-nav span {
  display: inline-block;
  min-width: 1.5rem;
  font-size: 1.5rem;
  line-height: 1;
  text-align: center;
}
.post-nav a {
  text-decoration: none;
  color: var(--card-fg);
  padding: 0.25rem 0.5rem;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.post-nav a:hover { opacity: 0.65; }
.post-nav .prev:hover { transform: translateX(-3px); }
.post-nav .next:hover { transform: translateX(3px); }

/* ---------- Footer ---------- */
.is-post main { padding-bottom: 0.75rem; }

footer {
  width: 100%;
  max-width: calc(var(--measure-post) - 3rem);
  margin: 0 auto 2rem;
  padding: 0.5rem 1.75rem;
  color: #000;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  background: var(--card-bg);
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  border: 1px solid var(--card-rule);
  box-shadow:
    inset 0 1px 0 var(--card-highlight),
    inset 0 -1px 0 var(--card-shade);
  animation: rise var(--dur) var(--ease) both;
  animation-delay: 160ms;
}
footer a, footer a:visited {
  color: #000;
  text-decoration-color: color-mix(in oklab, currentColor 25%, transparent);
}
footer a:hover { text-decoration-color: currentColor; }

/* ---------- Sisyphus (right side of the footer) ---------- */
.sisyphus-anim {
  pointer-events: none;
  user-select: none;
  color: #000;
  display: block;
  height: 2.25rem;
  flex: 0 1 auto;
}
.sisyphus-anim svg { height: 100%; width: auto; display: block; }

.sa-ink {
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sa-thin { stroke-width: 1.5; }

.sa-sis-tr { animation: sa-sis-tr 12s infinite; }
@keyframes sa-sis-tr {
  0%   { transform: translate(0, 0); animation-timing-function: cubic-bezier(0.4, 0, 0.7, 1); }
  65%  { transform: translate(480px, -42px); }
  78%  { transform: translate(480px, -42px); animation-timing-function: ease-in; }
  88%  { transform: translate(0, 0); }
  100% { transform: translate(0, 0); }
}

.sa-sis-sq {
  transform-origin: 80px 215px;
  animation: sa-sis-sq 12s infinite;
}
@keyframes sa-sis-sq {
  0%   { transform: scaleY(1); }
  72%  { transform: scaleY(1); animation-timing-function: cubic-bezier(0.2, 0.9, 0.3, 1); }
  73%  { transform: scaleY(0.05); }
  74%  { transform: scaleY(0.15); }
  88%  { transform: scaleY(0.15); animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }
  92%  { transform: scaleY(1); }
  100% { transform: scaleY(1); }
}

.sa-bld-tr { animation: sa-bld-tr 12s infinite; }
@keyframes sa-bld-tr {
  0%   { transform: translate(0, 0); animation-timing-function: cubic-bezier(0.4, 0, 0.7, 1); }
  65%  { transform: translate(480px, -42px); }
  72%  { transform: translate(480px, -42px); animation-timing-function: cubic-bezier(0.5, 0, 0.6, 1); }
  78%  { transform: translate(0, 0); }
  100% { transform: translate(0, 0); }
}

.sa-bld-roll {
  transform-origin: 60px 167px;
  animation: sa-bld-roll 12s infinite;
}
@keyframes sa-bld-roll {
  0%   { transform: rotate(0deg); animation-timing-function: cubic-bezier(0.4, 0, 0.7, 1); }
  65%  { transform: rotate(900deg); }
  72%  { transform: rotate(900deg); animation-timing-function: cubic-bezier(0.5, 0, 0.6, 1); }
  78%  { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.sa-bob { animation: sa-bob 0.45s ease-in-out infinite alternate; }
@keyframes sa-bob { to { transform: translateY(-3px); } }

.sa-leg-a {
  transform-origin: 0 0;
  animation: sa-stride 0.55s ease-in-out infinite;
}
.sa-leg-b {
  transform-origin: 0 0;
  animation: sa-stride 0.55s ease-in-out infinite;
  animation-delay: -0.275s;
}
@keyframes sa-stride {
  0%, 100% { transform: rotate(-25deg); }
  50%      { transform: rotate(22deg); }
}

/* ---------- Motion ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

/* ---------- Cross-document view transitions (Chrome / Safari) ---------- */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 240ms;
  animation-timing-function: var(--ease);
}

/* ---------- Mobile ---------- */
@media (max-width: 32rem) {
  main { padding: 3rem 1.25rem 1.5rem; }
  .is-index main { padding-top: 4rem; }

  .masthead { margin-bottom: 2rem; }

  .card { padding: 1.75rem 1.25rem 1.5rem; }
  .card header { margin-bottom: 1.25rem; padding-bottom: 1rem; }

  .post-nav {
    padding: 0.75rem 1.25rem;
  }

  footer {
    padding: 0.9rem 1.25rem;
    margin-inline: 1.25rem;
    max-width: calc(100% - 2.5rem);
  }
}

@media (max-width: 42rem) and (min-width: 32.001rem) {
  footer {
    margin-inline: 1.5rem;
    max-width: calc(100% - 3rem);
  }
}

/* ---------- Print ---------- */
@media print {
  .bg, .post-nav, .skip { display: none; }
  body { background: white; color: black; font-size: 11pt; }
  main { padding: 0; max-width: none; }
  .card {
    background: white;
    color: black;
    box-shadow: none;
    border: 0;
    padding: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    animation: none;
  }
  footer { color: #666; }
}
