/* ============================================================
   Trateria Partner Portal — Stylesheet
   Design tokens are drawn from the Trateria logo:
   deep navy wordmark + teal-to-blue mark gradient.
   ============================================================ */

:root {
  --navy: #0f1d3d;
  --navy-2: #16294f;
  --navy-soft: #2a3a5c;
  --teal: #00afaf;
  --blue: #1aa3da;
  --gradient: linear-gradient(115deg, var(--teal) 0%, var(--blue) 100%);

  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --bg-soft-2: #eef1f6;
  --border: #e2e6ee;
  --text: #1b2540;
  --text-muted: #5b6478;
  --text-faint: #8991a3;

  --success-bg: #edf9f4;
  --success-text: #157a56;
  --danger-bg: #fdf0ee;
  --danger-text: #c03f2c;

  --radius-s: 6px;
  --radius-m: 10px;
  --container: 1120px;

  --font-head: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  color: var(--navy);
  line-height: 1.2;
  margin: 0 0 0.5em;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; color: var(--text-muted); }

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

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

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Header / Nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav__brand img { height: 28px; width: auto; }

.nav__brand-portal {
  font-size: 12px;
  color: var(--text-faint);
  border-left: 1px solid var(--border);
  padding-left: 10px;
  margin-left: 2px;
  letter-spacing: 0.01em;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav__links a {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-s);
  transition: color 0.15s ease, background 0.15s ease;
}

.nav__links a:hover { color: var(--navy); background: var(--bg-soft); }

.nav__links a.is-active {
  color: var(--navy);
  font-weight: 600;
}

.nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--navy);
  margin: 5px 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--navy);
  color: #fff;
}
.btn--primary:hover { background: #142a52; }

.btn--accent {
  background: var(--teal);
  color: #fff;
}
.btn--accent:hover { background: #009a9a; }

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--navy);
}
.btn--ghost:hover { border-color: var(--navy); }

.btn--sm { padding: 8px 16px; font-size: 13.5px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Hero ---------- */

.hero {
  padding: 84px 0 64px;
  border-bottom: 1px solid var(--border);
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 18px;
}

.hero__eyebrow::before {
  content: '';
  width: 22px;
  height: 2px;
  background: var(--gradient);
  border-radius: 2px;
}

.hero h1 {
  font-size: clamp(32px, 4.2vw, 48px);
  max-width: 15ch;
}

.hero p.lead {
  font-size: 17px;
  max-width: 56ch;
  margin-bottom: 28px;
}

.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Sections ---------- */

.section { padding: 56px 0; }
.section--soft { background: var(--bg-soft); }
.section--border-top { border-top: 1px solid var(--border); }

.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.section__head h2 { font-size: 24px; margin-bottom: 4px; }
.section__head .hint { font-size: 14px; color: var(--text-faint); margin: 0; }

/* ---------- News cards ---------- */

.news-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.news-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 22px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.news-card:hover { border-color: var(--navy-soft); transform: translateY(-2px); }

.news-card__date {
  font-size: 12.5px;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 8px;
}

.news-card h3 { font-size: 17px; margin-bottom: 8px; }

.news-card p {
  font-size: 14.5px;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-card__more {
  font-size: 13px;
  font-weight: 600;
  color: var(--teal);
  margin: 0;
}

.news-card__img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius-s);
  margin-bottom: 14px;
  background: var(--bg-soft-2);
}

/* ---------- News detail modal ---------- */

.news-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 29, 61, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
}

.news-modal-overlay.is-open { display: flex; }

.news-modal {
  background: #fff;
  border-radius: var(--radius-m);
  width: 100%;
  max-width: 620px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(15, 29, 61, 0.28);
}

.news-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 0;
  flex-shrink: 0;
}

.news-modal__date {
  font-size: 12.5px;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 8px;
}

.news-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  flex-shrink: 0;
}
.news-modal__close:hover { color: var(--navy); }

.news-modal__body {
  overflow: auto;
  padding: 4px 24px 26px;
}

.news-modal__body h3 { font-size: 20px; margin-bottom: 14px; }

.news-modal__body img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--radius-s);
  margin-bottom: 16px;
}

.news-modal__body p {
  font-size: 14.5px;
  color: var(--text-muted);
  white-space: pre-line;
  margin-bottom: 0;
}

/* ---------- Quick links ---------- */

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.quick-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 24px;
  background: #fff;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.quick-card:hover { transform: translateY(-2px); border-color: var(--navy-soft); }

.quick-card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-s);
  background: var(--bg-soft-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--teal);
}

.quick-card h3 { font-size: 16px; margin-bottom: 6px; }
.quick-card p { font-size: 14px; margin-bottom: 12px; }
.quick-card .link { font-size: 13.5px; font-weight: 600; color: var(--navy); }

/* ---------- States: loading / empty / error ---------- */

.state-box {
  border: 1px dashed var(--border);
  border-radius: var(--radius-m);
  padding: 36px 24px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
}

.state-box.is-error { border-color: var(--danger-text); color: var(--danger-text); background: var(--danger-bg); }

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  vertical-align: -3px;
  margin-right: 8px;
}

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

/* ---------- Forms ---------- */

.form-card {
  max-width: 620px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 32px;
  background: #fff;
}

.form-row { margin-bottom: 18px; }
.form-row:last-child { margin-bottom: 0; }

.form-row label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.form-row .req { color: var(--teal); }

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14.5px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--bg-soft);
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--teal);
  background: #fff;
}

.form-row textarea { resize: vertical; min-height: 90px; }

.form-row .field-error {
  font-size: 12.5px;
  color: var(--danger-text);
  margin-top: 5px;
  display: none;
}

.form-row.has-error input,
.form-row.has-error textarea,
.form-row.has-error select { border-color: var(--danger-text); }

.form-row.has-error .field-error { display: block; }

.checkbox-group {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14.5px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
  cursor: pointer;
}

.form-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
}

.form-note { font-size: 12.5px; color: var(--text-faint); margin: 14px 0 0; }

/* Steps indicator (registration is a genuine 3-step sequence) */
.steps {
  display: flex;
  gap: 28px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.step { display: flex; align-items: center; gap: 10px; }

.step__num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-faint);
  flex-shrink: 0;
}

.step.is-current .step__num { background: var(--navy); border-color: var(--navy); color: #fff; }
.step__label { font-size: 13.5px; color: var(--text-faint); }
.step.is-current .step__label { color: var(--navy); font-weight: 600; }

/* Success panel */
.success-panel {
  max-width: 620px;
  border: 1px solid var(--success-text);
  background: var(--success-bg);
  border-radius: var(--radius-m);
  padding: 34px 32px;
  text-align: left;
}

.success-panel__icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--success-text);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.success-panel h3 { font-size: 19px; margin-bottom: 8px; }
.success-panel p { color: var(--navy); opacity: 0.85; margin-bottom: 0; }

/* ---------- Auth gate (Resources / FAQ) ---------- */

.gate {
  max-width: 420px;
  margin: 24px auto 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 34px 32px;
  background: #fff;
  text-align: left;
}

.gate__icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-soft-2);
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.gate h2 { font-size: 20px; margin-bottom: 6px; }
.gate p.lead { font-size: 14px; margin-bottom: 22px; }

.session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  margin-bottom: 28px;
  font-size: 13.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.session-bar strong { color: var(--navy); }

/* ---------- Resources (folders) ---------- */

.folder {
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  margin-bottom: 12px;
  overflow: hidden;
  background: #fff;
}

.folder__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  background: #fff;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.folder__head:hover { background: var(--bg-soft); }

.folder__icon { color: var(--teal); flex-shrink: 0; }

.folder__name { font-weight: 600; color: var(--navy); font-size: 15px; flex: 1; }
.folder__count { font-size: 12.5px; color: var(--text-faint); }

.folder__chevron { transition: transform 0.18s ease; color: var(--text-faint); flex-shrink: 0; }
.folder.is-open .folder__chevron { transform: rotate(90deg); }

.folder__body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 6px 10px;
}

.folder.is-open .folder__body { display: block; }

.resource-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: var(--radius-s);
}

.resource-item:hover { background: var(--bg-soft); }

.resource-item__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-s);
  background: var(--bg-soft-2);
  color: var(--navy-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.resource-item__name { font-size: 14.5px; color: var(--text); flex: 1; }

.resource-item__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.resource-item__preview {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  padding: 0;
}
.resource-item__preview:hover { color: var(--teal); }

.resource-item a.resource-item__open { font-size: 13px; font-weight: 600; color: var(--teal); }

.resource-item a.resource-item__download {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}
.resource-item a.resource-item__download:hover { color: var(--teal); }

/* ---------- Preview modal ---------- */

.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 29, 61, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
}

.preview-overlay.is-open { display: flex; }

.preview-modal {
  background: #fff;
  border-radius: var(--radius-m);
  width: 100%;
  max-width: 880px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(15, 29, 61, 0.28);
}

.preview-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.preview-modal__title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-modal__actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

.preview-modal__actions a { font-size: 13px; font-weight: 600; color: var(--teal); }

.preview-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
}
.preview-modal__close:hover { color: var(--navy); }

.preview-modal__body {
  flex: 1;
  overflow: auto;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.preview-modal__body iframe {
  width: 100%;
  height: 100%;
  min-height: 60vh;
  border: 0;
  display: block;
}

.preview-modal__body img {
  max-width: 100%;
  max-height: 78vh;
  display: block;
  margin: auto;
}

.preview-modal__fallback {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
}

/* ---------- FAQ ---------- */

.faq-search {
  max-width: 420px;
  margin-bottom: 28px;
}

.faq-category {
  font-size: 13px;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 32px 0 12px;
}

.faq-category:first-child { margin-top: 0; }

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 4px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--navy);
}

.faq-item__plus {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  position: relative;
}
.faq-item__plus::before, .faq-item__plus::after {
  content: '';
  position: absolute;
  background: var(--navy);
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.faq-item__plus::before { width: 12px; height: 2px; top: 9px; left: 4px; }
.faq-item__plus::after { width: 2px; height: 12px; top: 4px; left: 9px; }
.faq-item.is-open .faq-item__plus::after { transform: rotate(90deg); opacity: 0; }

.faq-item__a {
  display: none;
  padding: 0 4px 20px;
  font-size: 14.5px;
  color: var(--text-muted);
  max-width: 72ch;
}

.faq-item.is-open .faq-item__a { display: block; }

/* ---------- Contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
}

.contact-info__row {
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
}

.contact-info__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-s);
  background: var(--bg-soft-2);
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-info__row h4 { font-size: 14.5px; margin-bottom: 4px; }
.contact-info__row p { font-size: 14.5px; margin-bottom: 0; }
.contact-info__row a { color: var(--text-muted); }
.contact-info__row a:hover { color: var(--teal); }

.map-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;
  height: 260px;
}
.map-frame iframe { width: 100%; height: 100%; border: 0; }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--navy);
  color: #c7cede;
  padding: 32px 0 16px;
  margin-top: 28px;
}

.footer-grid {
  display: block;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.footer-brand img { height: 22px; margin-bottom: 8px; filter: brightness(0) invert(1); }
.footer-brand p { color: #8b95b3; font-size: 13px; max-width: 46ch; margin-bottom: 0; }

.footer-col h5 {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}

.footer-col a, .footer-col p {
  display: block;
  font-size: 13.5px;
  color: #a9b2cc;
  margin-bottom: 10px;
}
.footer-col a:hover { color: #fff; }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  font-size: 12.5px;
  color: #7c86a3;
  flex-wrap: wrap;
  gap: 10px;
}

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

@media (max-width: 860px) {
  .news-grid, .quick-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 720px) {
  .nav__links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 20px 16px;
    display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__links a { padding: 12px 6px; border-bottom: 1px solid var(--bg-soft-2); }
  .nav__toggle { display: block; }
  .nav__brand-portal { display: none; }
  .hero { padding: 56px 0 40px; }
  .section { padding: 40px 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}
