/* ──────────────────────────────────────────────
   Cubicle™ Styles
   ────────────────────────────────────────────── */

/* ============= Design Tokens ============= */
:root {
  /* Palette */
  --bg: #27272B;        /* primary background */
  --black: #27272B;     /* for selection contrast */
  --text: #F4F5F6;
  --green: #84E296;     /* status glow */
  --purple: #B979B0;    /* status / selection */
  --yellow: #FFCB47;    /* spare accent */
  --muted: #B8BBC2;

  /* Spacing & Gutters */
  --gutter-base: 56px;
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --gutter: calc(var(--gutter-base) + var(--safe-left));
  --gutter-r: calc(var(--gutter-base) + var(--safe-right));

  /* Typography */
  --font: "Neue Montreal", Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial;
}

/* ============= Base / Reset ============= */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Selection */
::selection {
  background: var(--purple);
  color: var(--black);
}

::-moz-selection {
  background: var(--purple);
  color: var(--black);
}

/* Shared small type scale */
.line,
.mantra,
.manifesto-link,
.status-line,
.monitor {
  font-weight: 400;
  font-size: 16px;
  line-height: 19px;
}

/* ============= Header ============= */
.hdr {
  position: fixed;
  inset: 0 0 auto 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--gutter-base) var(--gutter-r) 24px var(--gutter);
  background: var(--bg);
  z-index: 1000;
}

.hdr-left {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hdr-right {
  display: flex;
  align-items: flex-start;
}

/* Status pill */
.monitor {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--green);
  white-space: nowrap;
  text-align: right;
  opacity: 0.5;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(132, 226, 150, .75);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: .7;
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
  }
}

/* ============= Landing Frame ============= */
.landing {
  overflow: hidden;  /* full-screen, no scroll */
}

.frame {
  position: relative;
  height: 100vh;     /* canvas = viewport */
}

/* Center block: loading → code stream → final note */
.mantra-block {
  position: absolute;
  top: 50%;
  left: var(--gutter);
  right: var(--gutter-r);
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 70ch;
  text-align: left;
}

.mantra {
  margin: 0;
}

/* Code Stream */
.code-stream {
  max-height: 180px;
  opacity: 0.5;
  overflow: hidden;
  pointer-events: none;
}

.code-stream__pre {
  margin: 0;
  height: 100%;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: var(--green);
  text-shadow:
    0 0 4px rgba(132, 226, 150, .25),
    0 0 8px rgba(132, 226, 150, .25),
    0 0 12px rgba(132, 226, 150, .25);
}

/* Loading dots (sequential) */
.loading-dots span {
  opacity: 0;
  animation: dotBlink 1.4s infinite;
}

.loading-dots span:nth-child(1) {
  animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
  animation-delay: .2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: .4s;
}

@keyframes dotBlink {
  0% { opacity: 0; }
  30% { opacity: 1; }
  60% { opacity: 0; }
  100% { opacity: 0; }
}

/* ============= Footer ============= */
.footer {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter-r);
  bottom: var(--gutter-base);
  display: flex;
  justify-content: space-between; /* pushes left + right apart */
  align-items: center;
}

/* Left CTA */
.foot-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Right status */
.foot-right {
  text-align: right;
}

.manifesto-link {
  color: var(--text);
  text-decoration: none;
  letter-spacing: .02em;
}

.manifesto-link:hover {
  text-decoration: underline;
}

.status-line {
  margin: 0;
  text-align: right;
  color: var(--purple);
}

/* ============= Manifesto Page ============= */
.manifesto {
  overflow: auto;
}

.manifesto-frame {
  padding: calc(var(--gutter-base) + 72px) var(--gutter-r) calc(var(--gutter-base) * 1.5) var(--gutter);
}

.manifesto-top-nav,
.manifesto-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 20px;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.back-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.manifesto-doc {
  max-width: 78ch;
}

.doc-header h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
}

.doc-sub {
  margin: 0 0 18px;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--muted);
}

.doc-rule {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, 0));
  margin: 12px 0 24px;
}

.doc-section {
  margin: 28px 0;
}

.doc-section h3 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
}

.doc-section h4 {
  margin: 18px 0 8px;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
}

.manifesto-doc p {
  margin: 10px 0;
}

.manifesto-doc ul,
.manifesto-doc ol {
  margin: 10px 0 10px 1.2rem;
  padding: 0;
}

.manifesto-doc li {
  margin: 6px 0;
}

/* ============= Loading Screen ============= */
.loading-screen {
  background: var(--bg);  /* sterile black */
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.loading-icon img {
  width: 55px;
  height: 55px;
  display: block;
  opacity: 0.9;
  animation: pulseFade 2s ease-in-out infinite;
}

@keyframes pulseFade {
  0%, 100% {
    opacity: 0.9;
    transform: scale(1);
  }
  50% {
    opacity: 0.11;
    transform: scale(0.95);
  }
}

/* ============= Responsive ============= */
@media (max-width: 900px) {
  :root {
    --gutter-base: 24px;
  }
}

@media (max-width: 560px) {
  .hdr-left {
    width: 170px;
  }

  /* soften stream presence on small screens */
  .code-stream {
    opacity: 0.5;
    height: 30vh;
  }

  /* footer stacks: manifesto above status, both left-aligned */
  .foot-left {
    left: var(--gutter);
    bottom: calc(var(--gutter-base) + 24px);
    align-items: flex-start;
  }

  .foot-right {
    left: var(--gutter);
    right: auto;
    bottom: var(--gutter-base);
  }

  .status-line {
    text-align: left;
  }
}

/* ============= Reduced Motion ============= */
@media (prefers-reduced-motion: reduce) {
  .rec-dot {
    animation: none;
  }

  .loading-dots span {
    animation: none;
  }

  .loading-icon img {
    animation: none;
  }

  .code-stream__pre::after {
    content: "telemetry.stream: awaiting input…";
    opacity: .7;
  }
}