/* Twine Interactive — main stylesheet */

:root {
  --bg: #faf7f2;
  --bg-alt: #f1ece3;
  --ink: #23201c;
  --ink-soft: #5c564d;
  --accent: #e05e2b;      /* twine orange */
  --accent-soft: #f3c9b4;
  --teal: #1f6f6b;
  --card: #ffffff;
  --line: #e2dbcf;
  --term-bg: #23201c;
  --term-ink: #e8e2d6;
  --radius: 14px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.mono { font-family: var(--font-mono); }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; }

h1 { font-size: clamp(2.6rem, 6.5vw, 4.6rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); font-weight: 600; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
}
.logo em { font-style: normal; color: var(--accent); }
.logo-mark { width: 30px; height: 30px; color: var(--ink); }

.site-nav { display: flex; align-items: center; gap: 1.6rem; }
.site-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--ink); }

.nav-cta {
  color: var(--accent) !important;
  border: 1.5px solid var(--accent);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s !important;
}
.nav-cta:hover { background: var(--accent); color: #fff !important; }

.nav-toggle { display: none; }

/* ---------- hero ---------- */

.hero { padding: 5.5rem 0 3rem; }

.kicker {
  color: var(--teal);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.thread-word { position: relative; display: inline-block; }
.thread-underline {
  position: absolute;
  left: 0; right: 0; bottom: -0.18em;
  width: 100%; height: 0.35em;
  overflow: visible;
}
.thread-underline path {
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
  animation: draw-thread 1.1s ease-out 0.4s forwards;
}
@keyframes draw-thread { to { stroke-dashoffset: 0; } }

.lede {
  max-width: 620px;
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin: 1.5rem 0 2rem;
}

.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(224, 94, 43, 0.28);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(224, 94, 43, 0.34); }
.btn-ghost {
  color: var(--ink);
  border: 1.5px solid var(--line);
  background: transparent;
}
.btn-ghost:hover { border-color: var(--ink-soft); }
.btn-lg { font-size: 1.1rem; padding: 1rem 2rem; }

/* terminal */

.hero-terminal { margin-top: 3.5rem; }

.terminal {
  background: var(--term-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(35, 32, 28, 0.22);
  max-width: 720px;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.06);
}
.terminal-bar span {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}
.terminal-bar span:first-child { background: #e0642b; }
.terminal-bar p {
  margin-left: auto;
  font-size: 0.75rem;
  color: rgba(232, 226, 214, 0.5);
}

.terminal pre {
  padding: 1.4rem 1.5rem 1.6rem;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--term-ink);
  overflow-x: auto;
}
.t-dim { color: rgba(232, 226, 214, 0.45); }
.t-flag { color: #f3a06b; }
.t-ok { color: #8fd6a9; }

/* ---------- sections ---------- */

.section { padding: 5rem 0; }
.section-alt { background: var(--bg-alt); }

.section-lede {
  max-width: 620px;
  font-size: 1.1rem;
  color: var(--ink-soft);
  margin-bottom: 2.8rem;
}

/* cards */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.4rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.8rem;
  transition: transform 0.18s, box-shadow 0.18s;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 34px rgba(35, 32, 28, 0.1);
}
.card p { color: var(--ink-soft); font-size: 0.98rem; }

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 1.1rem;
}

/* how we work */

.how-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.2rem 3rem;
}

.how-num {
  color: var(--accent);
  font-size: 0.95rem;
  display: block;
  margin-bottom: 0.4rem;
}
.how-item p { color: var(--ink-soft); font-size: 0.98rem; }

/* about */

.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 3.5rem;
  align-items: center;
}
.about-grid p { color: var(--ink-soft); margin-bottom: 1rem; }
.about-grid h2 { margin-bottom: 1.2rem; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
}
.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
}
.stat-label { font-size: 0.85rem; color: var(--ink-soft); }

/* contact */

.section-contact { text-align: center; padding-bottom: 6.5rem; }
.section-contact .section-lede { margin-left: auto; margin-right: auto; }
.section-contact .kicker { color: var(--accent); }

/* contact form */

.contact-form {
  max-width: 640px;
  margin: 0 auto;
  text-align: left;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.contact-form label { display: block; margin-bottom: 1.2rem; }
.contact-form label span {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.contact-form textarea { resize: vertical; }

.hp-field {
  position: absolute !important;
  left: -9999px;
  height: 0; width: 0;
  opacity: 0;
  pointer-events: none;
}

.form-foot {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}
.form-foot .btn { border: none; cursor: pointer; font-family: var(--font-body); }
.form-foot .btn:disabled { opacity: 0.6; cursor: wait; transform: none; }

.form-status { font-size: 0.95rem; color: var(--ink-soft); min-height: 1.4em; }
.form-status.ok { color: var(--teal); font-weight: 600; }
.form-status.err { color: #b3402a; font-weight: 600; }

.contact-alt { margin-top: 2rem; color: var(--ink-soft); font-size: 0.95rem; }
.contact-alt a { color: var(--accent); font-weight: 600; text-decoration: none; }
.contact-alt a:hover { text-decoration: underline; }

/* ---------- finishing touches ---------- */

::selection { background: var(--accent-soft); color: var(--ink); }

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .thread-underline path { animation: none; stroke-dashoffset: 0; }
  .card, .btn { transition: none; }
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.6rem 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.footer-tag { font-size: 0.78rem; opacity: 0.65; }

/* ---------- reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- responsive ---------- */

@media (max-width: 820px) {
  .card-grid, .how-grid, .about-grid, .stats { grid-template-columns: 1fr; }
  .about-grid { gap: 2.5rem; }
  .stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .form-row { grid-template-columns: 1fr; gap: 0; }

  .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    display: none;
    padding: 0.5rem 1.5rem 1rem;
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 0.7rem 0; font-size: 1.05rem; }
  .nav-cta { margin-top: 0.5rem; }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
  }
  .nav-toggle span {
    width: 24px; height: 2px;
    background: var(--ink);
    transition: transform 0.2s, opacity 0.2s;
  }
  .nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }

  .hero { padding-top: 3.5rem; }
  .section { padding: 3.5rem 0; }
}
