@import url("tokens.css");

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 var(--sp-3);
  letter-spacing: -0.01em;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
p { margin: 0 0 var(--sp-4); color: var(--text-secondary); }
.container { max-width: 1180px; margin: 0 auto; padding: 0 var(--sp-5); }
.mono { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Blueprint grid texture ---------- */
.blueprint-bg {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ---------- Top navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-default);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-5); max-width: 1180px; margin: 0 auto;
  gap: var(--sp-4);
}
.brand { display: flex; align-items: center; gap: var(--sp-2); font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.brand-seal {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--brand); display: grid; place-items: center;
  color: var(--brand); font-size: 0.7rem; font-family: var(--font-mono); font-weight: 700;
}
.nav-links { display: flex; align-items: center; gap: var(--sp-5); }
.nav-links a { font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); transition: color var(--transition); white-space: nowrap; }
.nav-links a:hover, .nav-links a.active { color: var(--brand); }
.nav-actions { display: flex; align-items: center; gap: var(--sp-3); }
.nav-toggle { display: none; background: none; border: none; padding: var(--sp-2); }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text-primary); margin: 4px 0; border-radius: 2px; }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-default);
  background: var(--bg-surface); display: grid; place-items: center; transition: border-color var(--transition);
}
.theme-toggle:hover { border-color: var(--brand); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 0.7rem 1.4rem; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem;
  border: 1px solid transparent; transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-strong); box-shadow: var(--shadow-md); }
.btn-stamp { background: var(--stamp); color: #24160A; }
.btn-stamp:hover { background: var(--ic-amber-600); }
.btn-outline { background: transparent; border-color: var(--border-default); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--brand); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: var(--sp-10) 0 var(--sp-8);
  background: linear-gradient(180deg, var(--ic-navy-950) 0%, var(--ic-navy-800) 100%);
  color: #fff;
}
.hero .container { position: relative; z-index: 2; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--stamp); border: 1px solid rgba(242,169,59,0.4); padding: 0.3rem 0.75rem; border-radius: 999px;
  margin-bottom: var(--sp-5);
}
.hero h1 { color: #fff; max-width: 820px; }
.hero .lead { color: rgba(255,255,255,0.72); font-size: 1.15rem; max-width: 620px; }
.hero-search {
  display: flex; gap: var(--sp-2); background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.16); border-radius: var(--radius-md);
  padding: var(--sp-2); margin-top: var(--sp-6); max-width: 640px; backdrop-filter: blur(8px);
}
.hero-search input {
  flex: 1; background: transparent; border: none; color: #fff; font-size: 1rem; padding: var(--sp-3);
}
.hero-search input::placeholder { color: rgba(255,255,255,0.45); }
.hero-search input:focus { outline: none; }
.hero-stats { display: flex; gap: var(--sp-8); margin-top: var(--sp-8); flex-wrap: wrap; }
.hero-stat .num { font-family: var(--font-mono); font-size: 1.75rem; font-weight: 700; color: var(--stamp); }
.hero-stat .label { font-size: 0.8rem; color: rgba(255,255,255,0.6); }
.hero-blueprint-overlay {
  position: absolute; inset: 0; z-index: 1; opacity: 0.5;
  background-image: linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 70% 60% at 70% 30%, black, transparent);
}
.hero-seal {
  position: absolute; right: -40px; top: 30px; width: 260px; height: 260px; z-index: 1;
  border: 2px dashed rgba(242,169,59,0.35); border-radius: 50%; display: grid; place-items: center;
  animation: spin-slow 40s linear infinite;
}
.hero-seal::before {
  content: "IC"; font-family: var(--font-mono); font-size: 2.5rem; font-weight: 700; color: rgba(242,169,59,0.25);
}
@keyframes spin-slow { to { transform: rotate(360deg); } }

/* ---------- Sections ---------- */
section { padding: var(--sp-10) 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: var(--sp-6); gap: var(--sp-4); flex-wrap: wrap; }
.section-eyebrow { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand); margin-bottom: var(--sp-2); display: block; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-md);
  padding: var(--sp-5); transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--accent); }

.glass {
  background: color-mix(in srgb, var(--bg-surface) 65%, transparent);
  backdrop-filter: blur(16px);
  border: 1px solid color-mix(in srgb, var(--border-default) 70%, transparent);
}

.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ---------- Document card ---------- */
.doc-card { display: flex; flex-direction: column; gap: var(--sp-3); position: relative; }
.doc-card .doc-code { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-secondary); letter-spacing: 0.04em; }
.doc-card h4 { font-size: 1.02rem; margin: 0; }
.doc-card .doc-desc { font-size: 0.85rem; margin: 0; flex: 1; }
.doc-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: var(--sp-2); }
.badge { font-size: 0.7rem; font-weight: 700; padding: 0.25rem 0.6rem; border-radius: 999px; font-family: var(--font-mono); letter-spacing: 0.03em; }
.badge-premium { background: color-mix(in srgb, var(--stamp) 18%, transparent); color: var(--ic-amber-600); }
.badge-category { background: var(--bg-surface-2); color: var(--brand); }

/* ---------- Category chip ---------- */
.chip-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.chip {
  padding: 0.45rem 1rem; border-radius: 999px; border: 1px solid var(--border-default);
  font-size: 0.83rem; font-weight: 500; background: var(--bg-surface); transition: all var(--transition);
}
.chip:hover, .chip.active { border-color: var(--brand); background: var(--bg-surface-2); color: var(--brand); }

/* ---------- Search / filters bar ---------- */
.filter-bar {
  display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center;
  background: var(--bg-surface); border: 1px solid var(--border-default); padding: var(--sp-4);
  border-radius: var(--radius-md); margin-bottom: var(--sp-6);
}
.filter-bar input[type="text"], .filter-bar select {
  padding: 0.6rem 0.9rem; border-radius: var(--radius-sm); border: 1px solid var(--border-default);
  background: var(--bg-page); color: var(--text-primary); font-size: 0.9rem;
}
.filter-bar input[type="text"] { flex: 1; min-width: 200px; }

/* ---------- Approval stamp signature element (signature motif) ---------- */
.stamp-seal {
  width: 92px; height: 92px; border-radius: 50%; border: 2.5px solid var(--stamp);
  display: grid; place-items: center; position: relative; flex-shrink: 0;
  transform: rotate(-8deg);
}
.stamp-seal::before {
  content: ""; position: absolute; inset: 6px; border: 1px dashed var(--stamp); border-radius: 50%;
}
.stamp-seal .stamp-text { font-family: var(--font-mono); font-size: 0.55rem; font-weight: 700; color: var(--stamp); text-align: center; line-height: 1.2; text-transform: uppercase; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ic-navy-950); color: rgba(255,255,255,0.7); padding: var(--sp-10) 0 var(--sp-6); margin-top: var(--sp-10); }
.site-footer h4 { color: #fff; font-size: 0.95rem; }
.site-footer a { color: rgba(255,255,255,0.6); font-size: 0.88rem; }
.site-footer a:hover { color: var(--stamp); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: var(--sp-6); }
.footer-links { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-3); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); margin-top: var(--sp-8); padding-top: var(--sp-5); display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3); font-size: 0.8rem; }

/* ---------- Forms (document generator) ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); }
.field input, .field select, .field textarea {
  padding: 0.7rem 0.9rem; border-radius: var(--radius-sm); border: 1px solid var(--border-default);
  background: var(--bg-surface); color: var(--text-primary); font-size: 0.92rem; font-family: inherit;
}
.field textarea { resize: vertical; min-height: 90px; }
.field-full { grid-column: 1 / -1; }
.table-editor { width: 100%; border-collapse: collapse; margin-top: var(--sp-2); }
.table-editor th, .table-editor td { border: 1px solid var(--border-default); padding: var(--sp-2); font-size: 0.85rem; }
.table-editor th { background: var(--bg-surface-2); text-align: left; }
.table-editor input { border: none; width: 100%; background: transparent; font-size: 0.85rem; padding: 0.2rem; }

/* ---------- Loading ---------- */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--bg-surface-2) 25%, var(--border-default) 50%, var(--bg-surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Reveal-on-scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---------- Modal / paywall ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,20,32,0.6); backdrop-filter: blur(4px); z-index: 200; display: none; align-items: center; justify-content: center; padding: var(--sp-4); }
.modal-backdrop.open { display: flex; }
.modal { background: var(--bg-surface); border-radius: var(--radius-lg); padding: var(--sp-6); max-width: 440px; width: 100%; box-shadow: var(--shadow-lg); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero-seal { display: none; }
}
@media (max-width: 720px) {
  .nav-links { position: fixed; top: 64px; left: 0; right: 0; background: var(--bg-surface); flex-direction: column; align-items: flex-start; padding: var(--sp-5); border-bottom: 1px solid var(--border-default); transform: translateY(-150%); transition: transform var(--transition); }
  .nav-links.open { transform: translateY(0); }
  .nav-toggle { display: block; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: var(--sp-5); }
}
