/* ============================================
   SandSpan.com — Unit Conversion Tools
   Global Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --sand-50:  #fdf8f0;
  --sand-100: #f5e9d4;
  --sand-200: #e8c99a;
  --sand-300: #d4a76a;
  --sand-400: #b8853a;
  --sand-500: #8c5e1e;
  --ocean-900: #0d1b2a;
  --ocean-800: #1a2e44;
  --ocean-700: #243d58;
  --ocean-600: #2e5070;
  --ocean-400: #4a80b0;
  --ocean-200: #8ab4d8;
  --white:    #ffffff;
  --text-dark: #1a1a1a;
  --text-mid:  #4a4a4a;
  --text-soft: #777777;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 6px 24px rgba(0,0,0,0.10);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.14);
  --transition: 0.22s cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--sand-50);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.65;
}

h1, h2, h3, h4 {
  font-family: 'DM Serif Display', serif;
  line-height: 1.25;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---- NAV ---- */
.site-nav {
  background: var(--ocean-900);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,0.25);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 1.6rem;
  color: var(--sand-200);
  letter-spacing: -0.5px;
}

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

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

.nav-links a {
  color: var(--sand-100);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--ocean-700);
  color: var(--sand-300);
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
}

.nav-toggle span {
  display: block;
  width: 24px; height: 2px;
  background: var(--sand-200);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, var(--ocean-900) 0%, var(--ocean-700) 60%, var(--ocean-600) 100%);
  color: var(--white);
  padding: 80px 24px 72px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='1.5' fill='rgba(255,255,255,0.04)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--sand-200);
  margin-bottom: 16px;
}

.hero p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--ocean-200);
  max-width: 600px;
  margin: 0 auto 32px;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--sand-400);
  color: var(--white);
}
.btn-primary:hover { background: var(--sand-500); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.btn-outline {
  background: transparent;
  color: var(--sand-300);
  border: 2px solid var(--sand-400);
}
.btn-outline:hover { background: var(--sand-400); color: var(--white); }

/* ---- SECTION WRAPPERS ---- */
.section {
  padding: 64px 24px;
}

.section-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--ocean-800);
  margin-bottom: 8px;
}

.section-sub {
  color: var(--text-soft);
  margin-bottom: 40px;
}

/* ---- TOOL CARDS GRID ---- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.tool-card {
  background: var(--white);
  border: 1.5px solid var(--sand-100);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  display: block;
}

.tool-card:hover {
  border-color: var(--sand-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.tool-card .icon {
  font-size: 2.4rem;
  margin-bottom: 14px;
  display: block;
}

.tool-card h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ocean-800);
  margin-bottom: 6px;
}

.tool-card p {
  font-size: 0.82rem;
  color: var(--text-soft);
}

/* ---- CONVERTER UI ---- */
.converter-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px;
  max-width: 680px;
  margin: 0 auto;
}

.converter-title {
  font-size: 1.5rem;
  color: var(--ocean-800);
  margin-bottom: 24px;
  text-align: center;
}

.conv-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: end;
  margin-bottom: 20px;
}

.conv-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.conv-field input,
.conv-field select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--sand-100);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  color: var(--text-dark);
  background: var(--sand-50);
  transition: border var(--transition), box-shadow var(--transition);
  outline: none;
}

.conv-field input:focus,
.conv-field select:focus {
  border-color: var(--ocean-400);
  box-shadow: 0 0 0 3px rgba(74,128,176,0.12);
  background: var(--white);
}

.swap-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--ocean-800);
  color: var(--white);
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  align-self: end;
  margin-bottom: 2px;
  flex-shrink: 0;
}
.swap-btn:hover { background: var(--ocean-600); transform: rotate(180deg); }

.result-box {
  background: var(--ocean-900);
  color: var(--sand-200);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  text-align: center;
  margin-top: 8px;
}

.result-box .result-value {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  color: var(--sand-300);
}

.result-box .result-label { font-size: 0.85rem; color: var(--ocean-200); margin-top: 4px; }

/* ---- FORMULA BOX ---- */
.formula-note {
  background: var(--sand-100);
  border-left: 4px solid var(--sand-400);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin-top: 20px;
  font-size: 0.88rem;
  color: var(--text-mid);
}

/* ---- TAB NAV ---- */
.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.tab-btn {
  padding: 8px 18px;
  border-radius: 50px;
  border: 1.5px solid var(--sand-200);
  background: var(--white);
  color: var(--text-mid);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover,
.tab-btn.active {
  background: var(--ocean-800);
  border-color: var(--ocean-800);
  color: var(--sand-200);
}

/* ---- PAGE BANNER ---- */
.page-banner {
  background: var(--ocean-900);
  color: var(--sand-200);
  padding: 48px 24px 40px;
  text-align: center;
}

.page-banner h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
.page-banner p { color: var(--ocean-200); margin-top: 10px; font-size: 1rem; }

/* ---- PROSE CONTENT ---- */
.prose {
  max-width: 800px;
  margin: 0 auto;
  color: var(--text-mid);
}

.prose h2 {
  font-size: 1.5rem;
  color: var(--ocean-800);
  margin: 36px 0 12px;
}

.prose h3 {
  font-size: 1.15rem;
  color: var(--ocean-700);
  margin: 24px 0 8px;
}

.prose p, .prose li {
  font-size: 0.97rem;
  line-height: 1.75;
  margin-bottom: 14px;
}

.prose ul, .prose ol {
  padding-left: 22px;
  margin-bottom: 16px;
}

.prose a { color: var(--ocean-600); border-bottom: 1px solid var(--ocean-200); }

/* ---- CONTACT FORM ---- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.contact-form {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-md);
}

.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-mid);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--sand-100);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.97rem;
  color: var(--text-dark);
  background: var(--sand-50);
  outline: none;
  transition: border var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--ocean-400);
  box-shadow: 0 0 0 3px rgba(74,128,176,0.12);
  background: var(--white);
}

.form-group textarea { resize: vertical; min-height: 130px; }

.contact-info-card {
  background: var(--ocean-900);
  color: var(--sand-100);
  border-radius: var(--radius-lg);
  padding: 36px;
}

.contact-info-card h3 {
  font-size: 1.4rem;
  color: var(--sand-300);
  margin-bottom: 20px;
}

.info-item {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  align-items: flex-start;
}

.info-item .ico { font-size: 1.4rem; flex-shrink: 0; margin-top: 2px; }

.info-item p { font-size: 0.9rem; color: var(--ocean-200); }
.info-item strong { color: var(--sand-200); display: block; margin-bottom: 2px; }

/* ---- FOOTER ---- */
.site-footer {
  background: var(--ocean-900);
  color: var(--ocean-200);
  margin-top: auto;
}

.footer-top {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 32px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
}

.footer-brand .nav-logo { font-size: 1.4rem; margin-bottom: 12px; display: block; }
.footer-brand p { font-size: 0.88rem; line-height: 1.7; max-width: 280px; }

.footer-col h4 {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sand-300);
  margin-bottom: 14px;
}

.footer-col ul { list-style: none; }

.footer-col ul li { margin-bottom: 8px; }

.footer-col ul a {
  font-size: 0.88rem;
  color: var(--ocean-200);
  transition: color var(--transition);
}
.footer-col ul a:hover { color: var(--sand-300); }

.footer-bottom {
  border-top: 1px solid var(--ocean-700);
  padding: 18px 24px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ocean-400);
}

.footer-bottom a { color: var(--ocean-400); }
.footer-bottom a:hover { color: var(--sand-300); }

/* ---- AD PLACEHOLDERS ---- */
.ad-slot {
  background: var(--sand-100);
  border: 2px dashed var(--sand-200);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  font-size: 0.8rem;
  text-align: center;
}

.ad-slot-banner { height: 90px; margin: 0 auto 32px; max-width: 728px; }
.ad-slot-square { height: 250px; max-width: 300px; margin: 0 auto; }
.ad-slot-responsive { min-height: 100px; width: 100%; margin: 24px 0; }

/* ---- UTILITY ---- */
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--sand-100);
  color: var(--sand-500);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--ocean-900);
    flex-direction: column;
    gap: 0;
    padding: 8px 0 16px;
    border-top: 1px solid var(--ocean-700);
    box-shadow: var(--shadow-md);
  }

  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 12px 24px; border-radius: 0; }
  .nav-toggle { display: flex; }
  .site-nav { position: relative; }

  .footer-top {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .conv-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .swap-btn {
    width: 100%; border-radius: var(--radius-sm);
    height: 40px; font-size: 1rem;
  }

  .contact-grid { grid-template-columns: 1fr; }

  .converter-box { padding: 24px 18px; }

  .tools-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
