/* ================================================================
   ClerkCheck — Shared Styles
   Base reset, typography, layout, header, footer, common components
   ================================================================ */

/* ── Custom Properties ─────────────────────────────────────────── */
:root {
  /* Palette */
  --bg:             #f5f3ed;
  --bg-warm:        #eceae3;
  --surface:        #ffffff;
  --surface-hover:  #fafaf8;

  --navy-950:       #070e1a;
  --navy-900:       #0b1426;
  --navy-800:       #111d33;
  --navy-700:       #182842;
  --navy-600:       #1f3354;
  --navy-500:       #2a4470;

  --gold-700:       #7d6323;
  --gold-600:       #9a7a2e;
  --gold-500:       #b8923e;
  --gold-400:       #cba452;
  --gold-300:       #ddb866;
  --gold-200:       #eedfa8;
  --gold-100:       #f7efd5;
  --gold-50:        #fcf8ec;

  --text-1:         #1a1a1a;
  --text-2:         #52524e;
  --text-3:         #8a8a85;

  --border:         #dfdcd4;
  --border-strong:  #ccc9c0;

  --red-600:        #b83a2e;
  --red-100:        #fce8e6;
  --green-600:      #2d6a4f;
  --green-100:      #dff5e8;

  /* Typography */
  --font-display:   'Cormorant Garamond', 'Georgia', serif;
  --font-body:      'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(11, 20, 38, 0.04), 0 1px 4px rgba(11, 20, 38, 0.03);
  --shadow-md:  0 2px 6px rgba(11, 20, 38, 0.05), 0 4px 12px rgba(11, 20, 38, 0.04);
  --shadow-lg:  0 4px 12px rgba(11, 20, 38, 0.06), 0 8px 24px rgba(11, 20, 38, 0.05);
  --shadow-gold: 0 0 0 3px rgba(184, 146, 62, 0.15);

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration: 0.2s;
}

/* ── Reset ─────────────────────────────────────────────────────── */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-1);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ol, ul { list-style: none; }

/* ── Background Grid ───────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(184, 146, 62, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184, 146, 62, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ────────────────────────────────────────────────────── */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

/* ── Top Rule ──────────────────────────────────────────────────── */
.top-rule {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-700), var(--gold-400), var(--gold-700));
  z-index: 100;
}

/* ── Header ────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 3px;
  z-index: 50;
  background: rgba(245, 243, 237, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}

.logo-symbol {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--gold-500);
  line-height: 1;
}

.logo-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: -0.01em;
}

/* ── Header Navigation ─────────────────────────────────────────── */
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.header-tagline {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  transition: color var(--duration), background var(--duration);
}

.nav-link:hover {
  color: var(--text-1);
  background: var(--bg-warm);
}

.nav-link.active {
  color: var(--navy-900);
  background: var(--gold-50);
  border: 1px solid var(--gold-200);
}

/* ── Intro ─────────────────────────────────────────────────────── */
.intro {
  padding: var(--space-3xl) 0 var(--space-xl);
  text-align: center;
  animation: fadeUp 0.6s var(--ease-out) both;
}

.intro-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 500;
  color: var(--navy-900);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-md);
  overflow-wrap: break-word;
}

.intro-title em {
  font-style: italic;
  color: var(--gold-600);
}

.intro-desc {
  font-size: 16px;
  color: var(--text-2);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ── Card ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 1;
}

/* ── Form Fields ───────────────────────────────────────────────── */
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: var(--space-xs);
}

.field textarea,
.field input[type="text"] {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color var(--duration), box-shadow var(--duration);
}

.field textarea:focus,
.field input[type="text"]:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: var(--shadow-gold);
}

.field textarea::placeholder,
.field input[type="text"]::placeholder {
  color: var(--text-3);
}

.field-help {
  font-size: 12px;
  color: var(--text-3);
  margin-top: var(--space-xs);
  line-height: 1.5;
}

.field-help em {
  font-style: italic;
}

/* ── Error Banner ──────────────────────────────────────────────── */
.error-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--red-100);
  border: 1px solid rgba(184, 58, 46, 0.15);
  border-radius: var(--radius-md);
  animation: fadeUp 0.3s var(--ease-out);
}

.error-icon {
  flex-shrink: 0;
  color: var(--red-600);
  margin-top: 1px;
}

.error-text {
  flex: 1;
  font-size: 14px;
  color: var(--red-600);
  line-height: 1.5;
}

.error-dismiss {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--red-600);
  opacity: 0.6;
  transition: opacity var(--duration);
}

.error-dismiss:hover { opacity: 1; }

/* ── Copy Button (shared) ──────────────────────────────────────── */
.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color var(--duration), color var(--duration), background var(--duration);
}

.btn-copy:hover {
  border-color: var(--border-strong);
  color: var(--text-1);
}

.btn-copy.copied {
  color: var(--green-600);
  border-color: rgba(45, 106, 79, 0.25);
  background: var(--green-100);
}

.copy-label { pointer-events: none; }

/* ── Footer ────────────────────────────────────────────────────── */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-warm);
  position: relative;
  z-index: 1;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) 0;
  font-size: 13px;
  color: var(--text-3);
}

.footer-links a {
  color: var(--text-3);
  transition: color var(--duration);
}

.footer-links a:hover {
  color: var(--gold-600);
}

/* ── Animations ────────────────────────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive (shared) ──────────────────────────────────────── */
@media (max-width: 900px) {
  .header-tagline {
    display: none;
  }
}

@media (max-width: 600px) {
  .container {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .intro {
    padding: var(--space-xl) 0 var(--space-md);
  }

  .intro-title {
    font-size: 20px;
  }

  .nav-links {
    gap: 2px;
  }

  .nav-link {
    padding: 0 8px;
    font-size: 12px;
  }
}

/* ── Accessibility ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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