/* Design tokens */
  

:root {
  --color-page-background: #0b1020;
  --color-page-background-deep: #080b16;
  --color-surface: #111831;
  --color-card: rgba(255, 255, 255, 0.06);
  --color-text: #eaf0ff;
  --color-text-muted: #a9b4d0;
  --color-primary: #7c9cff;
  --color-primary-highlight: #8cf0ff;
  --color-accent: #f26a2e;
  --color-border: rgba(255, 255, 255, 0.1);
  --shadow-elevated: 0 20px 60px rgba(0, 0, 0, 0.35);
  --border-radius-card: 20px;
  --content-max-width: 1120px;
}

/* Global document styles */
   

* {
  box-sizing: border-box;
  scrollbar-width: none; /* Hide scrollbars without disabling scrolling (Firefox). */
}

*::-webkit-scrollbar {
  display: none; /* Chrome, Safari, and other WebKit browsers. */
}

html {
  scroll-behavior: smooth;
  background: var(--color-page-background-deep);
}

body {
  position: relative;
  z-index: 0;
  margin: 0;
  color: var(--color-text);
  background: none;
  font-family: "Space Grotesk", ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(
      circle at top left,
      rgba(124, 156, 255, 0.18),
      transparent 30%
    ),
    radial-gradient(
      circle at top right,
      rgba(140, 240, 255, 0.12),
      transparent 30%
    ),
    linear-gradient(
      180deg,
      var(--color-page-background),
      var(--color-page-background-deep) 100%
    );
}

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

img {
  display: block;
  max-width: 100%;
}

.page-container {
  width: min(100% - 2rem, var(--content-max-width));
  margin-inline: auto;
}

.text-accent {
  color: var(--color-accent);
}

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

.button {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 1.35rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: #08111f;
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-primary-highlight)
  );
  box-shadow: var(--shadow-elevated);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.button:not(:disabled):not(.button--disabled):hover,
.upload-folder-link:hover,
.auth-mode-switch a:hover {
  opacity: 0.95;
  transform: translateY(-2px);
}

.button--outlined {
  color: var(--color-text);
  background: transparent;
}

.button--disabled {
  color: var(--color-accent);
  cursor: default;
  pointer-events: none;
}

.button--auth-secondary {
  border-color: var(--color-primary);
  color: var(--color-primary-highlight);
  background: transparent;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   Site header and account navigation
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--color-border);
  background: rgba(8, 11, 22, 0.95);
}

.site-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1rem;
}

.site-brand,
.site-brand:hover,
.site-brand:visited,
.site-brand:active {
  color: var(--color-text);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  transition: none;
  animation: none;
  transform: none;
}

.site-brand:focus-visible {
  outline: 2px solid var(--color-primary-highlight);
  outline-offset: 4px;
}

.site-navigation__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

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

.home-hero {
  padding: 5.5rem 0;
}

.home-hero__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}

.home-hero__title {
  margin: 0 0 1rem;
  font-size: clamp(3.5rem, 8vw, 6.4rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.home-hero__tagline {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-muted);
  background: var(--color-card);
  font-size: 1.15rem;
}

.home-hero__feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 480px));
  gap: 1rem;
  justify-content: center;
  width: 100%;
  margin: 2rem auto 0;
}

.home-hero__feature {
  display: flex;
  min-height: 180px;
  padding: 2rem;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.home-hero__description {
  justify-content: flex-start;
  text-align: left;
}

.home-hero__description strong {
  font-size: 2rem;
  line-height: 1.35;
}

.upload-folder-link {
  display: inline-flex;
  width: 10rem;
  height: 10rem;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--color-primary);
  border-radius: 50%;
  background: rgba(124, 156, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(140, 240, 255, 0.18),
    var(--shadow-elevated);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.upload-folder-link:focus-visible {
  outline: 3px solid rgba(140, 240, 255, 0.5);
  outline-offset: 4px;
}

.upload-folder-link__icon {
  position: relative;
  width: 4.8rem;
  height: 3.4rem;
  border-radius: 0.45rem;
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-primary-highlight)
  );
  box-shadow: 0 10px 25px rgba(124, 156, 255, 0.28);
}

.upload-folder-link__icon::before {
  content: "";
  position: absolute;
  top: -0.9rem;
  left: 0;
  width: 2.35rem;
  height: 1.15rem;
  border-radius: 0.4rem 0.4rem 0 0;
  background: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Homepage content sections and offering cards
   -------------------------------------------------------------------------- */

.page-section {
  padding: 4rem 0;
}

.section-heading {
  margin-bottom: 1.5rem;
}

.section-heading h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: -0.03em;
}

.section-heading p {
  max-width: 65ch;
  margin: 0;
  color: var(--color-text-muted);
}

.section-actions {
  padding-top: 1rem;
}

.offering-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.offering-card {
  display: flex;
  height: 100%;
  padding: 1.4rem;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-card);
  background: var(--color-card);
}

.offering-card h3 {
  margin: 0 0 0.5rem;
}

.offering-card p {
  margin: 0;
  color: var(--color-text-muted);
}

.offering-card__actions {
  margin-top: auto;
  padding-top: 1rem;
}

/* --------------------------------------------------------------------------
   About section
   -------------------------------------------------------------------------- */

.about-section__content {
  display: flex;
  gap: 1.25rem;
  align-items: stretch;
  padding: 1.4rem;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-card);
  background: var(--color-card);
  box-shadow: var(--shadow-elevated);
}

.about-section__text {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
}

.about-section__image {
  display: flex;
  width: 240px;
  min-width: 240px;
  flex: 0 0 240px;
  overflow: hidden;
}

.about-section__image img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius-card);
  object-fit: cover;
}

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

.site-footer {
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.site-footer__contact {
  margin-top: 0.5rem;
}

.site-footer__contact a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}

.site-footer__contact a:hover,
.site-footer__contact a:focus-visible {
  color: var(--color-primary-highlight);
}

/* --------------------------------------------------------------------------
   Authentication pages and forms
   -------------------------------------------------------------------------- */

.auth-page {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
}

.auth-page__layout {
  display: flex;
  width: 100%;
  flex: 1;
  padding: 0.5rem 1rem;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  margin: auto;
  padding: 1.5rem;
  flex: 0 1 430px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-card);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.04)
  );
  box-shadow: var(--shadow-elevated);
}

.auth-card--entry {
  height: min(54rem, calc(100vh - 4rem));
  height: min(54rem, calc(100dvh - 4rem));
  min-height: 24rem;
  margin: 0;
  padding: 1.25rem;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
}

.auth-mode-switch {
  display: flex;
  flex: none;
  margin-bottom: 1rem;
  padding: 0.25rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

.auth-mode-switch a {
  flex: 1;
  padding: 0.6rem;
  border-radius: inherit;
  color: var(--color-text-muted);
  text-align: center;
  font-weight: 700;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.auth-mode-switch a[aria-current="page"] {
  color: #08111f;
  background: var(--color-primary-highlight);
}

.auth-mode-switch a:focus-visible {
  outline: 2px solid var(--color-primary-highlight);
  outline-offset: 2px;
}

.auth-panel {
  flex: 1;
  min-height: 0;
  padding: 0.25rem;
  overflow-y: auto;
}

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

.auth-card--entry .auth-card__actions {
  display: grid;
  flex: none;
  padding-inline: 0.25rem;
}

.auth-card__actions .button {
  display: none;
  width: 100%;
}

.auth-card--entry[data-auth-mode="login"] [data-auth-submit="login"],
.auth-card--entry[data-auth-mode="signup"] [data-auth-submit="signup"] {
  display: inline-flex;
}

/* Let desktop cards grow for enlarged text and errors instead of clipping fields. */
@media (min-width: 861px) {
  .auth-card--entry {
    height: auto;
    min-height: 60rem;
  }

  .auth-panel {
    min-height: min-content;
    overflow-y: visible;
  }
}

.auth-panel__description {
  min-height: 3.2em; /* Both login and signup reserve two lines of copy. */
  margin: 0 0 0.5rem;
  color: var(--color-text-muted);
}

@media (max-width: 389px) {
  .auth-panel .auth-card__title {
    min-height: 3.2em; /* Two heading lines when signup wraps. */
  }

  .auth-panel__description {
    min-height: 6.4em; /* Four lines at narrow mobile widths. */
  }
}

/* Reserve warning space; long messages scroll instead of moving controls. */
.auth-card--entry .auth-field__feedback,
.auth-card--entry .auth-form__non-field-errors {
  display: block;
  height: 2.6em;
  overflow: auto;
  overflow-wrap: anywhere;
}

.auth-card--entry .auth-form__non-field-errors {
  min-height: 3.9em;
  height: auto;
  overflow: visible;
}

.auth-card--entry .auth-field--invalid .auth-field__feedback {
  min-height: 2.6em;
  height: auto;
  overflow: visible;
}

.auth-card--entry .auth-card__back-link {
  flex: none;
}

.auth-card--entry > p {
  margin-bottom: 0.5rem;
}

.auth-card--entry .auth-form {
  gap: 0.5rem;
}

.auth-card--entry .auth-field {
  gap: 0.3rem;
}

.auth-card__title {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  letter-spacing: -0.03em;
}

.auth-card > p {
  margin: 0 0 1rem;
  color: var(--color-text-muted);
}

.auth-form {
  display: grid;
  gap: 0.35rem;
}

.auth-form__non-field-errors {
  color: #ffae8a;
  font-size: 0.875rem;
  line-height: 1.3;
}

.auth-form__non-field-errors:empty,
.auth-field__feedback:empty {
  display: none;
}

.auth-card--entry .auth-form__non-field-errors:empty,
.auth-card--entry .auth-field__feedback:empty {
  display: block;
}

.auth-form__non-field-errors span,
.auth-field__feedback span {
  display: block;
}

.auth-field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.auth-form .form-label {
  color: var(--color-text);
  font-weight: 600;
}

.auth-form .asteriskField {
  margin-left: 0.2rem;
  color: var(--color-accent);
}

.auth-field input,
.auth-field select,
.auth-field textarea {
  width: 100%;
  min-width: 0;
  padding: 0.95rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  outline: none;
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.05);
  font: inherit;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.auth-field select {
  color-scheme: dark;
}

.auth-field select option {
  color: var(--color-text);
  background: var(--color-surface);
}

.auth-field input:focus,
.auth-field select:focus,
.auth-field textarea:focus {
  border-color: rgba(124, 156, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.15);
}

.auth-field--valid input,
.auth-field--valid select,
.auth-field--valid textarea {
  border-color: #58c98d;
}

.auth-field--invalid input,
.auth-field--invalid select,
.auth-field--invalid textarea {
  border-color: #ff7b72;
  box-shadow: 0 0 0 3px rgba(255, 123, 114, 0.12);
}

.auth-field__feedback {
  color: #ffae8a;
  font-size: 0.875rem;
  line-height: 1.3;
}

/* Fit the whole card in a desktop browser, with errors beside their labels. */
@media (min-width: 1600px) and (min-height: 850px) {
  .auth-card--entry {
    min-height: min(49rem, calc(100dvh - 7rem));
    align-self: center;
  }

  .auth-card--entry .auth-form {
    gap: 0.35rem;
  }

  .auth-card--entry .auth-card__actions {
    margin-top: 0.25rem;
  }

  .auth-card--entry .auth-field {
    position: relative;
    gap: 0.15rem;
  }

  .auth-card--entry .auth-form .form-label {
    font-size: 0.875rem;
    line-height: 1.3;
  }

  .auth-card--entry .auth-form__non-field-errors {
    min-height: 2.6em;
  }

  .auth-card--entry .auth-field__feedback {
    position: absolute;
    top: 0;
    right: 0;
    width: 60%;
    height: 1.3em;
    text-align: right;
  }

  .auth-card--entry .auth-field--invalid .auth-field__feedback {
    position: static;
    width: 100%;
    min-height: 0;
    height: auto;
    overflow: visible;
    text-align: left;
  }
}

.upload-service-error {
  margin-top: 1rem;
  color: #ffae8a;
}

.analysis-processing {
  margin: 0.5rem 0 0;
  color: var(--color-accent);
}

.analysis-result__download {
  justify-self: start;
}

.auth-card--analysis {
  max-width: 760px;
  flex-basis: 760px;
}

.analysis-result {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.analysis-result__heading {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.analysis-result__heading h1,
.analysis-result__heading h2,
.analysis-result h2,
.analysis-result h3 {
  margin: 0;
}

.analysis-result__eyebrow {
  margin: 0 0 0.25rem;
  color: var(--color-accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.analysis-result__score {
  display: grid;
  width: 4rem;
  height: 4rem;
  flex: 0 0 4rem;
  place-items: center;
  border: 1px solid var(--color-accent);
  border-radius: 50%;
  color: var(--color-accent);
  font-size: 1.4rem;
  font-weight: 800;
}

.analysis-result__summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
}

.analysis-result__summary div {
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.analysis-result__summary dt {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.analysis-result__summary dd {
  margin: 0.25rem 0 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}

.analysis-result__improvements {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.analysis-result__improvements li {
  display: grid;
  gap: 0.3rem;
  padding: 0.85rem;
  border-left: 3px solid var(--color-accent);
  background: rgba(255, 255, 255, 0.04);
}

.analysis-result__improvements span {
  color: var(--color-text-muted);
}

.analysis-result__raw summary {
  cursor: pointer;
  color: var(--color-accent);
  font-weight: 600;
}

.analysis-result__raw pre {
  max-height: 28rem;
  margin: 0.75rem 0 0;
  padding: 1rem;
  overflow: auto;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.78rem;
}

@media (max-width: 620px) {
  .analysis-result__summary {
    grid-template-columns: 1fr;
  }
}

.auth-form__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.auth-form__actions .button {
  width: 100%;
}

.auth-card__back-link {
  display: block;
  margin-top: 1.25rem;
  color: var(--color-text-muted);
  text-align: center;
}

.auth-card__back-link:hover {
  color: var(--color-accent);
}

.account-notice {
  width: min(28rem, calc(100% - 2rem));
  margin: 1rem auto;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-primary);
  border-radius: 12px;
  color: var(--color-text);
  background: var(--color-surface);
  overflow-wrap: anywhere;
}

.account-notice:empty {
  display: none;
}

.account-notice--error {
  border-color: #ff7b72;
}

.account-notice p {
  margin: 0;
}

.account-notice p + p {
  margin-top: 0.5rem;
}

.auth-card--entry .account-notice {
  display: block;
  flex: none;
  width: 100%;
  min-height: 5.2em;
  height: auto;
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.3;
  overflow: visible;
}

.auth-card--entry .account-notice:empty {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .button,
  .upload-folder-link,
  .auth-mode-switch a {
    transition: none;
  }

  .button:not(:disabled):not(.button--disabled):hover,
  .upload-folder-link:hover,
  .auth-mode-switch a:hover {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Responsive layout
   -------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .site-navigation {
    gap: 0.5rem 1rem;
    flex-wrap: wrap;
  }

  .site-navigation__actions {
    gap: 0.5rem;
  }

  .site-navigation__actions .button {
    padding: 0.55rem 0.9rem;
  }

  .auth-card--entry {
    height: min(54rem, calc(100dvh - 5.5rem));
  }

  .home-hero {
    padding-top: 3.5rem;
  }

  .home-hero__feature-grid {
    grid-template-columns: minmax(0, 480px);
  }

  .offering-grid {
    grid-template-columns: 1fr;
  }

  .about-section__content {
    flex-direction: column;
  }

  .about-section__image {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }

  .about-section__image img {
    height: auto;
  }
}
