/* Elements, layout and shared components. Tokens live in tokens.css. */

/* --- Base -------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.5em;
  overflow-wrap: break-word;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-hover); }

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

button { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow);
}
.skip-link:focus { top: 12px; }

/* --- Layout ------------------------------------------------------------------ */

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}



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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
/* The header spans the full width: logo and controls sit near the screen edges. */
.site-header .wrap {
  max-width: none;
  padding-inline: clamp(var(--gutter), 3vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
  padding-block: 10px; /* room for the nav when it wraps on narrow screens */
}

.brand {
  display: inline-flex;
  flex-shrink: 0;
  padding: 4px 8px;
  margin-left: -8px;
  border-radius: 10px;
  background: var(--logo-plate);
}
.brand img { height: 40px; width: auto; }

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 16px;
  font-size: 0.92rem;
}
.site-nav form { margin: 0; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--ink); }

.user-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 500;
}
.user-name svg { width: 18px; height: 18px; color: var(--muted); }

@media (max-width: 560px) {
  .brand img { height: 36px; }
  .site-nav { gap: 8px 12px; }
  .user-name { display: none; }
}

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

.site-footer {
  padding: 32px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: none;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }

.btn-outline { border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--muted); color: var(--ink); }

.btn-small { padding: 7px 14px; font-size: 0.88rem; }
.btn-block { display: flex; width: 100%; }

/* --- Cards ------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}
.card p { color: var(--muted); font-size: 0.97rem; }

.icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
}
.icon svg { width: 22px; height: 22px; }

/* --- Inner pages ------------------------------------------------------------- */

.page { padding-top: 56px; padding-bottom: 72px; }
.page h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 32px; }

/* --- Services ---------------------------------------------------------------- */

.service-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.service-card { display: flex; flex-direction: column; }
.service-card h2 { font-size: 1.35rem; }
/* The badge sits at the bottom, aligned across the cards of a row. */
.service-card .badge { margin-top: auto; align-self: flex-start; }

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}
.card .badge { color: var(--accent); font-size: 0.8rem; }

@media (max-width: 860px) {
  .service-grid { grid-template-columns: 1fr; }
}

/* --- Error pages ------------------------------------------------------------ */

/* The message is centred in the space between the header and the footer
   (slightly above the middle: more padding below). */
main:has(> .error-page) { display: flex; flex-direction: column; }
.error-page {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 64px;
  padding-bottom: 112px;
  text-align: center;
}
.error-code {
  margin: 0 0 8px;
  font: 700 clamp(5rem, 16vw, 8.5rem)/1 var(--font-serif);
  letter-spacing: -0.02em;
  color: var(--accent); /* fallback without background-clip: text */
  background: linear-gradient(135deg, var(--blue), var(--accent));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.error-page h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.error-message { max-width: 520px; margin-bottom: 32px; color: var(--muted); font-size: 1.05rem; }

@media (max-width: 560px) {
  .error-page { padding-top: 48px; padding-bottom: 72px; }
}

/* --- Motion ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
  .btn:hover { transform: none; }
}
