@font-face {
  font-family: "KH Teka";
  src: url("/fonts/kh-teka/KHTeka-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "KH Teka";
  src: url("/fonts/kh-teka/KHTeka-Medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "KH Teka Mono";
  src: url("/fonts/kh-teka-mono/KHTekaMono-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --app-bg: #fbfaf7;
  --app-bg-end: #f2f1ed;
  --app-line: rgb(14 17 20 / 14%);
  --app-line-soft: rgb(14 17 20 / 9%);
  --app-muted: #7c91a7;
  --app-secondary: #64778c;
  --app-surface: rgb(255 255 255 / 72%);
  --app-surface-muted: rgb(226 228 227 / 72%);
  --app-surface-raised: rgb(255 255 255 / 96%);
  --app-text: #101010;
  font-family:
    "KH Teka", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--app-text);
  background: var(--app-bg);
  font-feature-settings:
    "kern" 1,
    "liga" 1,
    "clig" 1,
    "calt" 1;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

[data-theme="dark"] {
  --app-bg: #0a0a0a;
  --app-bg-end: #11151a;
  --app-line: rgb(255 255 255 / 14%);
  --app-line-soft: rgb(255 255 255 / 9%);
  --app-muted: #8293a4;
  --app-secondary: #a0b0c0;
  --app-surface: rgb(25 29 34 / 82%);
  --app-surface-muted: rgb(37 42 48 / 82%);
  --app-surface-raised: rgb(25 29 34 / 96%);
  --app-text: #ededed;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
}

button,
input {
  font: inherit;
}

.theme-toggle-wrap {
  position: fixed;
  top: 23px;
  right: 32px;
  z-index: 20;
  display: inline-flex;
}

.theme-toggle {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  color: var(--app-secondary);
  background: transparent;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--app-text);
  border-color: color-mix(in srgb, var(--app-text) 35%, transparent);
}

.theme-toggle:focus-visible {
  outline: 2px solid rgb(0 70 255 / 48%);
  outline-offset: 1px;
}

.theme-toggle[aria-pressed="true"] {
  color: var(--app-text);
  background: var(--app-surface);
  box-shadow: 0 2px 8px rgb(0 0 0 / 12%);
}

.theme-icon-wrap {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
}

.theme-icon {
  position: absolute;
  inset: 0;
  width: 18px;
  height: 18px;
  stroke: currentcolor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.72) rotate(-20deg);
  transition:
    opacity 180ms ease,
    transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-sun-icon {
  transform: scale(0.72) rotate(30deg);
}

[data-theme="light"] .theme-moon-icon,
[data-theme="dark"] .theme-sun-icon {
  opacity: 1;
  transform: scale(1) rotate(0);
}

.theme-toggle-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  color: var(--app-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  visibility: hidden;
  background: var(--app-surface-raised);
  backdrop-filter: blur(12px);
  border: 1px solid var(--app-line-soft);
  border-radius: 9px;
  box-shadow: 0 10px 30px rgb(14 17 20 / 8%);
  opacity: 0;
  transform: translateY(-2px);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    visibility 160ms;
}

.theme-toggle-tooltip kbd {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  place-items: center;
  color: var(--app-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  background: var(--app-surface-muted);
  border: 1px solid var(--app-line);
  border-radius: 5px;
  box-shadow: inset 0 -1px 0 var(--app-line);
}

.theme-toggle-wrap:hover .theme-toggle-tooltip,
.theme-toggle-wrap:focus-within .theme-toggle-tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.portal {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  padding: clamp(28px, 6vw, 72px);
  overflow: hidden auto;
  color: var(--app-text);
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(
      circle at 84% 12%,
      color-mix(in srgb, #0046ff 14%, transparent),
      transparent 32%
    ),
    linear-gradient(145deg, var(--app-bg), var(--app-bg-end));
}

.login-panel {
  display: grid;
  align-content: center;
  width: min(100%, 1040px);
  min-height: calc(100vh - clamp(56px, 12vw, 144px));
  margin-inline: auto;
}

.product-name {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  height: 34px;
  color: var(--app-text);
}

.hash-logo {
  flex: none;
  width: 120px;
  height: 22px;
}

.product-name > span {
  height: 22px;
  font-size: clamp(1.25rem, 2vw, 1.625rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 22px;
}

.login-content {
  display: grid;
  grid-template-areas: "intro form";
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: clamp(64px, 10vw, 140px);
  align-items: stretch;
  margin-top: clamp(58px, 10vh, 108px);
}

.login-intro {
  display: grid;
  grid-area: intro;
  align-content: space-between;
  gap: clamp(40px, 8vh, 88px);
  max-width: 560px;
}

.login-intro h1 {
  margin: 0;
  font-size: clamp(3rem, 7vw, 5.5rem);
  font-weight: 450;
  letter-spacing: -0.04em;
  line-height: 0.96;
  text-wrap: balance;
}

.login-intro p {
  max-width: 52ch;
  margin: 0;
  color: var(--app-secondary);
  font-size: 18px;
  line-height: 1.35;
  text-wrap: pretty;
}

.login-intro a {
  color: #0046ff;
  font-weight: 500;
  text-decoration: none;
}

.login-intro a:hover,
.login-intro a:focus-visible {
  color: var(--app-text);
  outline: none;
}

.login-form {
  position: relative;
  display: grid;
  grid-area: form;
  gap: clamp(24px, 4vh, 40px);
  width: min(100%, 430px);
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--app-secondary);
  font-family: "KH Teka Mono", monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-form input {
  width: 100%;
  padding: 14px 15px;
  color: var(--app-text);
  font-family: "KH Teka", sans-serif;
  font-size: 1rem;
  letter-spacing: normal;
  text-transform: none;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 11px;
  box-shadow: 0 12px 35px rgb(14 17 20 / 4%);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.login-form input:focus {
  border-color: rgb(0 70 255 / 55%);
  box-shadow:
    0 12px 35px rgb(14 17 20 / 4%),
    0 0 0 3px rgb(0 70 255 / 10%);
}

.login-form input:disabled {
  cursor: default;
  opacity: 0.72;
}

.login-form button {
  display: grid;
  place-items: center;
  min-height: 48px;
  margin-top: 8px;
  color: #fbfaf7;
  font-size: 1rem;
  font-weight: 500;
  background: #0046ff;
  border: 0;
  border-radius: 11px;
  box-shadow: 0 14px 32px rgb(0 70 255 / 20%);
  cursor: pointer;
  transition:
    background-color 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.login-form button:hover:not(:disabled),
.login-form button:focus-visible {
  background: #101010;
  outline: none;
}

.login-form button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.login-form button.login-success {
  cursor: default;
  opacity: 1;
}

.login-success-icon {
  width: 24px;
  height: 24px;
  stroke: currentcolor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.form-error {
  position: absolute;
  top: calc(100% + 12px);
  margin: 0;
  color: var(--app-text);
  font-size: 0.75rem;
  font-weight: 500;
}

@media (max-width: 760px) {
  .theme-toggle-wrap {
    top: 28px;
    right: 28px;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
  }

  .login-content {
    grid-template-areas:
      "intro"
      "form";
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
    margin-top: 52px;
  }

  .login-intro {
    gap: 28px;
  }

  .login-form {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  .theme-icon,
  .theme-toggle-tooltip {
    transition: none;
  }
}
