:root {
  --bg-top: #dce8ff;
  --bg-bottom: #f7f4ef;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --border: rgba(72, 105, 193, 0.14);
  --ink: #14213d;
  --muted: #56637a;
  --accent: #4a72ff;
  --accent-soft: #7ea2ff;
  --accent-pale: rgba(74, 114, 255, 0.12);
  --shadow: 0 30px 80px rgba(20, 33, 61, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 32%),
    linear-gradient(180deg, var(--bg-top) 0%, #eef3ff 18%, var(--bg-bottom) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(74, 114, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 114, 255, 0.04) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 85%);
  pointer-events: none;
}

.page-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 40px 20px;
  overflow: hidden;
}

.ambient {
  position: absolute;
  width: 420px;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(14px);
  opacity: 0.7;
  pointer-events: none;
}

.ambient-left {
  top: 6%;
  left: -180px;
  background: radial-gradient(circle, rgba(74, 114, 255, 0.28), transparent 68%);
}

.ambient-right {
  right: -140px;
  bottom: 10%;
  background: radial-gradient(circle, rgba(126, 162, 255, 0.28), transparent 68%);
}

.hero-card {
  position: relative;
  width: min(1120px, 100%);
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 36px;
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: rise-in 700ms ease-out both;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.9),
    rgba(126, 162, 255, 0.35),
    rgba(255, 255, 255, 0.65)
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 22px;
  font-size: 0.82rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-layout {
  display: block;
}

.hero-copy {
  padding: 18px 12px 18px 6px;
  max-width: 920px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-pale);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  width: fit-content;
}

.status-dot { display: none; }

.headline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  margin-top: 22px;
}

.headline-mark {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  position: relative;
  width: clamp(228px, 30vw, 360px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.96), transparent 24%),
    radial-gradient(circle at 50% 50%, rgba(126, 162, 255, 0.16), rgba(74, 114, 255, 0.04) 62%, transparent 63%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(241, 246, 255, 0.4));
  border: 1px solid rgba(74, 114, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 28px 52px rgba(74, 114, 255, 0.14);
}

.headline-mark::before {
  content: "";
  position: absolute;
  inset: clamp(16px, 2vw, 24px);
  border-radius: 50%;
  border: 1px solid rgba(74, 114, 255, 0.12);
}

.headline-mark::after {
  content: "";
  position: absolute;
  top: clamp(26px, 3vw, 38px);
  right: clamp(28px, 3vw, 42px);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(74, 114, 255, 0.28);
  box-shadow: 0 0 0 10px rgba(74, 114, 255, 0.06);
}

h1 {
  margin: 0;
  max-width: 11ch;
  font-family: "Avenir Next", "Century Gothic", "Futura", sans-serif;
  font-size: clamp(2.7rem, 5.3vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  text-wrap: balance;
}

.lead {
  margin: 0;
  max-width: 58ch;
  font-size: 1.12rem;
  line-height: 1.7;
  color: var(--muted);
}

.supporting-text {
  margin: 16px 0 0;
  max-width: 60ch;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--muted);
}

.construction-mark {
  position: relative;
  width: clamp(182px, 22vw, 260px);
  height: clamp(182px, 22vw, 260px);
  animation: float 7s ease-in-out infinite;
}

.construction-mark::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px solid rgba(74, 114, 255, 0.1);
}

.construction-mark::after {
  content: "";
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  border: 1px solid rgba(74, 114, 255, 0.08);
}

.gear {
  position: absolute;
  border-radius: 50%;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.gear::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.98) 0 26%, transparent 26% 40%, rgba(74, 114, 255, 0.94) 40% 62%, transparent 62%),
    repeating-conic-gradient(
      from 0deg,
      rgba(74, 114, 255, 0.95) 0deg 16deg,
      rgba(126, 162, 255, 0.32) 16deg 30deg
    );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 12px 24px rgba(74, 114, 255, 0.12);
}

.gear::after {
  content: "";
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 32%, rgba(255, 255, 255, 0.98), rgba(226, 235, 255, 0.96));
  border: 3px solid rgba(74, 114, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.gear-main {
  top: 12%;
  left: 10%;
  width: 54%;
  height: 54%;
  animation-name: spin-clockwise;
  animation-duration: 10s;
}

.gear-small {
  right: 10%;
  bottom: 13%;
  width: 33%;
  height: 33%;
  animation-name: spin-counter;
  animation-duration: 7s;
}

.gear-tiny {
  top: 10%;
  right: 12%;
  width: 14%;
  height: 14%;
  animation-name: spin-counter;
  animation-duration: 5s;
}

.gear-small::after {
  border-width: 2px;
}

.gear-tiny::after {
  border-width: 2px;
}

.construction-dot {
  position: absolute;
  top: 12%;
  right: 14%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(74, 114, 255, 0.32);
  box-shadow:
    0 0 0 9px rgba(74, 114, 255, 0.08),
    0 0 22px rgba(126, 162, 255, 0.46);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(22px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }

  50% {
    transform: translateY(-10px) rotate(2deg);
  }
}

@keyframes spin-clockwise {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes spin-counter {
  from {
    transform: rotate(360deg);
  }

  to {
    transform: rotate(0deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.18);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .hero-copy {
    padding-right: 0;
  }

  .headline-row {
    align-items: flex-start;
  }

  h1 {
    max-width: 14ch;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 20px 14px;
  }

  .hero-card {
    padding: 22px 18px;
    border-radius: 28px;
  }

  .eyebrow {
    margin-bottom: 18px;
    font-size: 0.72rem;
    line-height: 1.6;
  }

  .headline-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  .headline-mark {
    width: min(196px, 58vw);
  }

  .construction-mark {
    width: min(160px, 48vw);
    height: min(160px, 48vw);
  }

  h1 {
    font-size: clamp(2.3rem, 11vw, 3.2rem);
    max-width: none;
  }

  .supporting-text {
    font-size: 0.98rem;
  }
}

/* ── New landing layout ──────────────────────────────────────────────────── */

.page-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 0 20px;
  overflow-x: hidden;
}

.landing-wrap--wide {
  width: min(1400px, 100%) !important;
}

.landing-wrap {
  width: min(1160px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 52px;
  padding: 72px 24px 80px;
}

.hero {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}

.hero-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.hero-propeller {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  animation: spin-clockwise 3s linear infinite;
}

.hero-propeller svg { width: 100%; height: 100%; }

.hero h1 {
  margin: 0;
  font-family: "Avenir Next", "Century Gothic", "Futura", sans-serif;
  font-size: clamp(1.2rem, 2.8vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: -0.035em;
  max-width: none;
}

.lead {
  margin: 0;
  font-size: clamp(0.75rem, 1.28vw, 1.1rem);
  line-height: 1.75;
  color: var(--muted);
  white-space: nowrap;
  max-width: none;
}

.sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  align-items: stretch;
  width: 100%;
}

.section-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(20, 33, 61, 0.07);
  animation: rise-in 600ms ease-out both;
  min-width: 0;
}

.section-card:nth-child(2) { animation-delay: 80ms; }
.section-card:nth-child(3) { animation-delay: 160ms; }

.section-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-icon {
  width: 44px;
  height: 44px;
  padding: 8px;
  border-radius: 12px;
  background: var(--accent-pale);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.section-icon svg { width: 28px; height: 28px; }

.section-card h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.2;
  white-space: nowrap;
}

.section-desc {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: opacity 0.15s, transform 0.12s;
  align-self: flex-start;
  margin-top: auto;
}

.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}

.card-actions .btn { margin-top: 0; }

.btn:hover { opacity: 0.88; transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid rgba(74, 114, 255, 0.35);
}

.uvl-preview {
  margin: 0;
  padding: 14px;
  background: rgba(74, 114, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: "Cascadia Code", "Fira Mono", "Consolas", monospace;
  font-size: 0.68rem;
  line-height: 1.55;
  color: var(--ink);
  max-height: 280px;
  overflow: auto;
  white-space: pre;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.ftree {
  font-size: 0.8rem;
  line-height: 1.6;
}

.ftree-root {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.ftree ul {
  list-style: none;
  margin: 0;
  padding-left: 18px;
  border-left: 1.5px solid var(--border);
}

.ftree li {
  padding: 1px 0 1px 10px;
  position: relative;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.ftree li::before {
  content: "";
  position: absolute;
  left: -1.5px;
  top: 50%;
  width: 10px;
  height: 1.5px;
  background: var(--border);
}

.ftree-label {
  font-weight: 600;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.f-leaf {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.f-optional > .ftree-label,
.f-optional.f-leaf { color: var(--muted); }

.ftag {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  white-space: nowrap;
}

.ftag.alt     { background: rgba(74, 114, 255, 0.12); color: var(--accent); }
.ftag.opt     { background: rgba(86, 99, 122, 0.1);  color: var(--muted); }
.ftag.numeric { background: rgba(16, 160, 100, 0.1); color: #10a064; }

@media (max-width: 1060px) {
  .sections-grid { grid-template-columns: 1fr 1.5fr; }
  .section-card:nth-child(3) { grid-column: 1 / -1; }
}

/* ── Inner pages ─────────────────────────────────────────────────────────── */

.back-link {
  align-self: flex-start;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(72, 105, 193, 0.18);
  background: rgba(72, 105, 193, 0.05);
  transition: background 0.15s, border-color 0.15s;
}

.back-link:hover {
  background: rgba(72, 105, 193, 0.1);
  border-color: rgba(72, 105, 193, 0.3);
}

.inner-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(20, 33, 61, 0.07);
  overflow: hidden;
  animation: rise-in 600ms ease-out both;
}

.inner-card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(74, 114, 255, 0.03);
}

.inner-card-filename {
  font-family: "Cascadia Code", "Fira Mono", "Consolas", monospace;
  font-size: 0.82rem;
  color: var(--muted);
}

.uvl-full {
  margin: 0;
  padding: 24px;
  font-family: "Cascadia Code", "Fira Mono", "Consolas", monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre;
  overflow-x: auto;
}

.ftree-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  background: rgba(74, 114, 255, 0.03);
}

.inner-card .ftree {
  padding: 24px;
}

.diagram-card {
  padding: 24px;
  overflow-x: auto;
}

.diagram-img {
  min-width: 3600px;
  width: 100%;
  border-radius: 12px;
  display: block;
}

/* ── Top nav ─────────────────────────────────────────────────────────────── */
.top-nav {
  position: fixed;
  top: 18px;
  right: 24px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  z-index: 200;
}

.nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(72, 105, 193, 0.18);
  background: rgba(72, 105, 193, 0.05);
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.nav-icon-btn:hover {
  background: rgba(72, 105, 193, 0.1);
  border-color: rgba(72, 105, 193, 0.3);
}

.profile-menu { position: relative; }

.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 200px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(72, 105, 193, 0.14);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(20, 33, 61, 0.13);
  padding: 10px;
  backdrop-filter: blur(16px);
}

.profile-dropdown.open { display: block; }

.profile-email {
  display: block;
  padding: 4px 8px 10px;
  font-size: 0.78rem;
  color: #56637a;
  font-weight: 600;
  border-bottom: 1px solid rgba(72, 105, 193, 0.1);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.84rem;
  color: #14213d;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s;
  box-sizing: border-box;
}

.dropdown-item:hover { background: rgba(74, 114, 255, 0.07); }
.dropdown-item.danger { color: #c0392b; }
.dropdown-item.danger:hover { background: rgba(220, 50, 50, 0.07); }
