/**
 * SiparisON Theme Core
 * Shared design tokens, base styles and reusable interface components.
 */

/* ==========================================================================
   Design Tokens
   ========================================================================== */

:root {
  --color-page: #f3f4f2;
  --color-surface: #ffffff;
  --color-surface-muted: #eef1ef;
  --color-text: #243649;
  --color-heading: #102337;
  --color-text-muted: #64717d;
  --color-border: #d6dcdd;
  --color-border-strong: #bcc7c9;
  --color-primary: #347970;
  --color-primary-dark: #245d57;
  --color-primary-soft: #e4eeec;
  --color-navy: #1a3146;
  --color-success: #238867;
  --color-danger: #c33b4d;
  --shadow-surface: 0 10px 28px rgba(16, 35, 55, .1);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --space-section: clamp(76px, 8vw, 112px);
  --font-size-section-title: clamp(2.25rem, 3.4vw, 3.25rem);
  --font-size-section-lead: clamp(1rem, 1.25vw, 1.125rem);
  --font-size-card-title: clamp(1.2rem, 1.6vw, 1.45rem);
  --font-size-card-body: .9375rem;
  --space-card: clamp(24px, 2.5vw, 32px);
  --radius-card: 12px;
  --shadow-card: 0 4px 14px rgba(16, 35, 55, .07);
  --motion-ease: cubic-bezier(.22, 1, .36, 1);
  --motion-reveal-duration: 560ms;
  --motion-reveal-distance: 18px;
  --motion-reveal-stagger: 70ms;
  --motion-reveal-stagger-max: 280ms;
  --motion-receipt-duration: 1350ms;
  --motion-receipt-delay: 160ms;
  --motion-receipt-ease: cubic-bezier(.26, .58, .24, 1);
  --motion-lifecycle-state: 420ms;
  --motion-lifecycle-track: 520ms;
}

/* ==========================================================================
   Reset and Base
   ========================================================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--color-text);
  background: var(--color-page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  overflow-x: clip;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.l-container {
  width: min(1320px, calc(100% - 48px));
  margin-inline: auto;
}

.l-section {
  position: relative;
  padding-block: var(--space-section);
  scroll-margin-top: 24px;
}

.l-section.l-section--white {
  border-block: 1px solid rgba(220, 229, 238, .72);
  background: var(--color-surface);
  border-color: var(--color-border);
}

.l-section.l-section--muted {
  background: var(--color-surface-muted);
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.u-skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 10px;
  color: #fff;
  background: var(--color-heading);
  transform: translateY(-160%);
  transition: transform .2s ease;
}

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

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

/* ==========================================================================
   Site Header and Brand
   ========================================================================== */

.c-site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 60px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.c-site-header__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  margin-left: auto;
}

.c-site-header__action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--color-navy);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition:
    color .2s ease,
    background-color .2s ease;
}

.c-site-header__action[aria-disabled="true"] {
  cursor: default;
  user-select: none;
}

.c-site-header__action--account {
  color: var(--color-text-muted);
}

.c-site-header__action--auth {
  gap: 5px;
  color: var(--color-heading);
}

.c-site-header__action--auth::before {
  content: "";
  width: 1px;
  height: 18px;
  margin-right: 5px;
  background: var(--color-border);
}

.c-site-header__action--demo {
  min-height: 44px;
  gap: 8px;
  margin-left: 10px;
  padding: 10px 18px;
  border-color: var(--color-primary-dark);
  color: #fff;
  background: var(--color-primary-dark);
  box-shadow: 0 4px 12px rgba(36, 93, 87, .16);
  font-size: 14px;
  font-weight: 850;
  transition:
    background-color .2s ease,
    box-shadow .2s ease;
}

.c-site-header__actions--single .c-site-header__action--demo {
  margin-left: 0;
}

.c-site-header__action-arrow {
  display: inline-block;
  font-size: 16px;
  line-height: 1;
  transition: translate .2s var(--motion-ease);
}

.c-site-header__action-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s var(--motion-ease);
}

.c-site-header__action--demo:hover {
  background: #194f4a;
  box-shadow: 0 5px 14px rgba(36, 93, 87, .2);
}

.c-site-header__action--demo:hover .c-site-header__action-arrow {
  translate: 3px 0;
}

.c-site-header__action--demo:hover .c-site-header__action-icon {
  transform: rotate(-8deg);
}

.c-site-header__action--demo:focus-visible {
  outline: 3px solid rgba(16, 155, 139, .28);
  outline-offset: 3px;
}

a.c-site-header__action--account:hover,
a.c-site-header__action--auth:hover {
  color: var(--color-heading);
  background: var(--color-surface-muted);
}

a.c-site-header__action--account:focus-visible,
a.c-site-header__action--auth:focus-visible {
  outline: 3px solid rgba(16, 155, 139, .24);
  outline-offset: 3px;
}

.c-site-header__action.is-current {
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
}

.c-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.c-brand__mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(16, 155, 139, .28);
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--color-primary-dark);
  box-shadow: 0 3px 9px rgba(16, 35, 55, .12);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -.04em;
  border-color: var(--color-primary-dark);
}

.c-brand__copy strong {
  display: block;
  color: var(--color-heading);
  font-size: 19px;
  letter-spacing: -.03em;
}

.c-brand__copy span {
  display: block;
  color: var(--color-text-muted);
  font-size: 13px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.c-button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  transition: box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
}

.c-button:hover {
  transform: none;
}

.c-button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(16, 155, 139, .28);
  outline-offset: 3px;
}

.c-button--primary {
  color: #fff;
  background: var(--color-primary-dark);
  box-shadow: 0 4px 12px rgba(36, 93, 87, .18);
}

.c-button--primary:hover {
  background: #194f4a;
  box-shadow: 0 5px 14px rgba(36, 93, 87, .2);
}

.c-button__icon {
  font-size: 17px;
  line-height: 1;
}

.c-button:disabled {
  color: #87949d;
  background: #dce1e1;
  box-shadow: none;
  cursor: not-allowed;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.c-form {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 22px;
  border: 1px solid rgba(203, 216, 228, .9);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  border-color: var(--color-border);
}

.c-form__field {
  display: grid;
  gap: 7px;
}

.c-form__field--full {
  grid-column: 1 / -1;
}

.c-form__field label {
  color: var(--color-navy);
  font-size: 14px;
  font-weight: 800;
}

.c-form__field input:not([type="checkbox"]) {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  color: var(--color-heading);
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.c-form__field input:not([type="checkbox"])::placeholder {
  color: #98a6b5;
}

.c-form__field input:not([type="checkbox"]):hover {
  border-color: #aabcca;
}

.c-form__field input:not([type="checkbox"])[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.c-form__footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 2px;
}

.c-form__privacy {
  max-width: 290px;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.c-form__submit {
  min-width: 150px;
  border: 0;
  cursor: pointer;
}

.c-form__status {
  grid-column: 1 / -1;
  min-height: 20px;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 13px;
}

.c-form__status.is-error {
  color: var(--color-danger);
}

.c-form__status.is-ready {
  color: var(--color-primary-dark);
}

.c-form__error,
.c-form__hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.c-form__error {
  min-height: 0;
  color: var(--color-danger);
}

.c-form__error:empty {
  display: none;
}

.c-form__hint {
  color: var(--color-text-muted);
}

.c-form__choice {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}

.c-form__field .c-form__choice {
  font-weight: 500;
}

.c-form__choice input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--color-primary-dark);
}

.c-form__choice input[aria-invalid="true"] {
  outline: 2px solid var(--color-danger);
  outline-offset: 2px;
}

.c-input-control {
  position: relative;
}

.c-form__field .c-input-control input {
  padding-right: 84px;
}

.c-input-control__action {
  position: absolute;
  top: 50%;
  right: 6px;
  min-width: 68px;
  min-height: 36px;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  transform: translateY(-50%);
}

.c-input-control__action:hover {
  background: #d8e7e4;
}

.c-input-control__action:focus-visible {
  outline: 3px solid rgba(16, 155, 139, .28);
  outline-offset: 2px;
}

/* ==========================================================================
   Site Footer
   ========================================================================== */

.c-site-footer {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 28px;
  padding-block: 10px 40px;
  color: var(--color-text-muted);
  font-size: 11px;
}

.c-site-footer strong {
  color: var(--color-navy);
}

.c-site-footer__brand {
  max-width: 430px;
}

.c-site-footer__brand p {
  margin: 8px 0 0;
  line-height: 1.6;
}

.c-site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 20px;
}

.c-site-footer__nav a,
.c-site-footer__nav span {
  color: #6c7d90;
  font-size: 10px;
  font-weight: 750;
  text-decoration: none;
}

.c-site-footer__nav span {
  cursor: default;
  user-select: none;
}

.c-site-footer__nav a:hover {
  color: var(--color-primary-dark);
}

.c-site-footer__nav a:focus-visible {
  outline: 3px solid rgba(16, 155, 139, .24);
  outline-offset: 3px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
  :root {
    --motion-reveal-duration: 480ms;
    --motion-reveal-distance: 12px;
    --motion-reveal-stagger: 50ms;
    --motion-reveal-stagger-max: 200ms;
    --motion-receipt-duration: 1100ms;
    --motion-receipt-delay: 120ms;
    --motion-lifecycle-state: 360ms;
    --motion-lifecycle-track: 460ms;
  }

  .l-container {
    width: min(100% - 28px, 620px);
  }

  .c-site-header {
    min-height: 48px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .c-site-header__actions {
    width: 100%;
    display: grid;
    grid-template-columns: .8fr 1.4fr 1fr;
    gap: 6px;
    margin-left: 0;
  }

  .c-site-header__actions--single {
    width: auto;
    display: flex;
    margin-left: auto;
  }

  .c-site-header__action {
    min-height: 44px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .c-site-header__action--account,
  .c-site-header__action--auth {
    border-color: var(--color-border);
    background: var(--color-surface);
  }

  .c-site-header__action--auth::before {
    display: none;
  }

  .c-site-header__action--demo {
    gap: 6px;
    margin-left: 0;
    padding-inline: 10px;
    font-size: 12px;
  }

  .c-brand__copy span {
    display: none;
  }

  .c-button {
    min-height: 48px;
  }

  .l-section {
    padding-block: 62px;
  }

  .c-form {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .c-form__field--full,
  .c-form__footer,
  .c-form__status {
    grid-column: auto;
  }

  .c-form__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .c-form__submit {
    width: 100%;
  }

  .c-site-footer {
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: 20px;
  }

  .c-site-footer__nav {
    justify-content: flex-start;
  }
}

@media (max-width: 430px) {
  .c-site-header__actions {
    grid-template-columns: .82fr 1.42fr 1.08fr;
  }

  .c-site-header__action {
    padding-inline: 7px;
    font-size: 11px;
  }

  .c-site-header__action-arrow {
    display: none;
  }

  .c-button {
    width: 100%;
  }

  .c-form {
    padding: 15px;
  }
}

@media (max-width: 340px) {
  .c-site-header__action-icon {
    display: none;
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
