/* agentsmith.org.uk — Matrix parody landing for NordSys Agent Teams */

:root {
  --bg: #000;
  --green: #00ff66;
  --green-dim: #2a8f4f;
  --green-soft: rgba(0, 255, 102, 0.15);
  --blue: #4aa3ff;
  --blue-dim: #1d5fa8;
  --red: #ff3850;
  --red-dim: #a8232f;
  --ink: #d8e4d8;
  --ink-soft: rgba(216, 228, 216, 0.55);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#rain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.22;
}

main {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem 6rem;
  text-align: center;
}

.wake {
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: var(--green-dim);
  font-style: italic;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadein 1.2s ease 0.2s forwards;
}

h1 {
  font-family: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: clamp(3rem, 9vw, 6rem);
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 1.25rem;
  min-height: 1.1em;
}

.cursor {
  display: inline-block;
  width: 0.6ch;
  background: var(--green);
  margin-left: 0.1ch;
  animation: blink 1.05s steps(2, start) infinite;
}

.sub {
  max-width: 36rem;
  margin: 0 auto 3.5rem;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink-soft);
  opacity: 0;
  animation: fadein 1.4s ease 2.4s forwards;
}

.sub strong {
  color: var(--ink);
  font-weight: 500;
}

.pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3rem;
  max-width: 64rem;
  width: 100%;
  margin: 0 auto;
  opacity: 0;
  animation: fadein 1.4s ease 3.2s forwards;
}

@media (max-width: 720px) {
  .pills { grid-template-columns: 1fr; gap: 2.25rem; }
}

.pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 18px;
  outline: none;
}

.pill .capsule {
  position: relative;
  width: clamp(220px, 28vw, 320px);
  height: clamp(86px, 11vw, 124px);
  border-radius: 999px;
  margin-bottom: 1.6rem;
  transform-origin: center;
  transition: transform 0.6s cubic-bezier(.2,.7,.2,1), filter 0.6s ease;
  filter: drop-shadow(0 18px 36px var(--glow-deep)) drop-shadow(0 0 28px var(--glow));
}

.pill.blue .capsule {
  --glow: rgba(74, 163, 255, 0.55);
  --glow-deep: rgba(29, 95, 168, 0.45);
  background: linear-gradient(135deg,
    #6db8ff 0%,
    #4aa3ff 35%,
    #1d5fa8 75%,
    #0d3a72 100%);
}

.pill.red .capsule {
  --glow: rgba(255, 56, 80, 0.55);
  --glow-deep: rgba(168, 35, 47, 0.45);
  background: linear-gradient(135deg,
    #ff7585 0%,
    #ff3850 35%,
    #a8232f 75%,
    #6e1620 100%);
}

/* Glossy highlight ribbon along the top of the capsule */
.pill .capsule::before {
  content: "";
  position: absolute;
  top: 12%;
  left: 8%;
  right: 8%;
  height: 28%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.65) 0%, rgba(255,255,255,0.05) 100%);
  filter: blur(0.5px);
  pointer-events: none;
}

/* Soft inner shadow at the bottom for depth */
.pill .capsule::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  box-shadow: inset 0 -10px 22px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
  pointer-events: none;
}

.pill .tag {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}

.pill.blue .tag { color: #6db8ff; }
.pill.red  .tag { color: #ff7585; }

.pill h2 {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-weight: 500;
  font-size: clamp(1.35rem, 2.2vw, 1.65rem);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 0.55rem;
  text-align: center;
}

.pill p {
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 22rem;
  text-align: center;
}

.pill:hover .capsule,
.pill:focus-visible .capsule {
  filter:
    drop-shadow(0 22px 44px var(--glow-deep))
    drop-shadow(0 0 44px var(--glow));
}

.pill.blue:hover .capsule,
.pill.blue:focus-visible .capsule {
  animation: breathe-left 2.4s ease-in-out infinite;
}

.pill.red:hover .capsule,
.pill.red:focus-visible .capsule {
  animation: breathe-right 2.4s ease-in-out infinite;
}

@keyframes breathe-left {
  0%, 100% { transform: translateY(-6px) scale(1.04) rotate(-3deg); }
  50%      { transform: translateY(-10px) scale(1.08) rotate(-3deg); }
}

@keyframes breathe-right {
  0%, 100% { transform: translateY(-6px) scale(1.04) rotate(3deg); }
  50%      { transform: translateY(-10px) scale(1.08) rotate(3deg); }
}

footer {
  position: fixed;
  bottom: 1.25rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  z-index: 1;
  opacity: 0;
  animation: fadein 1.6s ease 1.4s forwards;
}

footer a {
  color: var(--green-dim);
  text-decoration: none;
  border-bottom: 1px dotted var(--green-soft);
}
footer a:hover { color: var(--green); border-bottom-color: var(--green); }

/* ── /awake ── */
body.awake { background: var(--bg); }
body.awake .glow {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.4rem, 7.5vw, 4.8rem);
  color: var(--ink);
  text-shadow: 0 0 24px rgba(0, 255, 102, 0.45), 0 0 48px rgba(0, 255, 102, 0.18);
  letter-spacing: -0.015em;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadein 1.6s ease 0.5s forwards;
}

body.awake .lead {
  max-width: 40rem;
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0 auto 3rem;
  opacity: 0;
  animation: fadein 1.4s ease 1.5s forwards;
}

body.awake .lead strong { color: var(--ink); font-weight: 500; }
body.awake .lead em { color: var(--green); font-style: normal; }

.agents {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  max-width: 60rem;
  margin: 0 auto 3.5rem;
  width: 100%;
  opacity: 0;
  animation: fadein 1.4s ease 2.4s forwards;
}

@media (max-width: 820px) {
  .agents { grid-template-columns: 1fr; }
}

.agent {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(0, 255, 102, 0.12);
  border-radius: 12px;
  padding: 1.6rem 1.4rem;
  text-align: left;
  transition: border-color 0.45s ease, transform 0.45s ease;
}

.agent:hover {
  border-color: rgba(0, 255, 102, 0.32);
  transform: translateY(-2px);
}

.agent .emoji {
  font-size: 1.6rem;
  margin-bottom: 0.7rem;
  display: block;
}

.agent h3 {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-weight: 500;
  font-size: 1.15rem;
  color: var(--ink);
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.agent p {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.cta {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--bg);
  background: var(--green);
  padding: 0.95rem 1.8rem;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid var(--green);
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  opacity: 0;
  animation: fadein 1.4s ease 3.4s forwards;
  box-shadow: 0 0 0 0 var(--green-soft);
}

.cta:hover, .cta:focus-visible {
  background: transparent;
  color: var(--green);
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 0 24px 0 rgba(0, 255, 102, 0.35);
}

.cta .arrow {
  display: inline-block;
  margin-left: 0.4rem;
  transition: transform 0.3s ease;
}
.cta:hover .arrow { transform: translateX(3px); }

/* ── /sleep ── */
body.sleep #rain { opacity: 0.06; }

body.sleep .matrix-line {
  font-size: 1rem;
  color: var(--green-dim);
  font-style: italic;
  letter-spacing: 0.08em;
  margin-bottom: 1.4rem;
  opacity: 0;
  animation: fadein 1.8s ease 1.2s forwards;
}

body.sleep .farewell {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.2rem, 7vw, 4.2rem);
  color: var(--ink);
  letter-spacing: -0.015em;
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadein 1.8s ease 1.6s forwards;
}

body.sleep .farewell-sub {
  max-width: 32rem;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0 auto 4rem;
  opacity: 0;
  animation: fadein 1.6s ease 2.4s forwards;
}

body.sleep .wake-link {
  display: inline-block;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--green-dim);
  text-decoration: none;
  font-style: italic;
  opacity: 0;
  animation: fadein 1.4s ease 3.2s forwards;
  transition: color 0.3s ease;
}
body.sleep .wake-link:hover { color: var(--green); }
body.sleep .wake-link .arrow { margin-left: 0.3rem; transition: transform 0.3s ease; }
body.sleep .wake-link:hover .arrow { transform: translateX(3px); }

/* Blackout overlay for blue-pill click */
.blackout {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.65s ease;
}
.blackout.on { opacity: 1; pointer-events: auto; }

/* White flash for red-pill click */
.flash {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.flash.on { opacity: 1; pointer-events: auto; }

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

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #rain { display: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .wake, .sub, .pills, footer, .cta,
  body.awake .glow, body.awake .lead, .agents,
  body.sleep .matrix-line, body.sleep .farewell, body.sleep .farewell-sub, body.sleep .wake-link {
    opacity: 1;
  }
}
