:root {
  --paper: #F7F4ED;
  --ink: #1C1917;
  --cinnabar: #B83C2F;
  --cinnabar-deep: #8F2D23;
  --cinnabar-light: #FDF2F1;
  --jade: #5A7F6B;
  --jade-light: #E8F0EA;
  --gold: #C9A227;
  --easing-out: cubic-bezier(0.16, 1, 0.3, 1);
  --easing-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
}

/* Paper grain texture */
.paper-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* Ink wash background accents */
.ink-wash {
  background:
    radial-gradient(ellipse 70% 50% at 20% 30%, rgba(184, 60, 47, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 45% at 80% 70%, rgba(90, 127, 107, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse 80% 40% at 50% 100%, rgba(28, 25, 23, 0.03) 0%, transparent 50%);
}

/* Scroll reveal base state */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s var(--easing-out), transform 0.5s var(--easing-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.6s var(--easing-out), transform 0.6s var(--easing-out);
}

.reveal-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.6s var(--easing-out), transform 0.6s var(--easing-out);
}

.reveal-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.5s var(--easing-out), transform 0.5s var(--easing-out);
}

.reveal-scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Stagger delays */
.stagger-1 { transition-delay: 0.08s; }
.stagger-2 { transition-delay: 0.16s; }
.stagger-3 { transition-delay: 0.24s; }
.stagger-4 { transition-delay: 0.32s; }
.stagger-5 { transition-delay: 0.40s; }
.stagger-6 { transition-delay: 0.48s; }
.stagger-7 { transition-delay: 0.56s; }
.stagger-8 { transition-delay: 0.64s; }

/* Hero word animation */
.hero-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(60px) scale(0.85) rotate(-2deg);
  filter: blur(8px);
  animation: heroWordPop 0.9s var(--easing-spring) forwards;
}

@keyframes heroWordPop {
  0% {
    opacity: 0;
    transform: translateY(60px) scale(0.85) rotate(-2deg);
    filter: blur(8px);
  }
  60% {
    opacity: 1;
    transform: translateY(-6px) scale(1.02) rotate(1deg);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
    filter: blur(0);
  }
}

.hero-word-delay-1 { animation-delay: 0.15s; }
.hero-word-delay-2 { animation-delay: 0.30s; }
.hero-word-delay-3 { animation-delay: 0.45s; }
.hero-word-delay-4 { animation-delay: 0.60s; }

/* Floating decorative elements */
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(3deg); }
}

.float-slow {
  animation: float 6s ease-in-out infinite;
}

.float-medium {
  animation: float 4s ease-in-out infinite;
}

/* Seal stamp */
.seal-stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--cinnabar);
  color: white;
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
  border-radius: 4px;
  transform: rotate(-3deg);
  box-shadow: 2px 3px 10px rgba(184, 60, 47, 0.25);
  transition: transform 0.3s var(--easing-out);
}

.seal-stamp:hover {
  transform: rotate(0deg) scale(1.05);
}

/* Card hover effects */
.craft-card {
  transition: transform 0.35s var(--easing-out), box-shadow 0.35s var(--easing-out);
  will-change: transform;
}

.craft-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 48px -12px rgba(28, 25, 23, 0.12);
}

.craft-card:hover .craft-card-icon {
  transform: scale(1.06);
}

.craft-card-icon img {
  transition: transform 0.4s var(--easing-out);
}

.craft-card-icon {
  transition: transform 0.4s var(--easing-out);
  will-change: transform;
}

/* Article card hover */
.article-card {
  transition: transform 0.3s var(--easing-out);
}

.article-card:hover {
  transform: translateY(-4px);
}

.article-card:hover .article-card-image {
  transform: scale(1.05);
}

.article-card-image {
  transition: transform 0.5s var(--easing-out);
  will-change: transform;
}

/* Button press feedback */
.btn-press {
  transition: transform 0.15s var(--easing-out), background-color 0.2s ease;
}

.btn-press:active {
  transform: scale(0.96);
}

/* Link underline animation */
.link-underline {
  position: relative;
}

.link-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--cinnabar);
  transition: width 0.3s var(--easing-out);
}

.link-underline:hover::after {
  width: 100%;
}

/* Grid pattern for dark section */
.pattern-grid {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* Text balance for headings */
h1, h2, h3 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .float-slow, .float-medium {
    animation: none;
  }
}

/* Decorative corner brackets */
.corner-bracket {
  position: relative;
}

.corner-bracket::before,
.corner-bracket::after {
  content: '';
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--cinnabar);
  border-style: solid;
  opacity: 0.35;
  transition: opacity 0.3s ease, transform 0.3s var(--easing-out);
}

.corner-bracket::before {
  top: -10px;
  left: -10px;
  border-width: 2px 0 0 2px;
}

.corner-bracket::after {
  bottom: -10px;
  right: -10px;
  border-width: 0 2px 2px 0;
}

.corner-bracket:hover::before,
.corner-bracket:hover::after {
  opacity: 0.7;
}

/* Image treatment */
.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Tabular nums */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Article typography */
.article-body {
  font-size: 1.125rem;
  line-height: 1.8;
  color: #1C1917;
}

.article-body p {
  margin-bottom: 1.75rem;
}

.article-body h2 {
  font-family: "DM Serif Display", "Noto Serif SC", Georgia, serif;
  font-size: 1.875rem;
  font-weight: 500;
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  color: #1C1917;
  text-wrap: balance;
}

.article-body h3 {
  font-family: "DM Serif Display", "Noto Serif SC", Georgia, serif;
  font-size: 1.5rem;
  font-weight: 500;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: #1C1917;
  text-wrap: balance;
}

.article-body ul, .article-body ol {
  margin-bottom: 1.75rem;
  padding-left: 1.5rem;
}

.article-body li {
  margin-bottom: 0.75rem;
}

.article-body blockquote {
  border-left: 4px solid var(--cinnabar);
  padding-left: 1.5rem;
  margin: 2.5rem 0;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.35rem;
  font-style: italic;
  color: #57534E;
}

.article-body a {
  color: var(--cinnabar);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body a:hover {
  color: var(--cinnabar-deep);
}

.article-body img {
  border-radius: 4px;
  margin: 2rem 0;
}

.article-body figure {
  margin: 2.5rem 0;
}

.article-body figcaption {
  text-align: center;
  font-size: 0.875rem;
  color: #78716C;
  margin-top: 0.75rem;
}

/* Pull quote */
.pull-quote {
  background: #FDF5E8;
  border-left: 4px solid var(--cinnabar);
  padding: 2rem;
  margin: 2.5rem 0;
  border-radius: 0 4px 4px 0;
}

.pull-quote p {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.5rem;
  font-style: italic;
  color: #1C1917;
  margin-bottom: 0.75rem;
}

.pull-quote cite {
  font-size: 0.875rem;
  color: #78716C;
  font-style: normal;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #78716C;
}

.breadcrumb a:hover {
  color: var(--cinnabar);
}

/* Table of contents */
.toc {
  background: white;
  border: 1px solid #E7E5E4;
  padding: 1.5rem;
  border-radius: 4px;
  margin: 2rem 0;
}

.toc h3 {
  font-family: "Inter", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  color: #1C1917;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin-bottom: 0.5rem;
  padding-left: 0;
}

.toc a {
  color: #57534E;
  text-decoration: none;
  font-size: 0.95rem;
}

.toc a:hover {
  color: var(--cinnabar);
}

/* Sources */
.sources {
  border-top: 1px solid #E7E5E4;
  padding-top: 2rem;
  margin-top: 3rem;
}

.sources h2 {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.sources ul {
  list-style: none;
  padding: 0;
}

.sources li {
  margin-bottom: 0.75rem;
  padding-left: 1.25rem;
  position: relative;
}

.sources li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--cinnabar);
}

.sources a {
  color: #57534E;
  text-decoration: none;
}

.sources a:hover {
  color: var(--cinnabar);
  text-decoration: underline;
}

/* Mobile menu */
.mobile-menu {
  display: none;
  padding: 1rem;
  border-top: 1px solid rgba(28, 25, 23, 0.1);
  background: var(--paper);
}

.mobile-menu.is-open {
  display: block;
}

.mobile-menu ul {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mobile-menu a {
  display: block;
  padding: 0.5rem 0;
  font-size: 1rem;
  color: inherit;
  text-decoration: none;
}

.mobile-menu a:hover {
  color: var(--cinnabar);
}
