/* ==========================================================================
   Site Studio — Nordic workspace
   Tokens → base → brand → auth → dashboard → intro → editor
   ========================================================================== */

:root {
  --bg: #050b14;
  --bg-deep: #03070e;
  --bg-soft: #0a1421;
  --surface: rgba(15, 25, 40, 0.72);
  --surface-solid: rgba(12, 20, 33, 0.92);
  --surface-raised: rgba(24, 37, 57, 0.78);
  --stroke: rgba(148, 163, 184, 0.14);
  --stroke-strong: rgba(148, 163, 184, 0.28);
  --text-primary: #e8eef6;
  --text-secondary: #a7b6c6;
  --text-tertiary: #6f8398;
  --accent: #5eead4;
  --accent-2: #38bdf8;
  --accent-ink: #04110f;
  --danger: #f87171;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
  --shadow-lg: 0 40px 90px -60px rgba(0, 0, 0, 0.9);
  --shadow-glow: 0 40px 90px -70px rgba(94, 234, 212, 0.85);
  --font: "Inter", "Manrope", "Satoshi", -apple-system, BlinkMacSystemFont,
    "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono",
    monospace;
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base --- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  min-height: 100dvh;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

h2 {
  font-size: 15px;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 17px;
}

small {
  font-size: 12px;
  color: var(--text-tertiary);
}

b {
  font-weight: 600;
}

a {
  color: var(--accent);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

button:disabled {
  cursor: not-allowed;
}

svg {
  display: block;
  flex: none;
}

::selection {
  background: rgba(94, 234, 212, 0.26);
  color: #fff;
}

:focus-visible {
  outline: 2px solid rgba(94, 234, 212, 0.6);
  outline-offset: 2px;
}

/* scrollbars */
.panel-body,
.file-view pre,
.editor-frame-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.28) transparent;
}

.panel-body::-webkit-scrollbar,
.file-view pre::-webkit-scrollbar,
.editor-frame-body::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.panel-body::-webkit-scrollbar-thumb,
.file-view pre::-webkit-scrollbar-thumb,
.editor-frame-body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

/* ----------------------------------------------------------- utilities --- */

.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.34em;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
}

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

@keyframes nordic-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------- brand --- */

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-mark {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  width: 22px;
}

.brand-mark span {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px -4px rgba(94, 234, 212, 0.9);
}

.brand-mark span:nth-child(1) {
  width: 100%;
}

.brand-mark span:nth-child(2) {
  width: 72%;
}

.brand-mark span:nth-child(3) {
  width: 88%;
}

.brand-inverse,
.brand-inverse span {
  color: var(--accent-ink);
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 14px;
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease),
    color 180ms var(--ease), transform 180ms var(--ease),
    box-shadow 180ms var(--ease), filter 180ms var(--ease);
}

.button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.button:disabled {
  opacity: 0.55;
}

.button-outline {
  border-color: var(--stroke-strong);
  color: var(--text-secondary);
}

.button-outline:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.4);
  color: var(--text-primary);
}

.button-green {
  background: linear-gradient(90deg, rgba(94, 234, 212, 0.92), rgba(56, 189, 248, 0.85));
  color: var(--accent-ink);
  border: none;
  font-weight: 600;
  box-shadow: var(--shadow-glow);
}

.button-green:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 50px 100px -70px rgba(94, 234, 212, 1);
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease),
    border-color 160ms var(--ease);
}

.icon-button:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.14);
  border-color: var(--stroke);
  color: var(--text-primary);
}

.icon-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------- auth --- */

.auth-shell {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(1200px 800px at 50% -20%, rgba(94, 234, 212, 0.12), transparent 70%),
    radial-gradient(900px 700px at 90% 110%, rgba(56, 189, 248, 0.1), transparent 65%),
    linear-gradient(180deg, #04080f, #050b14 55%, #04080f);
}

.auth-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.07) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 72%);
  pointer-events: none;
}

.auth-noise {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.25'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
  animation: orb-drift 22s ease-in-out infinite alternate;
}

.auth-orb-one {
  width: 420px;
  height: 420px;
  top: -140px;
  left: -120px;
  background: rgba(94, 234, 212, 0.28);
}

.auth-orb-two {
  width: 460px;
  height: 460px;
  right: -160px;
  bottom: -180px;
  background: rgba(56, 189, 248, 0.22);
  animation-delay: -8s;
}

@keyframes orb-drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(40px, -30px, 0) scale(1.12);
  }
}

.auth-header {
  position: relative;
  z-index: 1;
  padding: 26px clamp(20px, 5vw, 44px);
}

.auth-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  place-items: center;
  padding: 12px clamp(20px, 5vw, 40px) clamp(40px, 8vh, 80px);
}

.auth-stage {
  width: 100%;
  display: flex;
  justify-content: center;
}

.auth-panel {
  width: min(440px, 100%);
  padding: clamp(26px, 4vw, 38px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(22, 34, 52, 0.78), rgba(8, 14, 24, 0.86));
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  animation: nordic-in 420ms var(--ease) both;
}

.auth-panel-head {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-title {
  font-size: clamp(28px, 5vw, 34px);
  letter-spacing: -0.05em;
  font-weight: 600;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.auth-field label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.auth-field input {
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(6, 12, 22, 0.72);
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease),
    background-color 160ms var(--ease);
}

.auth-field input::placeholder {
  color: var(--text-tertiary);
}

.auth-field input:hover {
  border-color: var(--stroke-strong);
}

.auth-field input:focus {
  outline: none;
  border-color: rgba(94, 234, 212, 0.55);
  background: rgba(8, 16, 28, 0.9);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.14);
}

.auth-error {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
  font-size: 13px;
}

.auth-error[hidden] {
  display: none;
}

.auth-submit {
  position: relative;
  overflow: hidden;
  height: 50px;
  margin-top: 4px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(90deg, rgba(94, 234, 212, 0.95), rgba(56, 189, 248, 0.9));
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: filter 180ms var(--ease), transform 180ms var(--ease),
    box-shadow 180ms var(--ease);
  box-shadow: var(--shadow-glow);
}

.auth-submit span {
  position: relative;
  z-index: 1;
}

.auth-submit .auth-submit-glow {
  position: absolute;
  inset: -60% -20%;
  z-index: 0;
  background: radial-gradient(circle at 50% 120%, rgba(255, 255, 255, 0.75), transparent 60%);
  opacity: 0;
  transition: opacity 260ms var(--ease);
}

.auth-submit:hover:not(:disabled) {
  filter: brightness(1.05);
}

.auth-submit:hover:not(:disabled) .auth-submit-glow {
  opacity: 0.5;
}

.auth-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.auth-submit:disabled {
  opacity: 0.7;
}

.auth-foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.auth-foot button {
  color: var(--accent);
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: border-color 160ms var(--ease);
}

.auth-foot button:hover {
  border-bottom-color: rgba(94, 234, 212, 0.6);
}

/* ----------------------------------------------------------- dashboard --- */

.single-site-dashboard {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1100px 720px at 12% -10%, rgba(94, 234, 212, 0.1), transparent 65%),
    radial-gradient(900px 640px at 92% 4%, rgba(56, 189, 248, 0.08), transparent 60%),
    var(--bg);
}

.single-site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(18px, 4vw, 38px);
  border-bottom: 1px solid var(--stroke);
  background: rgba(5, 11, 20, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.dashboard-account {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(148, 163, 184, 0.06);
  color: var(--text-secondary);
  font-size: 13px;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease),
    color 160ms var(--ease);
}

.dashboard-account:hover {
  border-color: var(--stroke-strong);
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-primary);
}

.profile-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, rgba(94, 234, 212, 0.9), rgba(56, 189, 248, 0.8));
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 700;
}

.dashboard-signout {
  padding: 5px 12px 5px 10px;
  border-left: 1px solid var(--stroke);
  margin-left: 2px;
  color: var(--text-tertiary);
}

.dashboard-account:hover .dashboard-signout {
  color: var(--text-secondary);
}

.single-site-main {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(36px, 7vh, 80px) clamp(18px, 4vw, 32px) 64px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.single-site-intro {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: nordic-in 480ms var(--ease) both;
}

.single-site-intro h1 {
  font-size: clamp(34px, 6vw, 54px);
  letter-spacing: -0.055em;
  line-height: 1.05;
}

.single-site-intro p {
  color: var(--text-secondary);
  font-size: 15px;
}

.site-status-card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(20, 31, 48, 0.72), rgba(8, 14, 24, 0.82));
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: nordic-in 520ms var(--ease) both;
}

.site-status-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--stroke);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.site-status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex: none;
}

.site-status-indicator.is-ready {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(94, 234, 212, 0.14);
}

.site-single-badge {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(148, 163, 184, 0.07);
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: none;
}

.site-status-content,
.site-status-empty {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 20px;
  flex-wrap: wrap;
}

.site-status-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex: none;
  background: rgba(94, 234, 212, 0.12);
  border: 1px solid rgba(94, 234, 212, 0.2);
  color: var(--accent);
}

.site-status-details {
  flex: 1;
  min-width: 190px;
}

.site-status-details h2 {
  font-size: 17px;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}

.site-status-details p {
  font-size: 13px;
  color: var(--text-tertiary);
}

.site-status-details p span {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  margin: 0 7px;
  vertical-align: middle;
  background: currentColor;
  opacity: 0.6;
}

.site-status-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.site-status-actions .button {
  padding: 10px 16px;
  font-size: 13px;
}

.site-storage-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-tertiary);
}

.site-storage-note svg {
  color: var(--accent);
}

.dashboard-error-slot:empty {
  display: none;
}

.single-site-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
  font-size: 13px;
  animation: nordic-in 260ms var(--ease) both;
}

.single-site-error button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: inherit;
  flex: none;
}

.single-site-error button:hover {
  background: rgba(248, 113, 113, 0.16);
}

/* -------------------------------------------------------------- intro --- */

.nordic-intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(900px 700px at 50% 40%, rgba(94, 234, 212, 0.09), transparent 65%),
    #03070e;
  opacity: 0;
  transition: opacity 420ms var(--ease);
}

.nordic-intro.is-enter {
  opacity: 1;
}

.nordic-intro.is-exit {
  opacity: 0;
  pointer-events: none;
}

.nordic-intro-grid {
  position: absolute;
  inset: -10%;
  background-image: linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 50% 50%, #000 0%, transparent 68%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0%, transparent 68%);
  opacity: 0;
  transition: opacity 700ms var(--ease);
  transform: scale(1.04);
}

.nordic-intro.is-enter .nordic-intro-grid {
  opacity: 1;
  transform: scale(1);
  transition-duration: 1200ms;
}

.nordic-intro-scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  top: 0;
  background: linear-gradient(90deg, transparent, rgba(94, 234, 212, 0.55), transparent);
  opacity: 0;
}

.nordic-intro.is-enter .nordic-intro-scan {
  opacity: 1;
  animation: intro-scan 1600ms var(--ease) 200ms both;
}

@keyframes intro-scan {
  0% {
    top: 8%;
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    top: 92%;
    opacity: 0;
  }
}

.nordic-intro-bars {
  position: absolute;
  bottom: clamp(40px, 9vh, 90px);
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 34px;
  opacity: 0;
}

.nordic-intro.is-enter .nordic-intro-bars {
  opacity: 1;
  transition: opacity 600ms var(--ease) 300ms;
}

.nordic-intro-bars span {
  width: 3px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), rgba(56, 189, 248, 0.4));
  animation: intro-bar 1100ms var(--ease) infinite alternate;
}

.nordic-intro-bars span:nth-child(2) {
  animation-delay: 120ms;
}
.nordic-intro-bars span:nth-child(3) {
  animation-delay: 240ms;
}
.nordic-intro-bars span:nth-child(4) {
  animation-delay: 360ms;
}
.nordic-intro-bars span:nth-child(5) {
  animation-delay: 480ms;
}

@keyframes intro-bar {
  from {
    height: 6px;
    opacity: 0.45;
  }
  to {
    height: 30px;
    opacity: 1;
  }
}

.nordic-intro-core {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  transform: scale(0.96);
  opacity: 0;
  transition: transform 700ms var(--ease), opacity 600ms var(--ease);
}

.nordic-intro.is-enter .nordic-intro-core {
  opacity: 1;
  transform: scale(1);
}

.nordic-intro-logo {
  width: clamp(96px, 15vw, 132px);
  height: clamp(96px, 15vw, 132px);
  transition: transform 320ms var(--ease), filter 320ms var(--ease);
}

.nordic-intro-logo svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.intro-mark rect {
  fill: var(--accent);
  opacity: 0;
  transform-origin: 12px 32px;
  animation: intro-mark-in 520ms var(--ease) forwards;
}

.intro-mark rect:nth-child(1) {
  animation-delay: 120ms;
}
.intro-mark rect:nth-child(2) {
  animation-delay: 220ms;
}
.intro-mark rect:nth-child(3) {
  animation-delay: 320ms;
}

@keyframes intro-mark-in {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.intro-ring {
  fill: none;
  stroke: rgba(94, 234, 212, 0.45);
  stroke-width: 1.2;
  stroke-dasharray: 164;
  stroke-dashoffset: 164;
  transform-origin: 32px 32px;
  animation: intro-ring-draw 1100ms var(--ease) 200ms forwards;
}

@keyframes intro-ring-draw {
  to {
    stroke-dashoffset: 0;
  }
}

.nordic-intro-logo.is-pulse {
  filter: drop-shadow(0 0 26px rgba(94, 234, 212, 0.4));
}

.nordic-intro-logo.is-click {
  transform: scale(0.9);
  filter: drop-shadow(0 0 46px rgba(94, 234, 212, 0.85));
}

.nordic-intro-word {
  font-size: clamp(12px, 1.6vw, 15px);
  font-weight: 600;
  letter-spacing: 0.62em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding-left: 0.62em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}

.nordic-intro-word.is-show {
  opacity: 1;
  transform: none;
  color: var(--text-primary);
}

.nordic-intro-click {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
}

.nordic-intro-click.is-fire {
  animation: intro-flash 620ms var(--ease) forwards;
}

@keyframes intro-flash {
  0% {
    opacity: 0.9;
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.5);
  }
  100% {
    opacity: 0;
    transform: scale(1);
    box-shadow: 0 0 0 220px rgba(94, 234, 212, 0);
  }
}

/* ------------------------------------------------------------- editor --- */

.editor-workspace {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(1200px 800px at 20% -10%, rgba(94, 234, 212, 0.08), transparent),
    var(--bg);
}

.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(26, 36, 64, 0.9), rgba(10, 14, 28, 0.95));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  flex: none;
}

.editor-brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.collapse-toggle {
  border-radius: 10px;
}

.top-separator {
  width: 1px;
  height: 24px;
  background: var(--stroke);
  flex: none;
}

.editor-back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13px;
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}

.editor-back-link:hover {
  color: var(--text-primary);
  background: rgba(148, 163, 184, 0.12);
}

.crumb-chevron {
  color: var(--text-tertiary);
  display: flex;
}

.project-name-button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 600;
  min-width: 0;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}

.project-name-button:hover {
  background: rgba(148, 163, 184, 0.1);
  border-color: var(--stroke);
}

.project-name-button svg {
  color: var(--text-tertiary);
}

.project-name-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

.editor-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.save-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-tertiary);
  font-size: 13px;
  white-space: nowrap;
}

.save-state i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(94, 234, 212, 0.12);
}

.history-actions {
  display: flex;
  gap: 6px;
}

.export-button {
  padding: 9px 16px;
}

/* layout */

.editor-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 0;
  transition: grid-template-columns 260ms var(--ease);
}

.editor-left-panel {
  border-right: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, rgba(26, 36, 64, 0.6), rgba(10, 14, 28, 0.9));
  overflow: hidden;
}

.editor-workspace.side-collapsed .editor-layout {
  grid-template-columns: 0 1fr;
}

.editor-workspace.side-collapsed .editor-left-panel {
  width: 0;
  min-width: 0;
  border-right: none;
  visibility: hidden;
}

.panel-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px;
  flex: none;
}

.panel-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease),
    border-color 160ms var(--ease);
}

.panel-tabs button:hover {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-primary);
}

.panel-tabs button.selected {
  background: rgba(94, 234, 212, 0.16);
  color: var(--text-primary);
  border-color: rgba(94, 234, 212, 0.4);
}

.panel-body {
  flex: 1;
  overflow: auto;
  padding: 0 14px 18px;
}

.panel-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 4px 14px;
}

.panel-section-heading h2 {
  margin: 4px 0 0;
  font-size: 19px;
  letter-spacing: -0.035em;
}

.file-count {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.4;
}

/* files panel */

.file-entry {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: background-color 160ms var(--ease), color 160ms var(--ease),
    border-color 160ms var(--ease);
}

.file-row span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row svg:last-child {
  color: var(--text-tertiary);
}

.file-row.active {
  background: rgba(94, 234, 212, 0.14);
  color: var(--text-primary);
  border-color: rgba(94, 234, 212, 0.4);
}

.file-row:hover {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-primary);
}

.file-view {
  margin-top: 14px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  overflow: hidden;
  background: rgba(10, 14, 28, 0.8);
}

.file-view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 6px 12px;
  border-bottom: 1px solid var(--stroke);
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-view-head .icon-button {
  width: 26px;
  height: 26px;
}

.file-view pre {
  margin: 0;
  padding: 12px;
  max-height: 240px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.files-footnote {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.files-footnote svg {
  color: var(--accent);
}

/* design panel */

.design-panel,
.file-panel {
  display: flex;
  flex-direction: column;
  padding-bottom: 4px;
}

.selection-empty {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 30px 10px;
}

.selection-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(94, 234, 212, 0.2), transparent);
  color: var(--accent);
}

.selection-empty h3 {
  font-size: 18px;
  line-height: 1.25;
}

.selection-empty p {
  font-size: 13px;
  color: var(--text-tertiary);
  max-width: 250px;
}

.selection-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  color: var(--text-tertiary);
  font-size: 11.5px;
}

.selection-hint span {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
  font-size: 10px;
}

.selected-element {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(148, 163, 184, 0.1);
}

.selected-element > div {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.selected-element b {
  font-size: 13px;
  font-family: var(--mono);
  letter-spacing: 0;
}

.selected-element small {
  font-size: 11px;
}

.element-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(94, 234, 212, 0.18);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  flex: none;
}

.target-dot {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(94, 234, 212, 0.12);
  flex: none;
}

.control-section {
  margin-top: 14px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(10, 14, 28, 0.7);
  overflow: hidden;
}

.control-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--stroke);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(148, 163, 184, 0.04);
}

.control-heading svg {
  color: var(--text-tertiary);
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 0;
}

.field-row:last-child {
  padding-bottom: 14px;
}

.control-section > .control-heading + .field-row {
  padding-top: 14px;
}

.control-section > .field-row:first-child {
  padding-top: 14px;
}

.field-label {
  display: block;
  padding: 0;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.control-input {
  margin: 0;
  width: 100%;
  min-width: 0;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(6, 12, 22, 0.75);
  color: var(--text-primary);
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.4;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease),
    background-color 160ms var(--ease);
}

.control-input:hover {
  border-color: var(--stroke-strong);
}

.control-input:focus {
  outline: none;
  border-color: rgba(94, 234, 212, 0.55);
  background: rgba(8, 16, 28, 0.92);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.14);
}

.control-input::placeholder {
  color: rgba(111, 131, 152, 0.75);
}

select.control-input {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236f8398' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}

textarea.control-input {
  min-height: 84px;
  resize: vertical;
  line-height: 1.55;
}

.color-input-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
  padding: 0;
}

.color-input-row input[type="color"] {
  width: 44px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 160ms var(--ease);
}

.color-input-row input[type="color"]:hover {
  border-color: var(--stroke-strong);
}

.color-input-row input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 3px;
}

.color-input-row input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 7px;
}

.color-input-row input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 7px;
}

.dimension-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 14px 14px;
}

.dimension-grid .field-row {
  padding: 0;
}

.dimension-grid .field-label {
  padding: 0 0 6px;
}

.dimension-grid .control-input {
  margin: 0;
  width: 100%;
}

/* stage */

.editor-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--stroke);
  flex: none;
}

.stage-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 12.5px;
  min-width: 0;
}

.stage-entry {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 11.5px;
}

.stage-chevron,
.device-chevron {
  display: flex;
  color: var(--text-tertiary);
}

.stage-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(94, 234, 212, 0.12);
  flex: none;
}

.stage-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-tertiary);
  font-size: 12px;
  flex: none;
}

.stage-zoom {
  padding: 3px 8px;
  border-radius: 7px;
  border: 1px solid var(--stroke);
  font-family: var(--mono);
  font-size: 11px;
}

.device-switch {
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-frame-body {
  flex: 1;
  padding: 18px;
  overflow: auto;
  min-height: 0;
}

.editor-frame-shell {
  height: 100%;
  min-height: 320px;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 120px 200px -160px rgba(94, 234, 212, 0.6);
}

.editor-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  display: block;
}

.editor-frame.is-preview {
  outline: 2px solid rgba(94, 234, 212, 0.35);
  outline-offset: -2px;
}

.stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 18px;
  border-top: 1px solid var(--stroke);
  color: var(--text-tertiary);
  font-size: 11.5px;
  flex: none;
}

.footer-pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
}

.footer-img {
  display: inline-flex;
  vertical-align: -2px;
  margin-right: 6px;
}

.stage-error {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 46px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.42);
  background: rgba(40, 12, 16, 0.92);
  color: #fca5a5;
  font-size: 12.5px;
  backdrop-filter: blur(10px);
  animation: nordic-in 220ms var(--ease) both;
}

.stage-error button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: inherit;
  flex: none;
}

.stage-error button:hover {
  background: rgba(248, 113, 113, 0.16);
}

/* not found */

.editor-not-found {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(900px 700px at 50% 0%, rgba(94, 234, 212, 0.1), transparent 65%),
    var(--bg);
}

.editor-not-found-card {
  max-width: 420px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: nordic-in 420ms var(--ease) both;
}

.editor-not-found-card h1 {
  font-size: clamp(22px, 4vw, 28px);
  letter-spacing: -0.035em;
}

.editor-not-found-card p {
  color: var(--text-tertiary);
  font-size: 13.5px;
}

.dialog-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.16);
  color: var(--text-secondary);
}

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

@media (max-width: 1080px) {
  .editor-layout {
    grid-template-columns: 280px 1fr;
  }

  .save-state {
    display: none;
  }
}

@media (max-width: 860px) {
  .editor-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 38vh) 1fr;
  }

  .editor-left-panel {
    border-right: none;
    border-bottom: 1px solid var(--stroke);
  }

  .editor-workspace.side-collapsed .editor-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 0 1fr;
  }

  .editor-frame-body {
    padding: 10px;
  }

  .stage-footer span:last-child {
    display: none;
  }
}

@media (max-width: 640px) {
  .editor-topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }

  .top-separator,
  .crumb-chevron,
  .editor-back-link {
    display: none;
  }

  .project-name-label {
    max-width: 130px;
  }

  .preview-label {
    display: none;
  }

  .export-button {
    padding: 9px 12px;
  }

  .site-status-content,
  .site-status-empty {
    padding: 18px 16px;
  }

  .site-status-actions {
    width: 100%;
  }

  .site-status-actions .button {
    flex: 1;
  }

  .site-status-heading {
    padding: 12px 16px;
  }

  .single-site-header {
    padding: 12px 16px;
  }

  .dashboard-signout {
    display: none;
  }

  .auth-panel {
    padding: 24px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .nordic-intro {
    display: none;
  }
}

/* Slider-based design controls */
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
  font-size: 13px;
}
.slider-row .field-label {
  min-width: 95px;
  font-weight: 500;
  color: var(--text-tertiary);
}
.slider-row input[type=range] {
  flex: 1;
  height: 6px;
  cursor: pointer;
  background: #1f2d3d;
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}
.slider-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(94,234,212,.3);
}
.slider-row input[type=range]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}
.slider-value {
  min-width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
}

/* Hide design panel when nothing selected */
.design-panel:empty {
  display: none;
}

/* Hide entire left panel until something is selected */
.editor-left-panel.panel-empty {
  width: 0;
  min-width: 0;
  border-right: none;
  visibility: hidden;
  pointer-events: none;
}

/* Color pickers */
input[type=color] {
  width: 100%;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  padding: 0;
}
input[type=color]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type=color]::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}

/* Collapsible section indicator */
.control-heading::after {
  content: '';
  transition: transform .18s ease;
}
.control-section.collapsed .control-heading::after {
  transform: rotate(-90deg);
}

/* Right-click context menu */
.ctx-menu {
  display: none;
  position: fixed;
  z-index: 50;
  min-width: 170px;
  background: #0e1824;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(0,0,0,.45);
  padding: 6px 0;
  color: #e6edf3;
  font-size: 13px;
}
.ctx-menu.ctx-menu--open {
  display: block;
}
.ctx-menu .ctx-menu-group {
  display: flex;
  flex-direction: column;
}
.ctx-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: transparent;
  border: none;
  color: #e6edf3;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.ctx-item:hover {
  background: rgba(94, 234, 212, 0.1);
}
.ctx-item:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.ctx-color {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  background: none;
}
