/* ============================================================
   SpecBase — Global Stylesheet
   Design: navy/slate/white, Inter, mobile-first, clean cards
   ============================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:   #0f172a;
  --slate:  #334155;
  --muted:  #64748b;
  --border: #e2e8f0;
  --bg:     #f8fafc;
  --white:  #ffffff;
  --blue:   #3b82f6;
  --blue-dark: #1d4ed8;
  --green:  #10b981;
  --red:    #ef4444;
  --amber:  #f59e0b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --transition: 0.18s ease;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--slate);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--blue-dark); }

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

/* ---- Typography ---- */
h1, h2, h3, h4 { color: var(--navy); font-weight: 700; line-height: 1.25; }
h1 { font-size: clamp(1.6rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
p  { color: var(--slate); }

small { font-size: 0.8125rem; color: var(--muted); }

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px)  { .container { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .container { padding: 0 2rem;   } }

main { flex: 1; padding: 2rem 0 4rem; }

/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

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

.nav-logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff !important;
  letter-spacing: -.5px;
  text-decoration: none !important;
}

.nav-logo span { color: var(--blue); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
  text-decoration: none !important;
}

.nav-links a:hover,
.nav-links a.active { color: #fff; }

.nav-links .nav-cta {
  background: var(--blue);
  color: #fff !important;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-weight: 600;
  transition: background var(--transition);
}

.nav-links .nav-cta:hover { background: var(--blue-dark); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--navy);
  color: #64748b;
  text-align: center;
  padding: 1.25rem 1rem;
  font-size: 0.85rem;
  margin-top: auto;
}

.footer a { color: #94a3b8; }
.footer a:hover { color: #fff; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.card-sm { padding: 1rem 1.25rem; }

.card-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px)  { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a5f 100%);
  color: #fff;
  padding: 4rem 1rem 3.5rem;
  text-align: center;
}

.hero h1 { color: #fff; font-size: clamp(1.6rem, 4.5vw, 2.75rem); max-width: 720px; margin: 0 auto .75rem; }
.hero p  { color: #94a3b8; max-width: 560px; margin: 0 auto 2rem; font-size: 1.05rem; }

/* ============================================================
   SEARCH BOX
   ============================================================ */
.search-wrap {
  display: flex;
  max-width: 520px;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}

.search-wrap input {
  flex: 1;
  border: none;
  padding: .75rem 1rem;
  font-size: 1rem;
  outline: none;
  color: var(--navy);
  font-family: inherit;
}

.search-wrap button {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: .75rem 1.25rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  font-family: inherit;
}

.search-wrap button:hover { background: var(--blue-dark); }

/* ============================================================
   STATS BAR
   ============================================================ */
.stats-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2rem;
  background: var(--white);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1.1rem 1rem;
  margin: 2rem 0;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--navy);
}

.stat-item .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

/* ============================================================
   FEATURE CARDS (homepage)
   ============================================================ */
.feature-card {
  border-top: 3px solid var(--blue);
  transition: transform var(--transition), box-shadow var(--transition);
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,.1);
}

.feature-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

/* ============================================================
   ALLOY INDEX
   ============================================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.filter-btn {
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--slate);
  padding: .35rem .85rem;
  border-radius: 6px;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.filter-btn:hover { border-color: var(--blue); color: var(--blue); }
.filter-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.alloy-card {
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  text-decoration: none !important;
  display: block;
  color: inherit !important;
}

.alloy-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,.1);
}

.alloy-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: .3rem;
}

.alloy-card-uns {
  font-size: .8rem;
  color: var(--muted);
  font-family: 'Courier New', monospace;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.badge-navy   { background: #e0e7ff; color: var(--navy); }
.badge-blue   { background: #eff6ff; color: #1d4ed8; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-slate  { background: #f1f5f9; color: var(--slate); }

/* Family-specific badge colours */
.badge-nickel    { background: #ede9fe; color: #4c1d95; }
.badge-titanium  { background: #e0f2fe; color: #075985; }
.badge-cobalt    { background: #fce7f3; color: #831843; }
.badge-stainless { background: #d1fae5; color: #065f46; }
.badge-aluminum  { background: #fef9c3; color: #713f12; }
.badge-copper    { background: #ffedd5; color: #7c2d12; }

/* ============================================================
   COMPOSITION TABLE
   ============================================================ */
.spec-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.spec-table thead th {
  background: var(--navy);
  color: #fff;
  padding: .65rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.spec-table tbody tr { border-bottom: 1px solid var(--border); }
.spec-table tbody tr:last-child { border-bottom: none; }
.spec-table tbody tr:nth-child(even) { background: #f8fafc; }
.spec-table tbody tr:hover { background: #eff6ff; }

.spec-table td {
  padding: .6rem 1rem;
  vertical-align: middle;
}

.element-symbol {
  font-weight: 700;
  color: var(--navy);
  font-size: .95rem;
}

.spec-bar-cell { min-width: 120px; }

.spec-bar-outer {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.spec-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--blue) 0%, #6366f1 100%);
  border-radius: 4px;
  transition: width .4s ease;
}

/* ============================================================
   ELEMENT CHIPS
   ============================================================ */
.element-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .5rem 0;
}

.element-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .6rem;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .8rem;
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: var(--navy);
}

.element-chip-value {
  color: var(--muted);
  font-weight: 400;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: 1.1rem;
}

label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--navy);
}

input[type="text"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--slate);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

/* ---- Element row grid for identifier ---- */
.element-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: .5rem;
  align-items: center;
  margin-bottom: .5rem;
}

@media (max-width: 480px) {
  .element-row-grid { grid-template-columns: 1fr 1fr auto; }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.2rem;
  border-radius: 7px;
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none !important;
}

.btn-primary { background: var(--blue);  color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; }

.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { border-color: var(--blue); color: var(--blue); }

.btn-danger  { background: var(--red);   color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: .35rem .75rem; font-size: .85rem; border-radius: 5px; }
.btn-full { width: 100%; justify-content: center; }

/* ============================================================
   RESULT CARDS
   ============================================================ */
.result-card {
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
  border: 1.5px solid transparent;
}

.result-pass    { background: #f0fdf4; border-color: var(--green); }
.result-warning { background: #fffbeb; border-color: var(--amber); }
.result-fail    { background: #fff1f2; border-color: var(--red); }

.result-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}

.result-status-badge {
  font-size: 1rem;
  font-weight: 700;
  padding: .3rem .9rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.status-pass    { background: var(--green); color: #fff; }
.status-warning { background: var(--amber); color: #fff; }
.status-fail    { background: var(--red);   color: #fff; }

/* per-element result table */
.elem-result-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.elem-result-table th { text-align: left; padding: .4rem .6rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 2px solid var(--border); }
.elem-result-table td { padding: .45rem .6rem; border-bottom: 1px solid var(--border); }
.elem-result-table tr:last-child td { border-bottom: none; }

.in-spec  { color: var(--green); font-weight: 600; }
.out-spec { color: var(--red);   font-weight: 600; }

/* ============================================================
   MATCH CARDS (identifier results)
   ============================================================ */
.match-card {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  border: 1.5px solid var(--border);
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--white);
}

.match-rank {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
}

.match-rank-1 { background: #f59e0b; }
.match-rank-2 { background: #94a3b8; }
.match-rank-3 { background: #cd7c3c; }

.match-score {
  margin-left: auto;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  text-align: right;
}

.match-score small { display: block; font-size: .7rem; color: var(--muted); font-weight: 400; }

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .825rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb-sep { color: #cbd5e1; }

/* ============================================================
   ALLOY DETAIL PAGE
   ============================================================ */
.alloy-header {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.alloy-header-text { flex: 1; min-width: 200px; }
.alloy-meta-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }

.standards-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  list-style: none;
  padding: 0;
}

.standard-chip {
  padding: .25rem .7rem;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--slate);
  font-family: 'Courier New', monospace;
}

.applications-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: .4rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) { .applications-list { grid-template-columns: repeat(2, 1fr); } }

.applications-list li::before {
  content: "→ ";
  color: var(--blue);
  font-weight: 700;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}

/* CTA strip */
.cta-strip {
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a5f 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.5rem;
}

.cta-strip h3 { color: #fff; font-size: 1.1rem; }
.cta-strip p  { color: #94a3b8; font-size: .9rem; margin-top: .25rem; }

/* ============================================================
   PRICING
   ============================================================ */
.pricing-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
  margin-top: 2rem;
}

@media (min-width: 768px) { .pricing-grid { grid-template-columns: repeat(3, 1fr); } }

.pricing-card {
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--white);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: box-shadow var(--transition);
}

.pricing-card:hover { box-shadow: var(--shadow); }

.pricing-card.featured {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(59,130,246,.15), var(--shadow);
}

.pricing-popular {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--blue);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .75rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

.pricing-name  { font-size: 1rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .5rem; }
.pricing-price { font-size: 2.25rem; font-weight: 700; color: var(--navy); line-height: 1; }
.pricing-price span { font-size: .95rem; font-weight: 400; color: var(--muted); }

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.pricing-features li {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .9rem;
}

.pricing-features li::before {
  content: "✓";
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: .05rem;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}

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

/* ============================================================
   ALERTS / NOTICES
   ============================================================ */
.alert {
  padding: .85rem 1rem;
  border-radius: 7px;
  font-size: .9rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  border: 1px solid transparent;
}

.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-error   { background: #fff1f2; border-color: #fecdd3; color: #991b1b; }

/* ============================================================
   UTILITY
   ============================================================ */
.text-muted  { color: var(--muted); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }

/* ============================================================
   RESPONSIVE HELPERS
   ============================================================ */
@media (max-width: 639px) {
  .hide-mobile { display: none !important; }
  .nav-links   { gap: .75rem; }
  .cta-strip   { text-align: center; justify-content: center; }
  .alloy-header { flex-direction: column; }
}
