/* ══════════════════════════════════════════════════════════════════════════
   TerraNexa — /work page styles

   Scoped to the work page. Every colour, font and radius is read from the
   site's own design tokens (--primary, --card, --border, --font-heading, …)
   declared in assets/index-ZkSL_AJM.css, so this page follows the site if
   those tokens are ever changed.

   Only rules with no equivalent in the compiled stylesheet live here — the
   compiled Tailwind build contains just the utilities the app itself uses, so
   things like `grid-cols-3`, `sticky` and `aspect-[16/10]` do not exist in it.
   Layout and type otherwise use the site's existing utility classes, which are
   all present in that stylesheet.
   ══════════════════════════════════════════════════════════════════════════ */

/* The site header is fixed at h-16 (4rem). Offset the content so the hero is
   not hidden underneath it. */
.tn-main {
  padding-top: 4rem;
}

.tn-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: hsl(var(--primary));
}

.tn-lead {
  color: hsl(var(--muted-foreground));
  font-size: 1.0625rem;
  line-height: 1.75;
}

/* Page heading. Defined here rather than with utilities because
   `leading-[1.08]` is not in the site's compiled stylesheet. */
.tn-h1 {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: hsl(var(--foreground));
  max-width: 56rem;
}

@media (min-width: 640px) {
  .tn-h1 {
    font-size: 3rem;
  }
}

/* Detail page: prose on the left, the evidence list on the right.
   `lg:grid-cols-[1.35fr_1fr]` and `gap-14` are not in the site's build, so this
   layout is defined here instead of with utilities. */
.tn-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3.5rem;
}

@media (min-width: 1024px) {
  .tn-detail-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  }
}

/* The wide screenshot block sits between the header and the prose section. */
.tn-shot-block {
  padding-bottom: 3.5rem;
}

/* ── hero ───────────────────────────────────────────────────────────────── */

.tn-hero {
  position: relative;
  overflow: hidden;
  padding: 5rem 0 3.5rem;
}

.tn-hero-glow {
  position: absolute;
  top: -16rem;
  left: 50%;
  transform: translateX(-50%);
  width: 48rem;
  height: 26rem;
  border-radius: 9999px;
  background: hsl(var(--primary) / 0.12);
  filter: blur(120px);
  pointer-events: none;
}

.tn-hero-inner {
  position: relative;
}

.tn-stat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid hsl(var(--border) / 0.6);
}

@media (min-width: 640px) {
  .tn-stat-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.tn-stat-value {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: hsl(var(--primary));
}

.tn-stat-label {
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: hsl(var(--muted-foreground));
}

/* ── project grid ───────────────────────────────────────────────────────── */

.tn-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .tn-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .tn-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.tn-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 0.25rem);
  background: hsl(var(--card) / 0.5);
  color: inherit;
  text-decoration: none;
  transition:
    transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.28s ease,
    background-color 0.28s ease,
    box-shadow 0.28s ease;
}

.tn-card:hover,
.tn-card:focus-visible {
  transform: translateY(-4px);
  border-color: hsl(var(--primary) / 0.45);
  background: hsl(var(--card) / 0.85);
  box-shadow: 0 22px 48px -24px hsl(var(--primary) / 0.45);
  outline: none;
}

.tn-card:focus-visible {
  box-shadow:
    0 0 0 2px hsl(var(--background)),
    0 0 0 4px hsl(var(--primary) / 0.7);
}

/* The snapshot is a real capture of the running product. */
.tn-shot {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: hsl(var(--secondary));
  border-bottom: 1px solid hsl(var(--border) / 0.7);
}

.tn-shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.tn-card:hover .tn-shot img {
  transform: scale(1.035);
}

.tn-shot-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    hsl(var(--background) / 0.85) 0%,
    hsl(var(--background) / 0.25) 42%,
    hsl(var(--background) / 0) 70%
  );
  pointer-events: none;
}

.tn-badge {
  position: absolute;
  top: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 9999px;
  padding: 0.25rem 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.tn-badge-tag {
  left: 0.75rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.75);
  color: hsl(var(--muted-foreground));
}

.tn-badge-live {
  right: 0.75rem;
  border: 1px solid hsl(150 80% 45% / 0.35);
  background: hsl(var(--background) / 0.75);
  color: hsl(150 75% 55%);
}

.tn-pulse {
  position: relative;
  display: inline-flex;
  width: 0.375rem;
  height: 0.375rem;
}

.tn-pulse::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: hsl(150 80% 45%);
  animation: tn-ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.tn-pulse::after {
  content: "";
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  background: hsl(150 80% 45%);
}

@keyframes tn-ping {
  0% {
    transform: scale(1);
    opacity: 0.75;
  }
  75%,
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

.tn-card-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 1.375rem 1.5rem 1.5rem;
}

.tn-card-title {
  margin-top: 0.5rem;
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: hsl(var(--foreground));
}

.tn-card-summary {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.65;
  color: hsl(var(--muted-foreground));
}

.tn-card-foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--primary));
}

.tn-card-foot svg {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.tn-card:hover .tn-card-foot svg {
  transform: translateX(4px);
}

/* ── metric + stack chips ───────────────────────────────────────────────── */

.tn-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tn-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 0.375rem;
  border: 1px solid hsl(var(--primary) / 0.25);
  border-radius: calc(var(--radius) - 0.25rem);
  background: hsl(var(--primary) / 0.07);
  padding: 0.3125rem 0.625rem;
}

.tn-metric-value {
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--primary));
}

.tn-metric-label {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

.tn-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tn-pill {
  border: 1px solid hsl(var(--border));
  border-radius: 9999px;
  background: hsl(var(--secondary) / 0.7);
  padding: 0.25rem 0.6875rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: hsl(var(--muted-foreground));
}

/* ── section furniture ──────────────────────────────────────────────────── */

.tn-section {
  padding: 4rem 0;
}

@media (min-width: 1024px) {
  .tn-section {
    padding: 5rem 0;
  }
}

.tn-h2 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
}

@media (min-width: 640px) {
  .tn-h2 {
    font-size: 2.25rem;
  }
}

.tn-divider {
  border-top: 1px solid hsl(var(--border) / 0.6);
}

/* ── detail page ────────────────────────────────────────────────────────── */

.tn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: color 0.2s ease;
}

.tn-back:hover {
  color: hsl(var(--primary));
}

.tn-detail-head {
  position: relative;
  overflow: hidden;
  padding: 3rem 0 2.5rem;
}

.tn-detail-h1 {
  margin-top: 1rem;
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: hsl(var(--foreground));
  max-width: 60rem;
}

@media (min-width: 640px) {
  .tn-detail-h1 {
    font-size: 2.75rem;
  }
}

@media (min-width: 1024px) {
  .tn-detail-h1 {
    font-size: 3.25rem;
  }
}

.tn-detail-tagline {
  margin-top: 1.25rem;
  max-width: 46rem;
  font-size: 1.125rem;
  line-height: 1.7;
  color: hsl(var(--muted-foreground));
}

.tn-shot-wide {
  position: relative;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 0.5rem);
  background: hsl(var(--secondary));
  box-shadow: 0 30px 70px -35px hsl(var(--primary) / 0.4);
}

.tn-shot-wide img {
  display: block;
  width: 100%;
  height: auto;
}

.tn-prose p {
  font-size: 1rem;
  line-height: 1.8;
  color: hsl(var(--muted-foreground));
}

.tn-prose p + p {
  margin-top: 1.125rem;
}

.tn-subhead {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

.tn-bullets {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.tn-bullets li {
  display: flex;
  gap: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: hsl(var(--foreground) / 0.9);
}

.tn-bullets li::before {
  content: "";
  flex: 0 0 auto;
  width: 0.375rem;
  height: 0.375rem;
  margin-top: 0.6rem;
  transform: rotate(45deg);
  background: hsl(var(--primary));
}

.tn-note {
  margin-top: 2rem;
  display: flex;
  gap: 0.875rem;
  border: 1px solid hsl(var(--border));
  border-left: 2px solid hsl(var(--accent) / 0.7);
  border-radius: calc(var(--radius) - 0.125rem);
  background: hsl(var(--secondary) / 0.5);
  padding: 1rem 1.25rem;
}

.tn-note-body {
  font-size: 0.8125rem;
  line-height: 1.7;
  color: hsl(var(--muted-foreground));
}

.tn-note-label {
  display: block;
  margin-bottom: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: hsl(var(--accent));
}

/* CTA panel */
.tn-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid hsl(var(--primary) / 0.25);
  border-radius: calc(var(--radius) + 0.75rem);
  background: hsl(var(--card) / 0.55);
  padding: 3rem 2rem;
  text-align: center;
  backdrop-filter: blur(18px);
}

.tn-panel-glow {
  position: absolute;
  top: -8rem;
  left: 50%;
  transform: translateX(-50%);
  width: 34rem;
  height: 20rem;
  border-radius: 9999px;
  background: hsl(var(--primary) / 0.15);
  filter: blur(90px);
  pointer-events: none;
}

.tn-panel-inner {
  position: relative;
}

.tn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 9999px;
  padding: 0.875rem 1.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition:
    filter 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.tn-btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.tn-btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.tn-btn-ghost {
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card) / 0.6);
  color: hsl(var(--foreground));
}

.tn-btn-ghost:hover {
  border-color: hsl(var(--primary) / 0.5);
  color: hsl(var(--primary));
}

.tn-btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* prev / next */
.tn-pager {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 700px) {
  .tn-pager {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tn-pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 0.25rem);
  background: hsl(var(--card) / 0.45);
  padding: 1.125rem 1.375rem;
  text-decoration: none;
  transition:
    border-color 0.25s ease,
    background-color 0.25s ease,
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tn-pager-link:hover {
  transform: translateY(-2px);
  border-color: hsl(var(--primary) / 0.45);
  background: hsl(var(--card) / 0.8);
}

.tn-pager-dir {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: hsl(var(--primary));
}

.tn-pager-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  color: hsl(var(--foreground));
}

.tn-pager-next {
  text-align: right;
  align-items: flex-end;
}

/* ── earlier demos ──────────────────────────────────────────────────────── */

.tn-demo {
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 0.25rem);
  background: hsl(var(--card) / 0.35);
  padding: 1.75rem;
}

.tn-demo-kind {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: hsl(var(--accent));
}

.tn-demo-list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4375rem;
}

.tn-demo-list li {
  display: flex;
  gap: 0.625rem;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: hsl(var(--muted-foreground));
}

.tn-demo-list li::before {
  content: "\2014";
  color: hsl(var(--primary) / 0.7);
}

.tn-demo-goal {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid hsl(var(--border) / 0.6);
  font-size: 0.8125rem;
  line-height: 1.65;
  color: hsl(var(--muted-foreground));
}

.tn-demo-goal strong {
  color: hsl(var(--foreground));
  font-weight: 600;
}

/* ── mobile navigation ──────────────────────────────────────────────────── */

/* The site's own mobile menu is a React drawer. This page has no framework, so
   the menu is a <details> disclosure instead: no JavaScript, and it keeps every
   page reachable on a phone. */
.tn-mnav {
  position: relative;
}

.tn-mnav > summary {
  /* Matches the site's own menu button: a bare 36px icon target with 8px
     padding, no border, no radius and no hover restyle. */
  display: block;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.5rem;
  border-width: 0;
  border-radius: 0;
  background: transparent;
  color: hsl(var(--foreground));
  cursor: pointer;
  list-style: none;
}

.tn-mnav > summary::-webkit-details-marker {
  display: none;
}

.tn-mnav-panel {
  position: absolute;
  top: calc(100% + 0.875rem);
  right: -0.25rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  width: min(19rem, calc(100vw - 2.5rem));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 0.25rem);
  background: hsl(var(--card) / 0.97);
  padding: 0.75rem;
  box-shadow: 0 26px 60px -20px hsl(220 60% 2% / 0.9);
  backdrop-filter: blur(18px);
}

.tn-mnav-panel a {
  border-radius: calc(var(--radius) - 0.25rem);
  padding: 0.6875rem 0.75rem;
  font-size: 0.9375rem;
  text-decoration: none;
  color: hsl(var(--muted-foreground));
}

.tn-mnav-panel a:hover {
  background: hsl(var(--secondary) / 0.85);
  color: hsl(var(--foreground));
}

.tn-mnav-panel a[aria-current="page"] {
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.08);
}

/* The browser hides a closed <details>'s content from its own stylesheet, but
   author styles beat user-agent styles regardless of specificity - so the
   `display: flex` above would leave this menu permanently open, floating over
   the page on every phone. This restores the closed state explicitly. */
.tn-mnav:not([open]) .tn-mnav-panel {
  display: none;
}

.tn-mnav-cta {
  margin-top: 0.375rem;
  border-radius: 9999px;
  background: hsl(var(--primary));
  text-align: center;
  font-weight: 500;
  color: hsl(var(--primary-foreground));
}

.tn-mnav-cta:hover {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  filter: brightness(1.1);
}

@media (min-width: 1024px) {
  .tn-mnav {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tn-card,
  .tn-card:hover,
  .tn-card:focus-visible,
  .tn-shot img,
  .tn-card:hover .tn-shot img,
  .tn-card-foot svg,
  .tn-card:hover .tn-card-foot svg,
  .tn-pager-link,
  .tn-pager-link:hover,
  .tn-btn-primary:hover {
    transform: none;
    transition: none;
  }
  .tn-pulse::before {
    animation: none;
  }
}

/* ── custom cursor ──────────────────────────────────────────────────────── */

/* The site does not use the native pointer. It hides it and draws its own: an
   8px primary dot that tracks the pointer exactly, plus a 38px primary ring
   that trails on a spring and swells to 1.7x over anything clickable.

   Hiding is done by putting `has-custom-cursor` on <html>, which the site's own
   stylesheet already turns into `cursor: none !important` - so the rule is
   inherited here rather than duplicated. All this file supplies is the mark-up
   the site renders from React, at the same sizes, colours and offsets. The
   spring motion is in the page script, with the site's own stiffness, damping
   and mass values.

   `.tn-cursor-ring` deliberately declares no transition, which matches the
   site: the CSS initial value is already `all` with a zero duration. */
.tn-cursor {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

.tn-cursor-wrap {
  position: absolute;
  left: 0;
  top: 0;
}

.tn-cursor-dot {
  width: 8px;
  height: 8px;
  margin-left: -4px;
  margin-top: -4px;
  border-radius: 9999px;
  background-color: hsl(var(--primary));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tn-cursor-ring {
  width: 38px;
  height: 38px;
  margin-left: -19px;
  margin-top: -19px;
  border-radius: 9999px;
  border: 1px solid hsl(var(--primary));
  opacity: 0;
}
