/* ==========================================================================
   Justin Schueler — Typography-First
   ========================================================================== */

@font-face {
  font-family: 'KP Duo Sans';
  src: url('fonts/KPDuoSansTrial-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'KP Duo Sans';
  src: url('fonts/KPDuoSansTrial-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
}

@font-face {
  font-family: 'GT Sectra';
  src: url('fonts/GTSectra-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
}

:root {
  /* Fonts */
  --font-primary: 'KP Duo Sans', system-ui, -apple-system, sans-serif;
  --font-serif: 'GT Sectra', Georgia, serif;
  --font-heading: var(--font-serif);

  /* Colors */
  --color-bg: #ffffff;
  --color-text: #181818;
  --color-muted: #666666;
  --color-border: #f0f0f0;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 8rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #111111;
    --color-text: #f0f0f0;
    --color-muted: #a0a0a0;
    /* Improved contrast for accessibility */
    --color-border: #222222;
  }
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

html {
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
}

/* Layout */
main {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  /* Top, Right, Bottom (increased to clear nav), Left */
  padding: var(--space-xl) var(--space-md) calc(var(--space-xl) + 4rem) var(--space-md);
}

article {
  max-width: 540px;
  width: 100%;
}

/* Header */
h1 {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 400;
  letter-spacing: -0.02rem;
  line-height: 1.35;
}

/* Content */
.content {
  margin-bottom: var(--space-lg);
}

.content p {
  margin-bottom: var(--space-md);
}

.hero-identity {
  font-family: var(--font-primary);
  font-size: 0.875rem;
  line-height: 1.4;
  margin-bottom: var(--space-xl);
  letter-spacing: 0.01rem;
}

.hero-identity h1.name {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  margin: 0;
  display: block;
  line-height: inherit;
  color: var(--color-text);
}

.hero-identity .title {
  color: var(--color-muted);
  opacity: 0.8;
}

.hero-statement {
  margin-bottom: var(--space-xl);
}

.hero-statement p {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 8vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--color-text);
  margin-left: -8rem;
  margin-bottom: 0;
  /* Visual offset to the left */
}

.hero-statement .word {
  display: inline-block;
  color: var(--color-muted);
  animation: wordReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes wordReveal {
  from {
    color: var(--color-muted);
  }

  to {
    color: var(--color-text);
  }
}

@media (max-width: 768px) {
  .hero-statement p {
    margin-left: 0;
  }
}


.content p:last-child {
  margin-bottom: 0;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.125rem;
  padding: 0.375rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 100px;
  font-size: 0.875rem;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  z-index: 100;
  animation: nav-entrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
  opacity: 0;
  /* Ensure it starts hidden during the delay */
}

@keyframes nav-entrance {
  from {
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    filter: blur(8px);
  }

  to {
    opacity: 1;
    filter: blur(0);
  }
}

.bottom-nav {
  will-change: transform, opacity, filter;
}

@media (prefers-color-scheme: dark) {
  .bottom-nav {
    background: rgba(30, 30, 30, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
  }
}

.bottom-nav a {
  color: var(--color-muted);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 100px;
  transition: color 0.3s ease;
  position: relative;
  z-index: 2;
}

.bottom-nav a:hover {
  color: var(--color-text);
}

.bottom-nav a.active {
  color: var(--color-text);
}

.nav-pill {
  position: absolute;
  top: 0;
  left: 0;
  height: 0;
  background: var(--color-border);
  border-radius: 100px;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), width 0.4s cubic-bezier(0.16, 1, 0.3, 1), height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  z-index: 1;
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .nav-pill {
    background: rgba(255, 255, 255, 0.1);
  }
}


/* Page Header */
.page-header {
  margin-bottom: var(--space-lg);
}

.page-parent {
  font-size: 0.875rem;
  margin-bottom: var(--space-xs);
}

.page-parent a {
  color: var(--color-muted);
  text-decoration: none;
}

.page-parent a:hover {
  color: var(--color-text);
}

/* Links */
a {
  color: inherit;
  text-decoration: none;
}

.content a:not(.page-parent a),
.post-content a {
  position: relative;
  text-decoration: none;
}

.content a:not(.page-parent a)::after,
.post-content a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.125rem;
  /* Increased spacing */
  height: 1px;
  background-color: currentColor;
  opacity: 0.3;
  filter: url(#hand-drawn);
  transition: opacity 0.2s ease, height 0.2s ease;
  pointer-events: none;
  transform: translateZ(0);
  will-change: opacity, height;
}

.content a:not(.page-parent a):hover::after,
.post-content a:hover::after {
  opacity: 1;
  height: 0.125rem;
  /* 2px */
}

.copy-email {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  cursor: pointer;
  position: relative;
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.copy-email::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.125rem;
  height: 1px;
  background-color: currentColor;
  opacity: 0.3;
  filter: url(#hand-drawn);
  transition: opacity 0.2s ease, height 0.2s ease;
  pointer-events: none;
  transform: translateZ(0);
  will-change: opacity, height;
}

.copy-email:hover::after {
  opacity: 1;
  height: 0.125rem;
}

.copy-email.copied {
  opacity: 0.7;
}

/* Post */
.post-title {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.02rem;
  margin-bottom: var(--space-xs);
}

.post-meta {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.post-content {
  margin-top: var(--space-lg);
}

.post-content p {
  margin-bottom: var(--space-md);
}

.post-content p:last-child {
  margin-bottom: 0;
}

.post-content h2 {
  font-size: 1.125rem;
  font-weight: 500;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.post-content blockquote {
  position: relative;
  border-left: none;
  padding-left: var(--space-md);
  margin: var(--space-lg) 0;
}

.post-content blockquote::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 1px;
  background-color: var(--color-border);
  filter: url(#hand-drawn);
  transform: translateZ(0);
}

.post-content blockquote p {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-style: italic;
  color: var(--color-muted);
  margin-bottom: 0;
}

.post-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  background: var(--color-border);
  padding: 0.15em 0.3em;
  border-radius: 0.2rem;
}

.post-content pre {
  background: var(--color-border);
  padding: var(--space-md);
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: var(--space-lg) 0;
}

.post-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  display: block;
  line-height: 1.6;
}

/* Specialized Prompt Quote style — Refined & Rough */
.post-content .prompt-quote {
  position: relative;
  padding: 20px;
  margin: var(--space-lg) 0;
  background: none;
  border: none;
  box-shadow: none;
}

.post-content .prompt-quote::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  filter: url(#hand-drawn);
  z-index: -1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  transform: translateZ(0);
}

@media (prefers-color-scheme: dark) {
  .post-content .prompt-quote::before {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: #333;
  }
}

.post-content .prompt-quote p {
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--color-text);
  margin-bottom: 0;
}

.post-content img,
.post-content video {
  max-width: 100%;
  height: auto;
  margin: var(--space-md) 0;
  border-radius: 0.25rem;
  /* 4px */
}

.post-content iframe {
  max-width: 100%;
  margin: var(--space-md) 0;
  border: none;
  border-radius: 0.25rem;
  /* 4px */
}

/* How I Work */
.how-i-work {
  margin: var(--space-xl) 0;
  position: relative;
}

.how-i-work h2 {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-md);
}

.work-item {
  position: relative;
  display: flex;
  margin-bottom: var(--space-md);
  transition: opacity 0.2s ease;
  min-height: 5.5rem;
  /* Fixed height to accommodate 2-3 lines of description comfortably without jumping */
}

.work-item:last-child {
  margin-bottom: 0;
}

.work-num {
  position: absolute;
  left: -8rem;
  top: 0.25rem;
  /* Slight offset for smaller numbering */
  font-family: var(--font-primary);
  font-size: 0.75rem;
  /* Reverted to small size as preferred */
  color: var(--color-muted);
  width: 2.5rem;
  flex-shrink: 0;
  line-height: 1.2;
  /* Adjust to match h3 line-height if needed */
}

.work-content {
  flex: 1;
}

.work-item h3 {
  font-size: 1.125rem;
  font-weight: 500;
  margin-bottom: 0;
  line-height: 1.2;
}

.work-item p {
  color: var(--color-muted);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 0;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  margin-top: 0.5rem;
  pointer-events: none;
}

.how-i-work:hover .work-item {
  opacity: 0.4;
}

.how-i-work .work-item:hover {
  opacity: 1;
}

.work-item:hover p {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1280px) {
  .work-num {
    left: -4rem;
  }
}

@media (max-width: 1024px) {
  .work-num {
    position: static;
    margin-right: 1.5rem;
    left: auto;
    width: auto;
    font-size: 1.125rem;
  }

  .work-item {
    min-height: auto;
  }
}

/* List */
.list {
  display: flex;
  flex-direction: column;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
  text-decoration: none;
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--color-border);
}

.list-item:last-child {
  border-bottom: 1px solid var(--color-border);
}

.list:hover .list-item {
  opacity: 0.4;
}

.list:hover .list-item:hover {
  opacity: 1;
}

.list-item {
  transition: opacity 0.2s ease;
}

.list-title {
  color: var(--color-text);
}

.list-meta {
  color: var(--color-muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

/* Work Grid */

/* Marker Highlight */
mark {
  background: linear-gradient(104deg,
      rgba(255, 224, 102, 0) 0.9%,
      rgba(255, 224, 102, 1) 2.4%,
      rgba(255, 224, 102, 0.5) 5.8%,
      rgba(255, 224, 102, 0.2) 93%,
      rgba(255, 224, 102, 0.6) 96%,
      rgba(255, 224, 102, 0) 98%), linear-gradient(183deg,
      rgba(255, 224, 102, 0) 0%,
      rgba(255, 224, 102, 0.4) 7.9%,
      rgba(255, 224, 102, 0) 15%);
  padding: 0.1em 0.2em;
  margin: -0.1em -0.2em;
  border-radius: 0.4em 0.2em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  color: inherit;
}

@media (prefers-color-scheme: dark) {
  mark {
    background: linear-gradient(104deg,
        rgba(180, 140, 50, 0) 0.9%,
        rgba(180, 140, 50, 0.7) 2.4%,
        rgba(180, 140, 50, 0.4) 5.8%,
        rgba(180, 140, 50, 0.15) 93%,
        rgba(180, 140, 50, 0.45) 96%,
        rgba(180, 140, 50, 0) 98%), linear-gradient(183deg,
        rgba(180, 140, 50, 0) 0%,
        rgba(180, 140, 50, 0.3) 7.9%,
        rgba(180, 140, 50, 0) 15%);
  }
}

/* Selection */
::selection {
  background-color: var(--color-text);
  color: var(--color-bg);
}

/* Page Transitions */
.page {
  display: none;
}

.page.active {
  display: block;
}

.page.active>* {
  animation: sophisticatedFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity, filter;
}

.page.active>*:nth-child(1) {
  animation-delay: 0s;
}

.page.active>*:nth-child(2) {
  animation-delay: 0.05s;
}

.page.active>*:nth-child(3) {
  animation-delay: 0.1s;
}

.page.active>*:nth-child(4) {
  animation-delay: 0.15s;
}

.page.active>*:nth-child(5) {
  animation-delay: 0.2s;
}

@keyframes sophisticatedFadeIn {
  from {
    opacity: 0;
    filter: blur(12px);
    transform: scale(0.98) translateY(8px);
  }

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

/* Staggered entrance for homepage content */
#home.active .content>* {
  animation: itemFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

#home.active .content>*:nth-child(1) {
  animation-delay: 0s;
}

#home.active .content>*:nth-child(2) {
  animation-delay: 0.1s;
}

#home.active .content>*:nth-child(3) {
  animation-delay: 0.2s;
}

#home.active .content>*:nth-child(4) {
  animation-delay: 0.3s;
}

#home.active .content>*:nth-child(5) {
  animation-delay: 0.4s;
}

#home.active .content>*:nth-child(6) {
  animation-delay: 0.5s;
}

#home.active .content>*:nth-child(7) {
  animation-delay: 0.6s;
}

/* Staggered entrance for list items */
.page.active .list-item {
  animation: itemFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.page.active .list-item:nth-child(1) {
  animation-delay: 0.2s;
}

.page.active .list-item:nth-child(2) {
  animation-delay: 0.3s;
}

.page.active .list-item:nth-child(3) {
  animation-delay: 0.4s;
}

.page.active .list-item:nth-child(4) {
  animation-delay: 0.5s;
}

.page.active .list-item:nth-child(5) {
  animation-delay: 0.6s;
}

.page.active .list-item:nth-child(6) {
  animation-delay: 0.7s;
}

/* Staggered entrance for work items */
.page.active .work-item {
  animation: itemFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.page.active .work-item:nth-child(1) {
  animation-delay: 0.35s;
}

.page.active .work-item:nth-child(2) {
  animation-delay: 0.45s;
}

.page.active .work-item:nth-child(3) {
  animation-delay: 0.55s;
}

.page.active .work-item:nth-child(4) {
  animation-delay: 0.65s;
}

.page.active .work-item:nth-child(5) {
  animation-delay: 0.75s;
}

@keyframes itemFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

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

/* Responsive */
@media (max-width: 600px) {
  body {
    font-size: 1rem;
  }

  main {
    padding: var(--space-lg) var(--space-sm);
    align-items: flex-start;
  }
}

/* Dev Font Selector */
.font-selector {
  position: fixed;
  bottom: 1.25rem;
  /* 20px */
  right: 1.25rem;
  /* 20px */
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 0.25rem;
  /* 4px */
  border-radius: 0.25rem;
  /* 4px */
  opacity: 0.3;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.font-selector:hover {
  opacity: 1;
}

.font-selector input {
  font-family: inherit;
  font-size: 0.75rem;
  background: transparent;
  color: var(--color-text);
  border: none;
  cursor: text;
  outline: none;
  width: 7.5rem;
  /* 120px */
}