/* =========================================================================
   Mustelad — shared design language
   Retune the whole site from the variables below.
   ========================================================================= */

:root {
  /* ---- Palette (dark mode) ------------------------------------------- */
  --bg:            oklch(0.165 0.008 260);   /* page background, near-black, faintly cool */
  --bg-2:          oklch(0.205 0.010 260);   /* raised surface */
  --surface:       oklch(0.225 0.011 260);   /* cards */
  --surface-hover: oklch(0.265 0.013 260);   /* card hover */
  --line:          oklch(0.320 0.012 260);   /* hairlines / borders */
  --line-strong:   oklch(0.420 0.014 260);   /* borders on hover/focus */

  --text:          oklch(0.965 0.004 260);   /* primary text */
  --text-muted:    oklch(0.760 0.010 260);   /* secondary text */
  --text-faint:    oklch(0.580 0.010 260);   /* tertiary / footnotes */

  --accent:        oklch(0.800 0.130 165);   /* restrained mint */
  --accent-soft:   oklch(0.800 0.130 165 / 0.14);
  --accent-line:   oklch(0.800 0.130 165 / 0.40);
  --accent-text:   oklch(0.165 0.008 260);   /* text on accent fills */

  /* ---- Type ----------------------------------------------------------- */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
          "Liberation Mono", monospace;

  /* ---- Spacing & shape ------------------------------------------------ */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --maxw: 1120px;
  --pad:  clamp(20px, 5vw, 40px);

  --shadow: 0 1px 0 oklch(1 0 0 / 0.03) inset,
            0 18px 40px -24px oklch(0 0 0 / 0.7);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* =========================================================================
   Reset / base
   ========================================================================= */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100svh;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent-soft); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

/* =========================================================================
   Wordmark
   ========================================================================= */

.wordmark {
  font-weight: 640;
  letter-spacing: -0.03em;
  color: var(--text);
}
.wordmark .dot { color: var(--accent); }

/* =========================================================================
   Ambient backdrop — slow, low-contrast drifting glow (pure CSS)
   ========================================================================= */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.ambient .glow {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  mix-blend-mode: screen;
  will-change: transform;
}
.ambient .glow.a {
  background: radial-gradient(circle at center,
              oklch(0.80 0.13 165 / 0.30), transparent 70%);
  top: -22vmax; left: -12vmax;
  animation: drift-a 26s var(--ease) infinite alternate;
}
.ambient .glow.b {
  background: radial-gradient(circle at center,
              oklch(0.72 0.11 250 / 0.26), transparent 70%);
  bottom: -26vmax; right: -16vmax;
  animation: drift-b 32s var(--ease) infinite alternate;
}
.ambient .grain {
  position: absolute;
  inset: -50%;
  opacity: 0.04;
  background-image: radial-gradient(oklch(1 0 0) 0.5px, transparent 0.6px);
  background-size: 3px 3px;
}

@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(8vmax, 6vmax, 0) scale(1.12); }
}
@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.05); }
  to   { transform: translate3d(-7vmax, -5vmax, 0) scale(0.95); }
}

/* =========================================================================
   PAGE 1 — Public hub
   ========================================================================= */

.hub {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: var(--pad);
}

.hub__main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(18px, 3vw, 28px);
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.hub__mark {
  font-size: clamp(3rem, 11vw, 6.5rem);
  line-height: 0.95;
  margin: 0;
  animation: rise 0.9s var(--ease) both;
}

/* Discreet doorway: the wordmark links into the private area. */
.hub__door {
  display: inline-block;
  transition: transform 0.4s var(--ease), filter 0.4s var(--ease);
}
.hub__door .dot {
  transition: color 0.4s var(--ease),
              text-shadow 0.5s var(--ease);
}
.hub__door:hover,
.hub__door:focus-visible {
  transform: translateY(-2px);
}
.hub__door:hover .dot,
.hub__door:focus-visible .dot {
  text-shadow: 0 0 22px var(--accent-line);
}

.hub__rule {
  width: 56px;
  height: 1px;
  background: var(--accent-line);
  animation: rise 0.9s var(--ease) 0.08s both;
}

.hub__tagline {
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  line-height: 1.5;
  color: var(--text-muted);
  font-weight: 380;
  max-width: 30ch;
  margin: 0;
  text-wrap: balance;
  animation: rise 0.9s var(--ease) 0.16s both;
}
.hub__tagline em {
  font-style: normal;
  color: var(--text);
}

.hub__footer,
.foot {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  padding-top: 32px;
}

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

/* Page enters with a soft fade; leaves the same way before navigating. */
.hub { animation: hub-in 0.6s var(--ease) both; }
@keyframes hub-in { from { opacity: 0; } to { opacity: 1; } }

body.is-leaving .hub {
  opacity: 0;
  transform: scale(0.99);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}

/* =========================================================================
   PAGE 2 — Dashboard
   ========================================================================= */

.page {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(22px, 4vw, 34px) 0;
  border-bottom: 1px solid var(--line);
}
.topbar__brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.topbar__brand .wordmark { font-size: 1.4rem; }
.topbar__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-faint);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: clamp(28px, 5vw, 44px) 0 22px;
}
.toolbar__title {
  margin: 0;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.toolbar__sub {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.search {
  position: relative;
  flex: 0 1 320px;
  min-width: 220px;
}
.search input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 14px 11px 38px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.search input::placeholder { color: var(--text-faint); }
.search input:hover { border-color: var(--line-strong); }
.search input:focus { outline: none; border-color: var(--accent-line); background: var(--surface); }
.search__icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  border: 1.6px solid var(--text-faint);
  border-radius: 50%;
  pointer-events: none;
}
.search__icon::after {
  content: "";
  position: absolute;
  width: 1.6px; height: 6px;
  background: var(--text-faint);
  right: -3px; bottom: -3px;
  transform: rotate(-45deg);
  border-radius: 2px;
}

/* ---- Card grid ------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 18px;
  padding-bottom: 8px;
  align-content: start;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 22px 20px;
  min-height: 152px;
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--ease),
              border-color 0.25s var(--ease),
              background 0.25s var(--ease);
  isolation: isolate;
}
.card::after {
  /* faint accent wash that fades in on hover */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 90% at 100% 0%,
              var(--accent-soft), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  z-index: -1;
}
.card:hover,
.card:focus-visible {
  transform: translateY(-3px);
  background: var(--surface-hover);
  border-color: var(--accent-line);
}
.card:hover::after,
.card:focus-visible::after { opacity: 1; }

.card__tag {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 550;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 10px;
}
.card__title {
  margin: 2px 0 0;
  font-size: 1.16rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}
.card__desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.card__go {
  margin-top: auto;
  padding-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  color: var(--text-faint);
  transition: color 0.25s var(--ease), gap 0.25s var(--ease);
}
.card__go .arrow { transition: transform 0.25s var(--ease); }
.card:hover .card__go,
.card:focus-visible .card__go { color: var(--accent); gap: 10px; }
.card:hover .card__go .arrow,
.card:focus-visible .card__go .arrow { transform: translateX(2px); }

/* ---- Empty state (search returns nothing) ---------------------------- */
.empty {
  display: none;
  text-align: center;
  color: var(--text-faint);
  padding: 56px 20px;
  font-size: 0.95rem;
}
.grid[data-empty="true"] + .empty { display: block; }

.foot--dash {
  padding: 40px 0 36px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
  text-align: left;
}

/* =========================================================================
   LOGIN — owner gate (UI only; real auth happens server-side)
   ========================================================================= */

.auth {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: var(--pad);
}
.auth__main {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth__card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(28px, 5vw, 38px);
  box-shadow: var(--shadow);
  animation: rise 0.7s var(--ease) both;
}

.auth__mark {
  font-size: 1.6rem;
  margin: 0;
}
.auth__lede {
  margin: 8px 0 26px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.field label {
  font-size: 0.78rem;
  font-weight: 550;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.field__wrap { position: relative; }
.field input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 44px 12px 14px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.field input::placeholder { color: var(--text-faint); }
.field input:hover { border-color: var(--line-strong); }
.field input:focus { outline: none; border-color: var(--accent-line); background: var(--surface-hover); }

.field__toggle {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--text-faint);
  font: inherit;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.field__toggle:hover { color: var(--text); background: var(--bg-2); }

.btn {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--accent-text);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 12px 16px;
  cursor: pointer;
  margin-top: 6px;
  transition: transform 0.18s var(--ease), filter 0.2s var(--ease);
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }

.auth__hint {
  margin: 18px 0 0;
  font-size: 0.78rem;
  color: var(--text-faint);
  text-align: center;
}

.auth__error {
  display: none;
  margin: 0 0 16px;
  font-size: 0.82rem;
  color: oklch(0.74 0.15 25);
  background: oklch(0.74 0.15 25 / 0.12);
  border: 1px solid oklch(0.74 0.15 25 / 0.35);
  border-radius: var(--r-sm);
  padding: 9px 12px;
}
.auth__error[data-show="true"] { display: block; }
