/* ================================================
   Terra Norma — Freeform Landing 2026
   ================================================ */

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

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

body.tn-page {
  background: #0d1f17;
  color: #f0ebe0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[id] { scroll-margin-top: 80px; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* --- Tokens --- */
.tn {
  --bg: #0d1f17;
  --bg-2: #132a1f;
  --bg-card: rgba(20, 42, 32, 0.6);
  --cream: #f0ebe0;
  --cream-dim: rgba(240, 235, 224, 0.55);
  --gold: #d4a24e;
  --gold-dim: rgba(212, 162, 78, 0.18);
  --gold-line: rgba(212, 162, 78, 0.45);
  --line: rgba(240, 235, 224, 0.15);
  --r: 6px;
  --pad: clamp(16px, 5vw, 80px);
}

/* --- Nav (fixed, gains blur on scroll) --- */
.tn-nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--pad);
  height: 64px;
  background: transparent;
  backdrop-filter: blur(0);
  transition: background .4s, backdrop-filter .4s;
}

.tn-nav.is-scrolled {
  background: rgba(13, 31, 23, 0.88);
  backdrop-filter: blur(14px);
}

.admin-bar .tn-nav { top: 32px; }
@media (max-width: 782px) { .admin-bar .tn-nav { top: 46px; } }

.tn-nav__brand {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .7;
  white-space: nowrap;
}

.tn-nav__links {
  display: flex;
  gap: 8px;
}

.tn-nav__links a {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--cream);
  transition: border-color .25s, color .25s;
}

.tn-nav__links a:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* --- Hero (full viewport) --- */
.tn-hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 120px var(--pad) 80px;
}

.tn-hero::after {
  content: '';
  position: absolute;
  width: 650px;
  height: 650px;
  top: 8%;
  right: -15%;
  background: radial-gradient(circle, rgba(212, 162, 78, 0.05), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.tn-hero__content {
  position: relative;
  z-index: 1;
  max-width: 1000px;
}

.tn-kicker {
  display: inline-block;
  margin-bottom: 24px;
  padding: 8px 18px;
  background: var(--gold-dim);
  border: 1px solid var(--gold-line);
  border-radius: var(--r);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--gold);
}

.tn h1 {
  font-size: clamp(2.6rem, 7vw, 7rem);
  line-height: .92;
  letter-spacing: -.03em;
  text-wrap: balance;
  margin-bottom: 28px;
}

.tn-lead {
  max-width: 600px;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.75;
  color: var(--cream-dim);
  margin-bottom: 36px;
}

/* --- CTA buttons --- */
.tn-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.tn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 24px;
  border: none;
  border-radius: var(--r);
  font-size: .95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .25s, color .25s;
}

.tn-btn:hover { transform: translateY(-2px); }

.tn-btn--gold {
  background: var(--gold);
  color: var(--bg);
  box-shadow: 0 8px 28px rgba(212, 162, 78, 0.25);
}

.tn-btn--gold:hover { box-shadow: 0 14px 36px rgba(212, 162, 78, 0.35); }

.tn-btn--outline {
  border: 1px solid var(--line);
  color: var(--cream);
  background: transparent;
}

.tn-btn--outline:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* --- Skill pills --- */
.tn-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tn-pills span {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: .82rem;
  color: var(--cream-dim);
}

/* --- Photo breaks (full bleed, <img> based) --- */
.tn-photo {
  position: relative;
  width: 100%;
  height: clamp(280px, 45vw, 550px);
  overflow: hidden;
}

.tn-photo img {
  width: 100%;
  height: 140%;
  object-fit: cover;
  will-change: transform;
}

.tn-photo::before,
.tn-photo::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 35%;
  z-index: 1;
  pointer-events: none;
}

.tn-photo::before {
  top: 0;
  background: linear-gradient(to bottom, var(--bg), transparent);
}

.tn-photo::after {
  bottom: 0;
  background: linear-gradient(to top, var(--bg), transparent);
}

/* Scroll-driven parallax (Chrome/Edge 115+, Firefox 110+) */
@supports (animation-timeline: view()) {
  .tn-photo img {
    animation: tn-parallax linear both;
    animation-timeline: view();
    animation-range: entry 0% exit 100%;
  }
}

@keyframes tn-parallax {
  from { transform: translateY(-15%); }
  to { transform: translateY(5%); }
}

/* --- Sections --- */
.tn-section {
  padding: clamp(48px, 8vw, 96px) 0;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.tn-section--alt {
  background: #162b1e;
}

.tn-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--pad);
}

.tn h2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
  letter-spacing: -.02em;
  margin-bottom: 16px;
}

.tn-section__lead {
  max-width: 640px;
  color: var(--cream-dim);
  line-height: 1.7;
  margin-bottom: 36px;
}

/* --- Grid --- */
.tn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* --- Service cards --- */
.tn-card {
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  position: relative;
  overflow: hidden;
  transition: border-color .3s, transform .3s;
}

.tn-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .45s cubic-bezier(.22, 1, .36, 1);
}

.tn-card:hover {
  border-color: var(--gold-line);
  transform: translateY(-4px);
}

.tn-card:hover::before { transform: scaleX(1); }

.tn-card h3 { font-size: 1.3rem; margin-bottom: 10px; }
.tn-card p { color: var(--cream-dim); line-height: 1.7; margin-bottom: 14px; }
.tn-card ul { padding-left: 18px; list-style: disc; }
.tn-card li { color: var(--cream-dim); line-height: 1.65; padding: 2px 0; }
.tn-card li::marker { color: var(--gold); }

/* --- Process steps --- */
.tn-step {
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.tn-step__num {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gold);
  opacity: .55;
  line-height: 1;
  margin-bottom: 14px;
}

.tn-step h3 { font-size: 1.25rem; margin-bottom: 10px; }
.tn-step p { color: var(--cream-dim); line-height: 1.7; }

/* --- Contact --- */
.tn-contact {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
}

.tn-contact__about p {
  color: var(--cream-dim);
  line-height: 1.75;
  margin-bottom: 16px;
  max-width: 580px;
}

.tn-contact__info {
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.tn-contact__info h2 { margin-bottom: 18px; }

.tn-dl dt {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gold);
  opacity: .7;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.tn-dl dt:first-of-type { border-top: none; padding-top: 0; }

.tn-dl dd {
  color: var(--cream-dim);
  margin: 4px 0 8px;
}

.tn-dl a {
  color: var(--cream);
  border-bottom: 1px solid var(--line);
  transition: border-color .2s;
}

.tn-dl a:hover { border-color: var(--gold); }

/* --- Footer --- */
.tn-footer {
  padding: 32px var(--pad);
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: .82rem;
  color: var(--cream-dim);
  opacity: .7;
}

/* ================================================
   Scroll-driven animations (CSS only, 2026)
   ================================================ */

/* Nav background on scroll */
@supports (animation-timeline: scroll()) {
  .tn-nav {
    animation: tn-nav-bg linear both;
    animation-timeline: scroll();
    animation-range: 0px 250px;
    transition: none;
  }

  @keyframes tn-nav-bg {
    from { background: rgba(13, 31, 23, 0); backdrop-filter: blur(0); }
    to   { background: rgba(13, 31, 23, 0.88); backdrop-filter: blur(14px); }
  }

  /* Hero fade-out on scroll */
  .tn-hero__content {
    animation: tn-hero-fade linear both;
    animation-timeline: scroll();
    animation-range: 30vh 90vh;
  }

  @keyframes tn-hero-fade {
    0%   { opacity: 1; transform: translateY(0); filter: blur(0); }
    100% { opacity: 0; transform: translateY(-50px); filter: blur(3px); }
  }
}

/* Section/card reveal — only when JS sets .tn-animated */
.tn-animated .tn-card,
.tn-animated .tn-step,
.tn-animated .tn-contact__about,
.tn-animated .tn-contact__info,
.tn-animated .tn-section h2,
.tn-animated .tn-section__lead {
  opacity: 0;
  transform: translateY(36px);
}

@supports (animation-timeline: view()) {
  .tn-animated .tn-card,
  .tn-animated .tn-step,
  .tn-animated .tn-contact__about,
  .tn-animated .tn-contact__info,
  .tn-animated .tn-section h2,
  .tn-animated .tn-section__lead {
    animation: tn-reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 30%;
  }

  /* Stagger */
  .tn-animated .tn-card:nth-child(2),
  .tn-animated .tn-step:nth-child(2) { animation-range: entry 3% entry 33%; }
  .tn-animated .tn-card:nth-child(3),
  .tn-animated .tn-step:nth-child(3) { animation-range: entry 6% entry 36%; }
}

@keyframes tn-reveal {
  from { opacity: 0; transform: translateY(36px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* JS fallback reveal class */
.tn-animated .is-visible {
  opacity: 1 !important;
  transform: translateY(0) !important;
  transition: opacity .7s ease, transform .7s cubic-bezier(.22, 1, .36, 1);
  transition-delay: var(--stagger, 0ms);
}

/* ================================================
   Responsive
   ================================================ */

@media (max-width: 980px) {
  .tn-grid { grid-template-columns: 1fr 1fr; }
  .tn-contact { grid-template-columns: 1fr; }
  .tn-hero { min-height: auto; padding: 100px var(--pad) 60px; }
  .tn-nav__hide-mobile { display: none; }
}

@media (max-width: 640px) {
  .tn { --pad: 16px; }

  .tn-nav {
    flex-wrap: wrap;
    height: auto;
    padding: 10px var(--pad);
    gap: 6px;
  }

  .tn-nav__brand { font-size: .7rem; }
  .tn-nav__links { width: 100%; }
  .tn-nav__hide-mobile { display: none; }

  .tn-nav__links a {
    flex: 1;
    justify-content: center;
    height: 32px;
    padding: 0 4px;
    font-size: .68rem;
  }

  .tn-hero { padding: 110px var(--pad) 48px; }

  .tn-grid { grid-template-columns: 1fr; gap: 0; }

  .tn-card,
  .tn-step {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    background: transparent;
    padding: 20px 0;
  }

  .tn-card::before { display: none; }
  .tn-card:first-child,
  .tn-step:first-child { border-top: none; padding-top: 0; }

  .tn-cta { flex-direction: column; }
  .tn-btn { width: 100%; }

  .tn-contact__info {
    padding: 20px 0;
    background: transparent;
    border: none;
    border-top: 1px solid var(--line);
  }

  .tn-step__num { font-size: 2rem; }
  .tn-photo { height: 220px; }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
  }

  .tn-animated .tn-card,
  .tn-animated .tn-step,
  .tn-animated .tn-contact__about,
  .tn-animated .tn-contact__info,
  .tn-animated .tn-section h2,
  .tn-animated .tn-section__lead {
    opacity: 1;
    transform: none;
  }
}

/* --- Hide Astra/theme leftovers that might leak through wp_head --- */
.tn-page #masthead,
.tn-page #colophon,
.tn-page .site-below-footer-wrap,
.tn-page .ast-breadcrumbs-wrapper,
.tn-page #ast-desktop-header,
.tn-page #ast-mobile-header {
  display: none !important;
}
