/* =========================================================================
   Shared Services Portal — Styles
   Design language: Claude (Anthropic) inspired — see DESIGN.md
   ========================================================================= */

/* ----- Tokens ----- */
:root {
  /* Brand */
  --terracotta: #c96442;
  --coral:      #d97757;

  /* Surface */
  --parchment:  #f5f4ed;
  --ivory:      #faf9f5;
  --white:      #ffffff;
  --warm-sand:  #e8e6dc;
  --dark-surface: #30302e;
  --deep-dark:  #141413;

  /* Text */
  --near-black: #141413;
  --charcoal:   #4d4c48;
  --olive-gray: #5e5d59;
  --stone-gray: #87867f;
  --dark-warm:  #3d3d3a;
  --warm-silver:#b0aea5;

  /* Borders & rings */
  --border-cream: #f0eee6;
  --border-warm:  #e8e6dc;
  --border-dark:  #30302e;
  --ring-warm:    #d1cfc5;
  --ring-deep:    #c2c0b6;

  /* Semantic */
  --error: #b53333;
  --focus: #3898ec;

  /* Type */
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans:  "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-mono:  "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  /* Shadows */
  --ring-1: 0 0 0 1px var(--ring-warm);
  --ring-2: 0 0 0 1px var(--ring-deep);
  --whisper: 0 4px 24px rgba(0,0,0,0.05);
  --whisper-md: 0 8px 32px rgba(0,0,0,0.06);
}

/* ----- Reset & Base ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--near-black);
  background: var(--parchment);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--near-black); text-decoration: none; transition: color 160ms ease; }
a:hover { color: var(--terracotta); }

/* ----- Typography utility classes ----- */
.overline {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--stone-gray);
  margin: 0 0 16px;
}
.overline-light { color: var(--warm-silver); }

/* ===========================================================================
   View routing
   =========================================================================== */
.view { display: none; min-height: 100vh; }
.view.is-active { display: block; }

/* ===========================================================================
   WELCOME
   =========================================================================== */
.view-welcome {
  display: none;
  place-items: center;
  background: var(--parchment);
  padding: 24px;
}
.view-welcome.is-active { display: grid; }

.welcome-canvas {
  max-width: 760px;
  width: 100%;
  text-align: center;
  padding: 24px;
}
.welcome-logo {
  display: block;
  margin: 0 auto 40px;
  height: 96px;
  width: auto;
  max-width: 80%;
  user-select: none;
}

.welcome-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(40px, 7vw, 64px);
  line-height: 1.10;
  color: var(--near-black);
  margin: 0 0 24px;
  letter-spacing: -0.01em;
}
.welcome-sub {
  font-family: var(--font-sans);
  font-size: 20px;
  line-height: 1.6;
  color: var(--olive-gray);
  margin: 0 auto 40px;
  max-width: 560px;
}
.welcome-foot {
  margin-top: 24px;
  font-size: 14px;
  color: var(--stone-gray);
}

/* ===========================================================================
   BUTTONS
   =========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  border-radius: 12px;
  padding: 12px 20px;
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
  user-select: none;
}
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--terracotta);
  color: var(--ivory);
  box-shadow: 0 0 0 1px var(--terracotta);
}
.btn-primary:hover { background: var(--coral); box-shadow: 0 0 0 1px var(--coral), var(--whisper); }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  background: var(--warm-sand);
  color: var(--charcoal);
  box-shadow: var(--ring-1);
  border-radius: 8px;
  padding: 10px 16px;
}
.btn-secondary:hover { background: #ddd9cc; box-shadow: var(--ring-2); }

.btn-ghost {
  background: transparent;
  color: var(--charcoal);
  padding: 12px 20px;
  border-radius: 12px;
}
.btn-ghost:hover { background: var(--warm-sand); }

.btn-lg { padding: 16px 28px; font-size: 17px; border-radius: 14px; }
.btn-arrow { display: inline-block; transition: transform 200ms ease; }
.btn:hover .btn-arrow { transform: translateX(3px); }

/* ===========================================================================
   TERMS
   =========================================================================== */
.view-terms {
  background: var(--parchment);
  padding: 64px 24px;
  display: none;
}
.view-terms.is-active { display: block; }

.terms-shell {
  max-width: 780px;
  margin: 0 auto;
}
.terms-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  margin: 0 0 16px -10px;
  width: max-content;
  font-size: 14px;
  font-weight: 500;
  color: var(--olive-gray);
  background: transparent;
  border-radius: 8px;
  transition: background 160ms ease, color 160ms ease;
}
.terms-back:hover { background: var(--warm-sand); color: var(--near-black); }
.terms-back-arrow { font-size: 16px; line-height: 1; display: inline-block; transition: transform 200ms ease; }
.terms-back:hover .terms-back-arrow { transform: translateX(-3px); }
.terms-head { text-align: center; margin-bottom: 32px; }
.terms-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.10;
  margin: 0 0 12px;
  color: var(--near-black);
}
.terms-sub {
  margin: 0;
  color: var(--olive-gray);
  font-size: 17px;
}

.terms-card {
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: 16px;
  box-shadow: var(--whisper);
  padding: 40px 44px;
  max-height: 56vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.terms-card:focus { outline: none; box-shadow: var(--whisper-md), 0 0 0 1px var(--ring-warm); }

.terms-card::-webkit-scrollbar { width: 10px; }
.terms-card::-webkit-scrollbar-track { background: transparent; }
.terms-card::-webkit-scrollbar-thumb { background: var(--border-warm); border-radius: 999px; }
.terms-card::-webkit-scrollbar-thumb:hover { background: var(--ring-warm); }

.terms-body h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.30;
  color: var(--near-black);
  margin: 28px 0 10px;
}
.terms-body h3:first-child { margin-top: 0; }
.terms-body p {
  margin: 0 0 14px;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--charcoal);
}
.terms-body ul { margin: 0 0 16px; padding-left: 22px; }
.terms-body li { margin-bottom: 6px; color: var(--charcoal); font-size: 15.5px; line-height: 1.6; }
.terms-body strong { color: var(--near-black); font-weight: 600; }

/* Custom checkbox */
.terms-check {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 24px;
  padding: 14px 16px;
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: 12px;
  cursor: pointer;
  transition: box-shadow 160ms ease, background 160ms ease;
}
.terms-check:hover { box-shadow: var(--ring-1); }
.terms-check input { position: absolute; opacity: 0; pointer-events: none; }
.terms-check-box {
  width: 20px; height: 20px;
  border-radius: 6px;
  background: var(--white);
  border: 1.5px solid var(--ring-warm);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 160ms ease, border-color 160ms ease;
}
.terms-check-box::after {
  content: "";
  width: 11px; height: 6px;
  border-left: 2px solid var(--ivory);
  border-bottom: 2px solid var(--ivory);
  transform: rotate(-45deg) translate(1px, -1px) scale(0.6);
  opacity: 0;
  transition: opacity 120ms ease, transform 160ms ease;
}
.terms-check input:checked ~ .terms-check-box {
  background: var(--terracotta);
  border-color: var(--terracotta);
}
.terms-check input:checked ~ .terms-check-box::after { opacity: 1; transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.terms-check-label { font-size: 15px; color: var(--charcoal); }

.terms-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ===========================================================================
   TOPNAV (shared by hub + service)
   =========================================================================== */
.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 244, 237, 0.92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border-cream);
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 8px 32px;
}
.topnav-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--near-black);
  line-height: 1;
}
.brand-mark {
  height: 48px;
  width: auto;
  display: block;
  user-select: none;
}
.brand-divider {
  width: 1px;
  height: 22px;
  background: var(--border-warm);
  display: inline-block;
}
.brand-section {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 17px;
  color: var(--near-black);
  letter-spacing: 0.01em;
}
/* Legacy dot kept for backwards compat if any old markup lingers */
.brand-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(201,100,66,0.18);
}
.topnav-links {
  display: flex;
  gap: 24px;
  margin-left: auto;
}
.topnav-link {
  font-size: 15px;
  color: var(--olive-gray);
  font-weight: 500;
}
.topnav-link.is-active, .topnav-link:hover { color: var(--near-black); }
.topnav-cta { display: inline-flex; align-items: center; margin-left: auto; }
.topnav-meta {
  font-size: 13px;
  color: var(--stone-gray);
}

/* In-hero back link (sits above the service title, where the eyebrow used to) */
.svc-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  margin-left: -10px;
  width: max-content;
  font-size: 14px;
  font-weight: 500;
  color: var(--olive-gray);
  background: transparent;
  border-radius: 8px;
  transition: background 160ms ease, color 160ms ease;
  text-decoration: none;
}
.svc-back:hover {
  background: var(--warm-sand);
  color: var(--near-black);
}
.svc-back-arrow {
  font-size: 16px;
  line-height: 1;
  display: inline-block;
  transition: transform 200ms ease;
}
.svc-back:hover .svc-back-arrow { transform: translateX(-3px); }

/* ===========================================================================
   HUB
   =========================================================================== */
.view-hub { background: var(--parchment); }

.hub-hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 32px 40px;
}
.hub-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1.10;
  margin: 0 0 16px;
  color: var(--near-black);
  letter-spacing: -0.01em;
}
.hub-sub {
  font-family: var(--font-sans);
  font-size: 20px;
  line-height: 1.6;
  color: var(--olive-gray);
  margin: 0;
  max-width: 640px;
}

.hub-grid {
  max-width: 1200px;
  margin: 24px auto 0;
  padding: 0 32px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.svc-card {
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: 16px;
  padding: 28px 28px 24px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 160ms ease;
  cursor: pointer;
  min-height: 240px;
}
.svc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--whisper-md);
  border-color: var(--border-warm);
}
.svc-card-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--warm-sand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  color: var(--terracotta);
}
.svc-card-icon svg { width: 28px; height: 28px; }
.svc-card-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 25px;
  line-height: 1.20;
  margin: 0;
  color: var(--near-black);
}
.svc-card-desc {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--olive-gray);
  flex-grow: 1;
}
.svc-card-foot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--terracotta);
  margin-top: 8px;
}
.svc-card:hover .svc-card-foot .btn-arrow { transform: translateX(4px); }

/* Hub strip — dark section to alternate rhythm */
.hub-strip {
  background: var(--deep-dark);
  color: var(--warm-silver);
  padding: 64px 32px;
  border-top: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
}
.hub-strip-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}
.strip-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.20;
  color: var(--ivory);
  margin: 8px 0 12px;
  max-width: 760px;
}
.strip-body {
  margin: 0;
  font-size: 17px;
  line-height: 1.6;
  color: var(--warm-silver);
  max-width: 720px;
}
.strip-body a { color: var(--coral); }
.strip-body a:hover { color: var(--ivory); }

.hub-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 32px;
  font-size: 13px;
  color: var(--stone-gray);
}

/* ===========================================================================
   SERVICE DETAIL
   =========================================================================== */
.view-service { background: var(--parchment); }

.svc-hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 32px 24px;
  display: grid;
  gap: 18px;
}
.svc-hero h1 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(36px, 5.5vw, 56px);
  line-height: 1.10;
  margin: 0;
  color: var(--near-black);
  letter-spacing: -0.01em;
}
.svc-hero p {
  margin: 0;
  font-size: 19px;
  line-height: 1.6;
  color: var(--olive-gray);
  max-width: 760px;
}

.svc-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}
.svc-section + .svc-section { margin-top: 64px; }
.svc-section-head {
  margin: 0 0 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-warm);
}
.svc-section-head h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(24px, 3vw, 30px);
  line-height: 1.20;
  margin: 0;
  color: var(--near-black);
  letter-spacing: -0.005em;
}

/* Purpose pane */
.purpose-card {
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: 24px;
  padding: 48px;
  box-shadow: var(--whisper);
  max-width: 880px;
}
.purpose-card .label {
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--terracotta);
  font-weight: 500;
  margin: 0 0 16px;
}
.purpose-card .text {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.55;
  color: var(--near-black);
  margin: 0;
  font-weight: 400;
}
.purpose-card .text + .text { margin-top: 18px; }
.purpose-note {
  margin-top: 20px;
  font-size: 14px;
  color: var(--stone-gray);
  font-style: italic;
}

/* Guidelines pane */
.guideline-cat {
  margin-bottom: 48px;
}
.guideline-cat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-warm);
}
.guideline-cat-head h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.20;
  margin: 0;
  color: var(--near-black);
}
.guideline-cat-head .count {
  font-size: 13px;
  color: var(--stone-gray);
  font-variant-numeric: tabular-nums;
}

.guideline-list {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.guideline-item {
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: 12px;
  padding: 24px 28px;
  display: grid;
  gap: 12px;
  transition: box-shadow 200ms ease, border-color 160ms ease;
}
.guideline-item:hover { box-shadow: var(--ring-1); border-color: var(--border-warm); }

.gi-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.gi-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 20px;
  line-height: 1.30;
  color: var(--near-black);
  margin: 0;
}
.gi-type {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--olive-gray);
  background: var(--warm-sand);
  border-radius: 999px;
  padding: 4px 10px;
}

.gi-section { display: grid; gap: 4px; }
.gi-section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--terracotta);
}
.gi-section-text {
  font-size: 15px;
  line-height: 1.65;
  color: var(--charcoal);
  margin: 0;
}

.gi-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border-cream);
}
.gi-pic { font-size: 13px; color: var(--stone-gray); }

/* Inline documents inside each guideline item */
.gi-files {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}
.gi-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gi-file {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--parchment);
  border: 1px solid var(--border-warm);
  border-radius: 10px;
  padding: 6px 12px 6px 6px;
  font-size: 14px;
  color: var(--charcoal);
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 120ms ease;
}
.gi-file:hover {
  background: var(--white);
  border-color: var(--ring-warm);
  color: var(--near-black);
  box-shadow: var(--ring-1);
  transform: translateY(-1px);
}
.gi-file-ext {
  display: inline-flex;
  width: 30px; height: 30px;
  align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.4px;
  background: var(--warm-sand);
  border-radius: 7px;
  text-transform: uppercase;
  color: var(--charcoal);
  flex-shrink: 0;
}
.gi-file-ext[data-ext="pdf"]   { color: #b53333; }
.gi-file-ext[data-ext="docx"]  { color: #2563b8; }
.gi-file-ext[data-ext="doc"]   { color: #2563b8; }
.gi-file-ext[data-ext="xlsx"]  { color: #1f7a3a; }
.gi-file-ext[data-ext="xls"]   { color: #1f7a3a; }
.gi-file-ext[data-ext="pptx"]  { color: #c96442; }
.gi-file-ext[data-ext="ppt"]   { color: #c96442; }
.gi-file-name {
  font-weight: 500;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gi-file-arrow {
  font-size: 13px;
  color: var(--stone-gray);
  margin-left: 2px;
  transition: transform 200ms ease, color 160ms ease;
}
.gi-file:hover .gi-file-arrow { color: var(--terracotta); transform: translateY(2px); }

.gi-files-empty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--stone-gray);
  font-style: italic;
}

/* ===========================================================================
   Responsive
   =========================================================================== */
@media (max-width: 768px) {
  .topnav { padding: 12px 18px; gap: 16px; flex-wrap: wrap; }
  .topnav-links { gap: 14px; }
  .hub-hero, .svc-hero { padding-left: 18px; padding-right: 18px; padding-top: 48px; }
  .hub-grid { padding-left: 18px; padding-right: 18px; gap: 14px; }
  .svc-body { padding: 32px 18px 56px; }
  .purpose-card { padding: 28px; }
  .purpose-card .text { font-size: 19px; }
  .terms-card { padding: 24px 22px; max-height: 50vh; }
  .terms-actions { flex-direction: column-reverse; }
  .terms-actions .btn { width: 100%; justify-content: center; }
  .hub-strip { padding: 48px 18px; }
  .hub-foot { padding: 18px; flex-direction: column; gap: 6px; align-items: flex-start; }

  /* Logo: scale down on mobile so the topnav still fits */
  .brand-mark { height: 28px; }
  .brand-section { font-size: 15px; }
  .brand-divider { height: 18px; }
  .topnav-brand { gap: 10px; }
  .welcome-logo { height: 64px; margin-bottom: 28px; }
}
