/* Motoko model showcase — ICP Hub Egypt.
   Bright product page. Self-contained: system font stacks only, no external
   assets. Palette: deep blue #0f4c9e, primary #1a73c7, mid #2b93dd,
   light #4aa3e6, slate #33405c on white and pale blue tints. */

:root {
  --deep: #0f4c9e;
  --brand: #1a73c7;
  --mid: #2b93dd;
  --lightblue: #4aa3e6;
  --ink: #172026;
  --slate: #33405c;
  --muted: #5d6b85;
  --faint: #8b98b0;
  --line: #d9e9fb;
  --line-soft: #e4f0fc;
  --tint: #f2f8ff;
  --tint-2: #eef5fd;
  --card: #ffffff;
  --pass: #0c8a5c;
  --pass-ink: #0c6b47;
  --pass-bg: #e5f7ee;
  --pass-line: #bde7d2;
  --fail: #b3261e;
  --fail-bg: #fdecea;
  --fail-line: #f5c6c1;
  --warn-ink: #8a6100;
  --warn-bg: #fdf3df;
  --warn-line: #f0dcae;
  --grad-brand: linear-gradient(135deg, #0f4c9e, #1a73c7);
  --grad-hero: linear-gradient(120deg, #0f4c9e 0%, #1a73c7 55%, #3f9be0 100%);
  --shadow-card: 0 10px 40px rgba(15, 76, 158, 0.08);
  --shadow-btn: 0 6px 18px rgba(15, 76, 158, 0.28);
  --sans: "Helvetica Neue", Arial, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DejaVu Sans Mono", Menlo, Consolas, "Cascadia Code", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--slate);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background: linear-gradient(150deg, #ffffff 0%, #eef5fd 62%, #e4eefb 100%) fixed;
}

body { overflow-x: hidden; }

::selection { background: rgba(74, 163, 230, 0.3); }

a { color: var(--brand); }

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--tint);
  border-radius: 4px;
  padding: 0.08em 0.3em;
  color: var(--deep);
}

/* ---------- hero figure: the 3D loop lives here, and only here ---------- */

.hero-figure {
  position: relative;
  min-height: clamp(320px, 40vw, 560px);
}

/* a soft stage tint behind the object: the composition's own boundary,
   fading to nothing well before the hero ends */
.hero-figure::before {
  content: "";
  position: absolute;
  inset: -1rem;
  background: radial-gradient(closest-side,
    rgba(26, 115, 199, 0.10), rgba(26, 115, 199, 0.045) 55%, transparent 78%);
  pointer-events: none;
}

#substrate {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

body.no-webgl #substrate,
body.no-webgl .hero-figure { display: none; }

body.no-webgl .hero-inner { grid-template-columns: 1fr; }

header.top, main, footer { position: relative; z-index: 1; }

/* ---------- shell ---------- */

.wrap {
  width: min(1120px, 100% - 2.6rem);
  margin-inline: auto;
}

header.top {
  position: sticky;
  top: 0;
  z-index: 6;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid var(--line-soft);
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
}

.brand { display: flex; align-items: baseline; gap: 0.6rem; }

.brand-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--grad-brand);
  align-self: center;
  box-shadow: 0 0 0 4px rgba(26, 115, 199, 0.14);
}

.brand-name {
  font-weight: 700;
  color: var(--deep);
  letter-spacing: -0.01em;
}

.brand-org {
  color: var(--faint);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- pills / notes ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  white-space: nowrap;
}

.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }

.pill-ok   { color: var(--pass-ink); border-color: var(--pass-line); background: var(--pass-bg); }
.pill-ok   .pill-dot { background: var(--pass); }
.pill-down { color: var(--warn-ink); border-color: var(--warn-line); background: var(--warn-bg); }
.pill-down .pill-dot { background: #e0a62c; }
.pill-dead { color: var(--fail); border-color: var(--fail-line); background: var(--fail-bg); }
.pill-dead .pill-dot { background: var(--fail); }
.pill-wait .pill-dot { background: var(--faint); }

.note {
  border: 1px solid;
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  margin: 0 0 1.1rem;
  font-size: 0.95rem;
}

.note-warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); }
.note-fail { border-color: var(--fail-line); background: var(--fail-bg); color: var(--fail); }

.note .btn { margin-left: 0.6rem; }

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

.hero {
  padding: clamp(4.5rem, 13vh, 9rem) 0 clamp(3rem, 8vh, 6rem);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 6.4fr) minmax(0, 5.6fr);
  gap: clamp(1.6rem, 4vw, 3.4rem);
  align-items: center;
}

.hero-copy { max-width: 640px; min-width: 0; }

.eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 1.2rem;
}

.headline {
  font-size: clamp(2.6rem, 6.8vw, 4.9rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 1.5rem;
  text-wrap: balance;
}

.headline br + * { color: inherit; }

.lede {
  font-size: 1.18rem;
  color: var(--slate);
  max-width: 58ch;
  margin: 0 0 2.2rem;
}

.hero-cta-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2.4rem;
}

.hero-number {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.hero-number strong {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad-hero);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-number span {
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 24ch;
  line-height: 1.35;
}

.substrate-caption {
  font-size: 0.82rem;
  color: var(--faint);
  max-width: 52ch;
  border-left: 3px solid var(--line);
  padding-left: 0.9rem;
  margin: 0;
}

body.no-webgl .substrate-caption { display: none; }

/* ---------- bands & panels ---------- */

.band { padding: 2.4rem 0; }

.band-tint {
  background: rgba(242, 248, 255, 0.75);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.8rem 2rem;
  box-shadow: var(--shadow-card);
}

.panel-head { margin-bottom: 1.2rem; }

.panel-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 0.25rem;
}

.panel-hint { font-size: 0.95rem; color: var(--muted); margin: 0; }

/* ---------- console ---------- */

.panel-console {
  position: relative;
  overflow: hidden;
}

.panel-console::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--grad-hero);
}

#prompt, #feedback-message {
  width: 100%;
  resize: vertical;
  min-height: 4.4rem;
  background: var(--tint);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 0.98rem;
  line-height: 1.55;
  padding: 0.9rem 1rem;
}

#prompt:focus-visible, #feedback-message:focus-visible,
#feedback-contact:focus-visible, #bundle-name:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 115, 199, 0.22);
  background: #ffffff;
}

#prompt::placeholder, #feedback-message::placeholder,
#feedback-contact::placeholder { color: var(--faint); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.9rem 0 1.3rem;
}

.chip {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--brand);
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 0.4rem 0.95rem;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
  max-width: 100%;
}

.chip:hover, .chip:focus-visible {
  background: var(--tint-2);
  border-color: var(--lightblue);
}

.console-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.status-line {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
  min-height: 1.2em;
}

.status-line.is-fail { color: var(--fail); }
.status-line.is-pass { color: var(--pass-ink); }
.status-line.is-busy { color: var(--warn-ink); }

.busy-countdown { font-weight: 700; white-space: nowrap; }

.load-line {
  font-size: 0.78rem;
  color: var(--faint);
  margin: 0.8rem 0 0;
}

.load-line.is-hot { color: var(--warn-ink); }

/* ---------- buttons ---------- */

.btn {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 0.75rem 1.6rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 130ms, box-shadow 130ms, background 130ms;
}

.btn:focus-visible {
  outline: 3px solid rgba(26, 115, 199, 0.4);
  outline-offset: 2px;
}

.btn-primary, .btn-hero {
  background: var(--grad-brand);
  color: #ffffff;
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover:not(:disabled), .btn-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(15, 76, 158, 0.36);
}

.btn-hero {
  font-size: 1.08rem;
  padding: 0.95rem 2.2rem;
  border-radius: 14px;
}

.btn-primary:disabled {
  background: #c9d8ec;
  color: #75849e;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: #ffffff;
  color: var(--brand);
  border-color: var(--line);
}

.btn-ghost:hover { border-color: var(--lightblue); background: var(--tint); }

.btn-small { font-size: 0.78rem; padding: 0.35rem 0.85rem; border-radius: 8px; }

/* ---------- result ---------- */

.result-head {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.badge {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.5rem 1.2rem;
  border-radius: 99px;
  border: 1px solid;
}

.badge-pass { color: var(--pass-ink); border-color: var(--pass-line); background: var(--pass-bg); }
.badge-fail { color: var(--fail); border-color: var(--fail-line); background: var(--fail-bg); }
.badge-indet { color: var(--warn-ink); border-color: var(--warn-line); background: var(--warn-bg); }

.verdict-meta { font-size: 0.95rem; color: var(--muted); margin: 0; max-width: 60ch; }

.verdict-error {
  margin: 0 0 1.1rem;
  padding: 1rem 1.2rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--fail);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--fail-bg);
  border: 1px solid var(--fail-line);
  border-radius: 12px;
  max-height: 16rem;
  overflow-y: auto;
}

/* the centrepiece: the generated program */

.codecard {
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.codecard.is-pass { border-color: var(--pass-line); box-shadow: 0 12px 44px rgba(12, 138, 92, 0.12); }
.codecard.is-fail { border-color: var(--fail-line); }

.codecard-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1.1rem;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #ffffff, var(--tint-2));
}

.codecard-name {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--deep);
}

pre.code {
  margin: 0;
  padding: 1.3rem 1.4rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.65;
  tab-size: 2;
  color: var(--ink);
}

pre.code code { background: none; padding: 0; font-size: inherit; color: inherit; }

/* Motoko token colors, light theme, accessible on #fbfdff */
.tk-kw  { color: var(--deep); font-weight: 700; }
.tk-ty  { color: var(--brand); }
.tk-str { color: var(--pass-ink); }
.tk-num { color: #a1490c; }
.tk-com { color: #6f7f95; font-style: italic; }
.tk-fn  { color: #6d28d9; }

.bundle-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

.bundle-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

#bundle-name, #feedback-contact {
  font-family: var(--mono);
  font-size: 0.92rem;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  width: 15rem;
  max-width: 100%;
}

#bundle-name.is-invalid { border-color: var(--fail); }

.bundle-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.9rem 0 0;
  max-width: 62ch;
}

/* ---------- the number ---------- */

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.8rem;
}

.big-number {
  font-size: clamp(3.4rem, 7vw, 5.2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0.5rem 0 0.3rem;
  background: var(--grad-hero);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.number-label {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.9rem;
}

.prose { font-size: 0.92rem; color: var(--muted); margin: 0.5rem 0 0; }

.live-stats { min-height: 5.4rem; }

/* resting state: what the counter card shows when it has no figure yet */

.live-rest {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-top: 0.6rem;
}

.live-rest-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mid);
  box-shadow: 0 0 0 4px rgba(43, 147, 221, 0.15);
  margin-top: 0.45rem;
  animation: live-rest-pulse 2.6s ease-in-out infinite;
}

@keyframes live-rest-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.live-rest-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
}

.live-rest .prose { margin: 0.2rem 0 0; }

.live-number {
  font-size: clamp(2.6rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--pass);
  margin: 0.5rem 0 0.3rem;
}

/* ---------- feedback ---------- */

.panel-feedback { max-width: 760px; }

.feedback-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

#feedback-contact { flex: 1 1 14rem; }

.feedback-result {
  margin: 0.9rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 1.2em;
  color: var(--muted);
}

.feedback-result.is-ok { color: var(--pass-ink); }
.feedback-result.is-fail { color: var(--fail); }

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

.footer {
  margin-top: 2.5rem;
  background: var(--grad-brand);
  color: #eaf3fc;
  font-size: 0.88rem;
}

.footer .wrap { padding: 2rem 0; }

.footer p { margin: 0; }

/* ---------- a11y ---------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

html { scroll-behavior: smooth; }

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

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .brand-org { display: none; }
  .panel { padding: 1.3rem 1.2rem; }
  .hero-cta-row { gap: 1.2rem; }
  .hero { padding-top: clamp(2.6rem, 7vh, 4.5rem); }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-copy { max-width: none; }
  .hero-figure { min-height: 300px; }
}

@media (max-width: 480px) {
  .hero-figure { min-height: 240px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .chip { transition: none; }
  .btn-primary:hover:not(:disabled), .btn-hero:hover { transform: none; }
  .live-rest-dot { animation: none; }
}
