/* ═══════════════════════════════════════════════════
   KUSP — Adaptive Retrieval Research
   Warm Editorial Design System

   Palette swap: edit the 10 variables below.
   Font swap: update --font-serif and --font-sans.
   ═══════════════════════════════════════════════════ */

/* ── Theme Variables ─────────────────────────────── */
:root {
  --bg:           #FAF6F0;
  --bg-warm:      #F3EADB;
  --surface:      #FFFFFF;
  --text:         #1C1814;
  --text-2:       #5F574E;
  --text-3:       #9A9189;
  --accent:       #92400E;
  --accent-hover: #7C3610;
  --border:       #DDD5C8;
  --border-lt:    #EBE5DA;

  --font-serif:   'Instrument Serif', Georgia, serif;
  --font-sans:    'Outfit', system-ui, sans-serif;

  --max-w:        62rem;
  --nav-h:        4rem;
}


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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

::selection { background: rgba(146, 64, 14, 0.12); }


/* ── Skip Link ───────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  padding: 0.5rem 1rem;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  z-index: 10000;
  border-radius: 2px;
}
.skip-link:focus { left: 1rem; top: 1rem; }


/* ── Grain Texture ───────────────────────────────── */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.32;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.75' type='fractalNoise' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
  background-size: 300px 300px;
}


/* ── Container ───────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}


/* ── Navigation ──────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  padding: 0 2.5rem;
  background: rgba(250, 246, 240, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s;
}

.nav.scrolled {
  border-bottom-color: var(--border-lt);
}

.nav-brand {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  letter-spacing: 0.14em;
  color: var(--text-2);
  transition: color 0.3s;
}
.nav-brand:hover { color: var(--text); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-links a {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-3);
  letter-spacing: 0.02em;
  transition: color 0.3s;
}
.nav-links a:hover { color: var(--text); }

.nav-lock {
  display: flex;
  align-items: center;
  color: var(--border);
  transition: color 0.3s;
}
.nav-lock:hover { color: var(--text-3); }


/* ── Hero ────────────────────────────────────────── */
.hero {
  min-height: max(85vh, 580px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 2rem 4rem;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(160deg,
      var(--bg) 0%,
      #F5ECDA 30%,
      #EFE3CB 50%,
      #F5ECDA 70%,
      var(--bg) 100%
    );
  background-size: 300% 300%;
  animation: warmDrift 30s ease-in-out infinite;
}

@keyframes warmDrift {
  0%, 100% { background-position: 0% 0%; }
  25%      { background-position: 100% 0%; }
  50%      { background-position: 100% 100%; }
  75%      { background-position: 0% 100%; }
}

.hero-wordmark {
  font-family: var(--font-serif);
  font-size: clamp(4.5rem, 14vw, 10rem);
  font-weight: 400;
  letter-spacing: 0.2em;
  padding-left: 0.2em;
  color: var(--text);
  line-height: 1;
}

.hero-rule {
  width: 0;
  height: 1px;
  background: var(--border);
  margin: 1.75rem auto 0;
  animation: expandRule 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

@keyframes expandRule {
  to { width: min(5rem, 20vw); }
}

.hero-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.1rem, 2.5vw, 1.55rem);
  color: var(--text-2);
  margin-top: 1.5rem;
  line-height: 1.5;
}

.hero-desc {
  max-width: 34rem;
  font-size: 0.92rem;
  color: var(--text-3);
  margin-top: 1.25rem;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
}

/* Staggered hero entrance */
.hero-wordmark {
  opacity: 0;
  animation: heroIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}
.hero-rule {
  opacity: 0;
  animation:
    heroIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards,
    expandRule 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}
.hero-tagline {
  opacity: 0;
  animation: heroIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}
.hero-desc {
  opacity: 0;
  animation: heroIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.65s forwards;
}
.hero-actions {
  opacity: 0;
  animation: heroIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.8s forwards;
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.6rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 2px;
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-dark {
  background: var(--text);
  color: var(--bg);
}
.btn-dark:hover {
  background: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(146, 64, 14, 0.15);
}

.btn-outline {
  background: transparent;
  color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--border);
}
.btn-outline:hover {
  box-shadow: inset 0 0 0 1px var(--text-2);
  color: var(--text);
}


/* ── Divider ─────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem 0;
}

.divider::before,
.divider::after {
  content: '';
  width: 3rem;
  height: 1px;
  background: var(--border);
}

.divider-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotPulse 5s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.75; }
}


/* ── Featured Card ───────────────────────────────── */
.featured {
  padding-bottom: 2rem;
}

.featured-card {
  display: block;
  position: relative;
  border-left: 3px solid var(--accent);
  padding: 2.5rem 3rem;
  background: var(--surface);
  box-shadow:
    0 1px 3px rgba(28, 24, 20, 0.03),
    0 6px 24px rgba(28, 24, 20, 0.04);
  max-width: 48rem;
  margin: 0 auto;
  transition: box-shadow 0.35s, transform 0.35s;
}

.featured-card:hover {
  box-shadow:
    0 2px 8px rgba(28, 24, 20, 0.05),
    0 16px 40px rgba(28, 24, 20, 0.07);
  transform: translateY(-2px);
}

.card-tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.featured-card h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  font-weight: 400;
  line-height: 1.35;
  margin-bottom: 1rem;
}

.featured-card p {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.8;
  margin-bottom: 1.25rem;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
  transition: gap 0.25s, color 0.25s;
}
.card-link:hover {
  gap: 0.55rem;
  color: var(--accent-hover);
}


/* ── Work Grid ───────────────────────────────────── */
.work {
  padding: 1rem 0 2rem;
}

.work-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 48rem;
  margin: 0 auto;
}

.work-card {
  display: block;
  border-left: 2px solid var(--border);
  padding: 2rem 2.25rem;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(28, 24, 20, 0.03);
  transition: border-color 0.3s, box-shadow 0.35s, transform 0.35s;
}

.work-card:hover {
  border-left-color: var(--accent);
  box-shadow:
    0 2px 8px rgba(28, 24, 20, 0.05),
    0 12px 32px rgba(28, 24, 20, 0.05);
  transform: translateY(-1px);
}

.work-card h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 400;
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.work-card p {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: 1rem;
}


/* ── About ───────────────────────────────────────── */
.about {
  padding: 1rem 0 5rem;
  text-align: center;
}

.about h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
}

.about-text {
  max-width: 36rem;
  margin: 0 auto;
  font-size: 0.92rem;
  color: var(--text-2);
  line-height: 1.85;
}

.about-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  transition: gap 0.25s;
}
.about-link:hover { gap: 0.55rem; }


/* ── Footer ──────────────────────────────────────── */
.footer {
  padding: 2.5rem 2rem;
  border-top: 1px solid var(--border-lt);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--text-3);
  transition: color 0.3s;
  padding: 0.25rem 0;
}
.footer-links a:hover { color: var(--text); }

.footer-sep {
  color: var(--border);
  padding: 0 0.75rem;
  font-size: 0.75rem;
  user-select: none;
}

.footer-copy {
  font-size: 0.7rem;
  color: var(--text-3);
  opacity: 0.65;
}


/* ── Scroll Reveal ───────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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


/* ── Focus States ────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
  outline: none;
}


/* ── Reduced Motion ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
  .hero-wordmark,
  .hero-rule,
  .hero-tagline,
  .hero-desc,
  .hero-actions {
    opacity: 1;
    transform: none;
  }
  .hero {
    animation: none;
    background-size: 100% 100%;
  }
}


/* ── Responsive: Tablet ──────────────────────────── */
@media (max-width: 1024px) {
  .featured-card { padding: 2rem 2.5rem; }
  .work-card { padding: 1.75rem 2rem; }
}

/* ── Responsive: Mobile ──────────────────────────── */
@media (max-width: 768px) {
  .nav { padding: 0 1.25rem; }
  .nav-links { gap: 1.25rem; }

  .hero {
    min-height: 70vh;
    padding: 4rem 1.5rem 3rem;
  }
  .hero-wordmark {
    letter-spacing: 0.15em;
    padding-left: 0.15em;
  }

  .container { padding: 0 1.25rem; }
  .work-grid { grid-template-columns: 1fr; }
  .featured-card { padding: 1.75rem 2rem; }
  .work-card { padding: 1.5rem 1.75rem; }

  .footer-links { gap: 0; }
}

/* ── Responsive: Small Mobile ────────────────────── */
@media (max-width: 479px) {
  .hero-actions {
    flex-direction: column;
    width: 100%;
    max-width: 18rem;
  }
  .btn { width: 100%; justify-content: center; }

  .nav-links { gap: 1rem; }
  .nav-links a { font-size: 0.78rem; }
}

/* ── Responsive: Ultrawide ───────────────────────── */
@media (min-width: 1800px) {
  :root { --max-w: 72rem; }
  .hero-wordmark { font-size: 11rem; }
  .featured-card { max-width: 56rem; }
  .work-grid { max-width: 56rem; }
}
