/**
 * EUPT Platform CSS Foundation (items 1–200)
 * Shared: public WordPress (plugin), client app, staff portal.
 * Does not replace theme hero/layout — tokens, components, page polish, Sinhala baseline.
 */

/* 1–10 Root harmonization */
:root {
  --et-color-whatsapp: #25d366;
  --et-color-whatsapp-dark: #128c7e;
  --et-z-base: 1;
  --et-z-dropdown: 40;
  --et-z-sticky: 50;
  --et-z-overlay: 60;
  --et-z-modal: 70;
  --et-z-toast: 80;
  --et-fs-xs: 0.75rem;
  --et-fs-sm: 0.875rem;
  --et-fs-body: 1rem;
  --et-fs-lg: 1.125rem;
  --et-fs-xl: 1.25rem;
  --et-fs-2xl: clamp(1.5rem, 3.5vw, 2rem);
  --et-fs-hero: clamp(1.85rem, 4.5vw, 2.75rem);
  --et-lh-tight: 1.25;
  --et-lh-body: 1.6;
  --et-lh-relaxed: 1.72;
  --et-duration-fast: 120ms;
  --et-duration: 180ms;
  --et-ease: cubic-bezier(0.2, 0, 0, 1);
}

/* 11–20 Box model & media */
*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
picture,
video,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* 21–30 Focus & skip (a11y) */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--et-color-brand, #105078);
  outline-offset: 2px;
}

.et-skip-link:focus,
.skip:focus,
a.eupt-skip:focus {
  position: fixed;
  left: var(--et-inset, 16px);
  top: var(--et-inset, 16px);
  z-index: var(--et-z-toast);
  background: var(--et-color-surface, #fff);
  color: var(--et-color-text-strong, #1c2b36);
  padding: var(--et-space-1, 8px) var(--et-space-2, 16px);
  border-radius: var(--et-radius-sm, 8px);
  box-shadow: var(--et-shadow-md);
}

/* 31–40 Motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 41–50 Typography baseline */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Apply on client/staff shells only — WordPress theme keeps its own body styles. */
body.et-platform-reset {
  margin: 0;
  font-size: var(--et-fs-body);
  line-height: var(--et-lh-body);
  color: var(--et-color-text, #505050);
  background: var(--et-color-canvas, #f4f6f8);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
  overflow-wrap: anywhere;
}

p,
li {
  overflow-wrap: anywhere;
}

/* 51–60 Sinhala script quality (all surfaces) */
html[lang="si"] body,
body.eupt-lang-si,
body[data-locale="si"],
.lang-si {
  font-family: var(--et-font-si);
  line-height: var(--et-lh-relaxed);
  letter-spacing: 0;
}

html[lang="si"] h1,
html[lang="si"] h2,
body.eupt-lang-si h1,
body.eupt-lang-si h2 {
  letter-spacing: 0;
  line-height: var(--et-lh-tight);
}

/* 61–70 Links & buttons */
a {
  color: var(--et-color-brand, #105078);
}

.et-btn,
.eupt-btn,
button.primary,
.btn-primary {
  min-height: var(--et-touch, 44px);
  border-radius: var(--et-radius-md, 12px);
  font-weight: 600;
  transition: background-color var(--et-duration) var(--et-ease),
    border-color var(--et-duration) var(--et-ease),
    color var(--et-duration) var(--et-ease),
    transform var(--et-duration) var(--et-ease);
}

.et-btn:active:not(:disabled),
.eupt-btn:active:not(:disabled) {
  transform: translateY(1px);
}

/* 71–80 Form controls */
input,
select,
textarea,
button {
  font: inherit;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  min-height: var(--et-touch, 44px);
  border-radius: var(--et-radius-sm, 8px);
}

label {
  line-height: var(--et-lh-body);
}

.et-field-error,
.eupt-notice--error {
  color: var(--et-color-danger, #d82028);
}

/* 81–90 Surfaces & cards */
.et-surface,
.eupt-panel,
.card {
  background: var(--et-color-surface, #fff);
  border: 1px solid var(--et-color-line, #e4e8ec);
  border-radius: var(--et-radius-md, 12px);
  box-shadow: var(--et-shadow-sm);
}

/* 91–100 Utilities */
.et-stack {
  display: flex;
  flex-direction: column;
  gap: var(--et-space-2, 16px);
}

.et-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--et-space-1, 8px);
}

.et-touch-target {
  min-width: var(--et-touch, 44px);
  min-height: var(--et-touch, 44px);
}

.et-visually-hidden,
.sr-only,
.eupt-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;
}

.et-text-muted {
  color: var(--et-color-disabled, #a8b0b6);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: light;
  }
}

/* ========== 101–200 Platform polish (all surfaces) ========== */

/* 101–110 Extended tokens */
:root {
  --et-color-success: #0d7a4a;
  --et-color-success-bg: #e8f5ef;
  --et-color-warning: #9a6700;
  --et-color-warning-bg: var(--et-color-warning-bg, #f3f0ea);
  --et-color-info-bg: #e8f2f8;
  --et-space-0: 4px;
  --et-space-5: 40px;
  --et-space-6: 48px;
  --et-radius-lg: 16px;
  --et-radius-pill: 999px;
  --et-content-narrow: 720px;
}

/* 111–120 Page shells */
body.et-platform-reset .et-page,
body.et-platform-reset .content,
.eupt-page-shell {
  max-width: var(--et-content-max, 1120px);
  margin-inline: auto;
  padding-inline: var(--et-inset, 16px);
  padding-block: var(--et-space-3, 24px);
}

.et-page-narrow {
  max-width: var(--et-content-narrow, 720px);
  margin-inline: auto;
}

/* 121–130 Typography scale utilities */
.et-text-xs { font-size: var(--et-fs-xs); }
.et-text-sm { font-size: var(--et-fs-sm); }
.et-text-lg { font-size: var(--et-fs-lg); }
.et-text-xl { font-size: var(--et-fs-xl); }
.et-heading-hero {
  font-size: var(--et-fs-hero);
  line-height: var(--et-lh-tight);
  color: var(--et-color-text-strong);
  font-weight: 700;
}
.et-heading-section {
  font-size: var(--et-fs-2xl);
  line-height: var(--et-lh-tight);
  color: var(--et-color-text-strong);
  font-weight: 700;
}
.et-lead {
  font-size: var(--et-fs-lg);
  line-height: var(--et-lh-relaxed);
  color: var(--et-color-text);
}

/* 131–140 Alerts & badges */
.et-alert,
.eupt-notice {
  padding: var(--et-space-2);
  border-radius: var(--et-radius-md);
  border: var(--et-border-width, 1px) solid var(--et-color-line);
  background: var(--et-color-surface);
  line-height: var(--et-lh-body);
}
.et-alert--info,
.eupt-notice--info {
  background: var(--et-color-info-bg);
  border-color: rgb(16 80 120 / 0.2);
}
.et-alert--success {
  background: var(--et-color-success-bg);
  border-color: rgb(13 122 74 / 0.25);
}
.et-alert--warning {
  background: var(--et-color-warning-bg);
  border-color: rgb(154 103 0 / 0.2);
}
.et-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  font-size: var(--et-fs-xs);
  font-weight: 600;
  border-radius: var(--et-radius-pill);
  background: var(--et-color-silver, #e8eef4);
  color: var(--et-color-text-strong);
}

/* 141–150 Tabs & nav pills */
.et-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--et-space-1);
  border-bottom: var(--et-border-width, 1px) solid var(--et-color-line);
  padding-bottom: var(--et-space-1);
}
.et-tab,
.eupt-tabs__tab {
  min-height: var(--et-touch);
  padding: 0 var(--et-space-2);
  border-radius: var(--et-radius-sm) var(--et-radius-sm) 0 0;
  font-weight: 600;
  color: var(--et-color-text);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.et-tab[aria-selected="true"],
.et-tab.is-active,
.eupt-tabs__tab.is-active,
.eupt-tabs__tab[aria-selected="true"] {
  color: var(--et-color-brand);
  box-shadow: inset 0 -2px 0 var(--et-color-gold, #c9a227);
}

/* 151–160 Empty & loading states */
.et-empty {
  text-align: center;
  padding: var(--et-space-5) var(--et-space-2);
  color: var(--et-color-text);
}
.et-empty__title {
  font-size: var(--et-fs-lg);
  font-weight: 700;
  color: var(--et-color-text-strong);
  margin: 0 0 var(--et-space-1);
}
.et-skeleton {
  background: linear-gradient(
    90deg,
    var(--et-color-line) 0%,
    var(--et-color-silver, #e8eef4) 50%,
    var(--et-color-line) 100%
  );
  background-size: 200% 100%;
  animation: et-shimmer 1.2s ease-in-out infinite;
  border-radius: var(--et-radius-sm);
}
@keyframes et-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* 161–170 Tables (staff + client lists) */
.et-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: var(--et-border-width, 1px) solid var(--et-color-line);
  border-radius: var(--et-radius-md);
  background: var(--et-color-surface);
}
.et-table-wrap table,
table.et-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--et-fs-sm);
}
.et-table-wrap th,
table.et-table th {
  text-align: left;
  padding: 12px var(--et-space-2);
  font-weight: 600;
  color: var(--et-color-text-strong);
  background: var(--et-color-canvas);
  border-bottom: var(--et-border-width, 1px) solid var(--et-color-line);
}
.et-table-wrap td,
table.et-table td {
  padding: 12px var(--et-space-2);
  border-bottom: var(--et-border-width, 1px) solid var(--et-color-line);
  vertical-align: top;
}
.et-table-wrap tr:last-child td,
table.et-table tr:last-child td {
  border-bottom: 0;
}

/* 171–180 Staff portal hooks (body.et-platform-reset) */
body.et-platform-reset .auth-card,
body.et-platform-reset .button.primary {
  border-radius: var(--et-radius-md);
}
body.et-platform-reset .form-stack label span {
  font-size: var(--et-fs-sm);
  font-weight: 600;
  color: var(--et-color-text-strong);
}
body.et-platform-reset .dialog {
  border-radius: var(--et-radius-lg);
  box-shadow: var(--et-shadow-lg);
}

/* 181–190 Client app hooks */
body.et-platform-reset .app-header {
  box-shadow: var(--et-shadow-sm);
}
body.et-platform-reset .bottom-nav {
  box-shadow: 0 -1px 0 var(--et-color-line);
}
body.et-platform-reset .card,
body.et-platform-reset .trip-card,
body.et-platform-reset .quote-card {
  border-radius: var(--et-radius-md);
  transition: box-shadow var(--et-duration) var(--et-ease);
}
body.et-platform-reset .trip-card:focus-within,
body.et-platform-reset .quote-card:hover {
  box-shadow: var(--et-shadow-md);
}
body.et-platform-reset .shell-main {
  max-width: var(--et-content-max, 1120px);
  margin-inline: auto;
  padding: var(--et-space-2) var(--et-inset, 16px) calc(var(--et-bottom-nav, 56px) + var(--et-space-3));
}
body.et-platform-reset .shell-main--auth {
  padding-bottom: var(--et-space-3);
}

/* 191–200 Public plugin (eupt-* — no theme layout change) */
.eupt-section,
.eupt-service-layout,
.eupt-contact {
  line-height: var(--et-lh-relaxed);
}
.eupt-service-layout {
  display: grid;
  gap: var(--et-space-3);
}
@media (min-width: 768px) {
  .eupt-service-layout {
    grid-template-columns: 1fr minmax(280px, 340px);
    align-items: start;
  }
}
.eupt-service-panel,
.eupt-contact__details,
.eupt-contact__form,
.eupt-dest-card,
.eupt-related__card,
.eupt-steps-cards li {
  background: var(--et-color-surface, #fff);
  border: var(--et-border-width, 1px) solid var(--et-color-line, #e4e8ec);
  border-radius: var(--et-radius-md, 12px);
  box-shadow: var(--et-shadow-sm);
}
.eupt-service-panel,
.eupt-contact__details,
.eupt-contact__form {
  padding: var(--et-space-3, 24px);
}
.eupt-btn,
.eupt-btn--primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--et-touch, 44px);
  padding: 0 var(--et-space-3);
  font-weight: 600;
  border-radius: var(--et-radius-md, 12px);
  text-decoration: none;
  transition: background-color var(--et-duration) var(--et-ease),
    transform var(--et-duration) var(--et-ease);
}
.eupt-btn--primary {
  background: var(--et-color-brand, #105078);
  color: var(--et-color-white, #fff);
  border: 0;
}
.eupt-btn--primary:hover {
  filter: brightness(1.05);
}
.eupt-faq__item {
  border: var(--et-border-width, 1px) solid var(--et-color-line);
  border-radius: var(--et-radius-sm);
  padding: var(--et-space-1) var(--et-space-2);
  margin-bottom: var(--et-space-1);
}
.eupt-faq__item summary {
  cursor: pointer;
  font-weight: 600;
  min-height: var(--et-touch);
  display: flex;
  align-items: center;
}
.eupt-form-intro,
.eupt-section-lead {
  color: var(--et-color-text);
  max-width: 65ch;
}
.eupt-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--et-space-0, 4px);
}
.eupt-store__toolbar input,
.eupt-enquiry input,
.eupt-enquiry select,
.eupt-enquiry textarea {
  min-height: var(--et-touch, 44px);
  border-radius: var(--et-radius-sm, 8px);
}
@media (max-width: 767px) {
  .eupt-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--et-space-1);
  }
}
