/* Keystone Codex product page. Loads after landing.css and only adds what the
   homepage does not have: a still-image hero, the rules ledger, the audit-log
   card, and a bare statement section. Every color is the landing's. */

/* ---------- hero: the landing frame, holding a still ---------- */

.kx-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
}

.kx-hero-grad {
  background:
    linear-gradient(to bottom, rgb(0 0 0 / 0.16) 0%, rgb(0 0 0 / 0.08) 30%, rgb(0 0 0 / 0.74) 72%, rgb(0 0 0 / 0.96) 100%),
    linear-gradient(to right, rgb(0 0 0 / 0.32), transparent 48%);
}

@media (min-width: 768px) {
  .kx-hero-content {
    grid-template-columns: minmax(0, 1.35fr) minmax(18rem, 24rem);
  }
}

.kx-hero-kicker {
  margin-bottom: 0.9rem;
  color: #e1e0cc;
}

.kx-hero-kicker span {
  margin-left: 0.65rem;
  color: #c46f4a;
}

.kx-h1 {
  margin: 0;
  max-width: 15ch;
  color: #e1e0cc;
  font-family: Almarai, sans-serif;
  font-weight: 400;
  font-size: clamp(2.5rem, 6vw, 5.4rem);
  letter-spacing: -0.045em;
  line-height: 0.92;
}

.kx-h1 .word {
  display: inline-block;
  overflow: hidden;
  margin-right: 0.24em;
  vertical-align: bottom;
}

.kx-h1 .word > span {
  display: inline-block;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.kx-h1.is-in .word > span {
  transform: translateY(0);
  opacity: 1;
}

.kx-h1.is-in .word { overflow: visible; }

.kx-hero .landing-hero-copy p {
  max-width: 25rem;
  color: rgb(225 224 204 / 0.86);
  line-height: 1.4;
}

/* A failed script request must leave the introduction and contact link usable. */
.keystone-page .landing-hero-copy p,
.keystone-page .landing-hero .landing-cta {
  opacity: 1;
  transform: none;
}

/* The phone tab hides Work on the homepage; here the same slot is All work. */
@media (max-width: 639px) {
  .keystone-page .landing-nav a[href="/#work"] { display: none; }
}

/* ---------- at a glance: four cells under the what-it-is copy ---------- */

.kx-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.4rem 1.5rem;
  width: 100%;
  max-width: none;
  margin: 3rem 0 0;
  padding-top: 1.8rem;
  border-top: 1px solid rgb(225 224 204 / 0.14);
  text-align: left;
}

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

.kx-meta div { min-width: 0; }

.kx-meta dt {
  margin: 0 0 0.4rem;
  color: #9ca3af;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kx-meta dd {
  margin: 0;
  color: #e1e0cc;
  font-size: 0.9rem;
  line-height: 1.3;
}

.kx-what .landing-about-card {
  max-width: 80rem;
  border-radius: 1.25rem;
  text-align: left;
}

.kx-what .landing-about-h {
  max-width: 55rem;
  margin: 0;
}

.kx-what .landing-about-body {
  max-width: 44rem;
  margin: 2rem 0 0;
  color: rgb(225 224 204 / 0.78);
}

/* ---------- how it behaves: ruled ledger plus the audit-log card ---------- */

.kx-behaves-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}

@media (min-width: 1024px) {
  .kx-behaves-grid {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 21rem);
    gap: clamp(2.5rem, 5vw, 5rem);
    align-items: start;
  }
  .kx-log {
    position: sticky;
    top: 4.5rem;
  }
}

.kx-rules {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: none;
}

@media (min-width: 768px) {
  .kx-rules {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(2rem, 4vw, 4rem);
  }
}

.kx-rule {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0.5rem 0.9rem;
  padding: 1.3rem 0 1.4rem;
  border-top: 1px solid rgb(225 224 204 / 0.14);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.kx-rule.kx-reveal:not(.is-in) {
  opacity: 0;
  transform: translateY(14px);
}

.kx-rule-n {
  padding-top: 0.28rem;
  color: #c46f4a;
  font-size: 0.7rem;
}

.kx-rule h3 {
  margin: 0;
  color: #e1e0cc;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.kx-rule p {
  margin: 0.5rem 0 0;
  max-width: 38rem;
  color: rgb(222 219 200 / 0.72);
  font-size: 0.95rem;
  line-height: 1.5;
}

.kx-log {
  min-width: 0;
  padding: 1.1rem 1.1rem 1.15rem;
  border-radius: 1.1rem;
  border: 1px solid rgb(225 224 204 / 0.13);
  background: #171717;
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.kx-log.kx-reveal:not(.is-in) {
  opacity: 0;
  transform: scale(0.95);
}

.kx-log-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgb(225 224 204 / 0.12);
  color: #9ca3af;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kx-log-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #e1e0cc;
}

.kx-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c46f4a;
}

.kx-log-lines {
  list-style: none;
  margin: 0;
  padding: 0.9rem 0 0;
  min-height: calc(2.05em * 8 + 0.9rem);
  color: #9ca3af;
  font-family: 'IBM Plex Mono', 'SF Mono', Menlo, monospace;
  font-size: 0.75rem;
  letter-spacing: 0;
  line-height: 2.05;
}

.kx-log-lines li {
  min-height: 2.05em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.kx-log-lines li.is-new {
  animation: kx-line-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.kx-log-toggle {
  display: block;
  min-height: 44px;
  margin: 0.75rem 0 0 auto;
  padding: 0.5rem 0.85rem;
  border: 1px solid rgb(225 224 204 / 0.3);
  border-radius: 0.4rem;
  background: transparent;
  color: #e1e0cc;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.kx-log-toggle[hidden] { display: none; }
.kx-log-toggle:hover:not(:disabled) { background: rgb(225 224 204 / 0.08); }
.kx-log-toggle:focus-visible { outline: 2px solid #e1e0cc; outline-offset: 3px; }
.kx-log-toggle:disabled { color: #9ca3af; cursor: default; }

.log-t {
  margin-right: 0.5em;
  color: #9ca3af;
}

.log-sig { color: #e1e0cc; }

@keyframes kx-line-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes kx-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: no-preference) {
  .kx-log.is-playing .kx-dot { animation: kx-pulse 2.6s ease-in-out infinite; }
}

/* ---------- the rule: one quiet, decisive statement ---------- */

.kx-statement {
  background: #000;
  padding: clamp(6rem, 13vw, 11rem) 1.25rem;
  text-align: left;
}

.kx-statement-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding-top: 2rem;
  border-top: 1px solid rgb(225 224 204 / 0.16);
}

.kx-statement .landing-about-h {
  max-width: 58rem;
  margin: 0;
}

/* ---------- close: the contact card, without the form ---------- */

.kx-cta .landing-cta {
  opacity: 1;
  transform: none;
  transition: gap 0.25s ease;
}

.kx-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.6rem;
}

.kx-cta-mail {
  color: rgb(225 224 204 / 0.78);
  font-size: 0.95rem;
  border-bottom: 1px solid rgb(225 224 204 / 0.25);
  transition: color 0.25s ease, border-color 0.25s ease;
}

.kx-cta-mail:hover,
.kx-cta-mail:focus-visible {
  color: #e1e0cc;
  border-color: #e1e0cc;
}

#what,
#behaves {
  scroll-margin-top: 4.5rem;
}

@media (prefers-reduced-motion: reduce) {
  .kx-h1 .word > span,
  .kx-rule,
  .kx-log {
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }
  .kx-log-lines li.is-new { animation: none; }
}
