/* Korastel · component primitives
   Framework-agnostic classes built only from tokens. Nothing here knows about
   the marketing site; the site layer composes these. */

/* ========================================================== layout shells */
.k-container {
  width: 100%;
  max-width: var(--k-container);
  margin-inline: auto;
  padding-inline: var(--k-gutter);
}

.k-container--narrow {
  max-width: var(--k-container-narrow);
}

.k-section {
  padding-block: var(--k-section-y);
}

/* Structural hairline in the Aurora Gradient. Used sparingly — it is the
   loudest brand device in the system. */
.k-rule-aurora {
  height: 2px;
  border: 0;
  margin: 0;
  background-image: var(--k-gradient-aurora);
  border-radius: var(--k-radius-pill);
}

.k-rule {
  height: 1px;
  border: 0;
  margin: 0;
  background-color: var(--k-color-border);
}

/* ============================================================ skip link */
.k-skip-link {
  position: absolute;
  left: var(--k-space-4);
  top: var(--k-space-4);
  z-index: calc(var(--k-z-overlay) + 1);
  padding: var(--k-space-3) var(--k-space-5);
  border-radius: var(--k-radius-md);
  background-color: var(--k-color-graphite-900);
  color: var(--k-color-cloud-white);
  font-size: var(--k-text-sm);
  font-weight: var(--k-weight-semibold);
  text-decoration: none;
  transform: translateY(calc(-100% - var(--k-space-8)));
}

.k-skip-link:focus-visible {
  transform: translateY(0);
}

/* ========================================================= focus states */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: var(--k-focus-width) solid var(--k-color-focus-ring);
  outline-offset: var(--k-focus-offset);
  border-radius: var(--k-radius-xs);
}

/* =============================================================== buttons */
.k-button {
  --_bg: transparent;
  --_fg: var(--k-color-text);
  --_border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--k-space-2);
  min-height: 3rem;
  padding: var(--k-space-3) var(--k-space-6);
  border: 1px solid var(--_border);
  border-radius: var(--k-radius-pill);
  background-color: var(--_bg);
  color: var(--_fg);
  font-size: var(--k-text-md);
  font-weight: var(--k-weight-semibold);
  letter-spacing: var(--k-tracking-snug);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--k-duration-fast) var(--k-ease-standard),
    border-color var(--k-duration-fast) var(--k-ease-standard),
    color var(--k-duration-fast) var(--k-ease-standard),
    transform var(--k-duration-fast) var(--k-ease-standard);
}

.k-button:active {
  transform: translateY(1px);
}

.k-button[disabled],
.k-button[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.k-button--primary {
  --_bg: var(--k-color-action);
  --_fg: var(--k-color-text-on-brand);
  --_border: var(--k-color-action);
}

.k-button--primary:hover:not([disabled]) {
  --_bg: var(--k-color-action-hover);
  --_border: var(--k-color-action-hover);
}

.k-button--primary:active:not([disabled]) {
  --_bg: var(--k-color-action-active);
  --_border: var(--k-color-action-active);
}

.k-button--secondary {
  --_fg: var(--k-color-text);
  --_border: var(--k-color-border-strong);
}

.k-button--secondary:hover:not([disabled]) {
  --_bg: var(--k-color-surface-subtle);
  --_border: var(--k-color-graphite-300);
}

.k-theme-inverse .k-button--secondary:hover:not([disabled]) {
  --_bg: rgb(255 255 255 / 0.06);
}

.k-button--quiet {
  --_fg: var(--k-color-text-accent);
  min-height: 2.5rem;
  padding-inline: var(--k-space-3);
}

.k-button--quiet:hover:not([disabled]) {
  --_bg: var(--k-color-action-quiet-bg);
}

.k-button--full {
  width: 100%;
}

/* Trailing arrow that eases outward on hover. */
.k-button__arrow {
  transition: transform var(--k-duration-base) var(--k-ease-out);
}

.k-button:hover .k-button__arrow {
  transform: translateX(3px);
}

/* ================================================================ status */
.k-status {
  display: inline-flex;
  align-items: center;
  gap: var(--k-space-2);
  padding: 0.3rem var(--k-space-3);
  border: 1px solid var(--k-color-border-strong);
  border-radius: var(--k-radius-pill);
  background-color: var(--k-color-surface);
  color: var(--k-color-text-secondary);
  font-size: var(--k-text-2xs);
  font-weight: var(--k-weight-semibold);
  letter-spacing: var(--k-tracking-wide);
  text-transform: uppercase;
  line-height: 1.4;
  white-space: nowrap;
}

.k-theme-inverse .k-status {
  background-color: rgb(255 255 255 / 0.04);
}

.k-status__dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: var(--k-radius-pill);
  background-color: var(--k-color-graphite-300);
  flex: none;
}

.k-status--active .k-status__dot {
  background-color: var(--k-color-action);
}

.k-status--planned .k-status__dot {
  background-color: var(--k-color-intelligent-teal);
}

/* ================================================================= cards */
.k-card {
  display: flex;
  flex-direction: column;
  gap: var(--k-space-3);
  padding: var(--k-space-6);
  border: 1px solid var(--k-color-border);
  border-radius: var(--k-radius-lg);
  background-color: var(--k-color-surface);
}

.k-card--interactive {
  transition: border-color var(--k-duration-base) var(--k-ease-standard),
    box-shadow var(--k-duration-base) var(--k-ease-standard),
    transform var(--k-duration-base) var(--k-ease-standard);
}

.k-card--interactive:hover {
  border-color: var(--k-color-border-strong);
  box-shadow: var(--k-shadow-md);
  transform: translateY(-2px);
}

/* ============================================================== the form */
.k-field {
  display: flex;
  flex-direction: column;
  gap: var(--k-space-2);
}

.k-field__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--k-space-3);
  font-size: var(--k-text-sm);
  font-weight: var(--k-weight-semibold);
  letter-spacing: var(--k-tracking-snug);
  color: var(--k-color-text);
}

.k-field__optional {
  font-size: var(--k-text-xs);
  font-weight: var(--k-weight-regular);
  letter-spacing: 0;
  color: var(--k-color-text-muted);
  text-transform: none;
}

.k-input,
.k-select,
.k-textarea {
  width: 100%;
  min-height: 3rem;
  padding: var(--k-space-3) var(--k-space-4);
  border: 1px solid var(--k-color-border-strong);
  border-radius: var(--k-radius-md);
  background-color: var(--k-color-surface);
  color: var(--k-color-text);
  font-size: var(--k-text-md);
  line-height: var(--k-leading-normal);
  transition: border-color var(--k-duration-fast) var(--k-ease-standard),
    box-shadow var(--k-duration-fast) var(--k-ease-standard);
}

.k-theme-inverse :is(.k-input, .k-select, .k-textarea) {
  background-color: rgb(255 255 255 / 0.04);
}

.k-input::placeholder,
.k-textarea::placeholder {
  color: var(--k-color-text-muted);
}

.k-input:hover,
.k-select:hover,
.k-textarea:hover {
  border-color: var(--k-color-graphite-300);
}

.k-textarea {
  min-height: 9rem;
}

.k-select {
  appearance: none;
  padding-right: var(--k-space-10);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%236B7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--k-space-4) center;
}

.k-field[data-invalid="true"] :is(.k-input, .k-select, .k-textarea) {
  border-color: var(--k-color-danger);
  box-shadow: inset 0 0 0 1px var(--k-color-danger);
}

.k-field__hint,
.k-field__error {
  font-size: var(--k-text-sm);
  line-height: var(--k-leading-normal);
}

.k-field__hint {
  color: var(--k-color-text-muted);
}

.k-field__error {
  display: flex;
  align-items: flex-start;
  gap: var(--k-space-2);
  color: var(--k-color-danger);
  font-weight: var(--k-weight-medium);
}

.k-field__error:empty {
  display: none;
}

.k-field__counter {
  font-family: var(--k-font-mono);
  font-size: var(--k-text-xs);
  color: var(--k-color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* Off-screen honeypot. Not display:none — some bots skip hidden inputs. */
.k-honeypot {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------- form feedback */
.k-formstatus {
  display: flex;
  align-items: flex-start;
  gap: var(--k-space-3);
  padding: var(--k-space-4) var(--k-space-5);
  border: 1px solid var(--k-color-border);
  border-radius: var(--k-radius-md);
  background-color: var(--k-color-surface-subtle);
  font-size: var(--k-text-md);
  line-height: var(--k-leading-normal);
}

.k-formstatus:empty {
  display: none;
}

.k-formstatus--success {
  border-color: var(--k-color-emerald-soft);
  background-color: var(--k-color-success-tint);
  color: var(--k-color-graphite-800);
}

.k-theme-inverse .k-formstatus--success {
  border-color: rgb(0 224 140 / 0.35);
  background-color: rgb(0 198 122 / 0.12);
  color: var(--k-color-text);
}

.k-formstatus--error {
  border-color: color-mix(in srgb, var(--k-color-danger) 40%, transparent);
  background-color: var(--k-color-danger-tint);
  color: var(--k-color-graphite-800);
}

.k-theme-inverse .k-formstatus--error {
  background-color: rgb(179 38 30 / 0.16);
  color: var(--k-color-text);
}

/* ----------------------------------------------------------- busy state */
.k-spinner {
  width: 1rem;
  height: 1rem;
  flex: none;
  border-radius: var(--k-radius-pill);
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  animation: k-spin 700ms linear infinite;
}

@keyframes k-spin {
  to {
    transform: rotate(360deg);
  }
}

/* =============================================================== the logo */
.k-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.k-logo img {
  width: auto;
}

/* ============================================================== utilities */
.k-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.k-stack {
  display: flex;
  flex-direction: column;
  gap: var(--k-space-4);
}

.k-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--k-space-3);
}
