/* =========================================================
   Mailship — shared design system
   Ink + signal-green, monospace-led type, terminal motif.
   ========================================================= */

:root {
  /* Color */
  --ink:          #0B0F14;
  --ink-soft:     #12181F;
  --ink-line:     #232B35;
  --paper:        #F7F5F1;
  --paper-dim:    #EDEAE3;
  --white:        #FFFFFF;
  --slate:        #3D4451;
  --slate-soft:   #6B7280;
  --slate-faint:  #9AA1AC;
  --signal:       #00D67E;
  --signal-dim:   #00A863;
  --signal-ghost: rgba(0, 214, 126, 0.12);
  --amber:        #FFB020;
  --amber-ghost:  rgba(255, 176, 32, 0.14);
  --red:          #FF5C5C;

  /* Type */
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Rhythm */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 0 rgba(0,0,0,0.04), 0 12px 32px rgba(11,15,20,0.06);
  --shadow-pop: 0 20px 60px rgba(11,15,20,0.35);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --container: 1180px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

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

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.mono { font-family: var(--font-mono); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--signal-dim);
  text-transform: lowercase;
  margin-bottom: 18px;
}
.eyebrow::before { content: "//"; color: var(--slate-faint); }

h1, h2, h3, h4 {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}

h1 { font-size: clamp(2.4rem, 4.4vw, 3.8rem); }
h2 { font-size: clamp(1.9rem, 3.2vw, 2.6rem); }
h3 { font-size: 1.25rem; }

p { color: var(--slate); }
.lede { font-size: 1.15rem; color: var(--slate); max-width: 60ch; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), color .2s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

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

.btn-ghost-dark {
  background: transparent;
  color: var(--paper);
  border-color: var(--ink-line);
}
.btn-ghost-dark:hover { border-color: var(--signal); color: var(--signal); }

.btn-ghost-light {
  background: transparent;
  color: var(--ink);
  border-color: rgba(11,15,20,0.16);
}
.btn-ghost-light:hover { border-color: var(--ink); }

.btn-block { width: 100%; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11,15,20,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ink-line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 17px;
  color: var(--paper);
}
.logo .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 10px var(--signal); }

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
}
.nav-item { position: relative; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 16px;
  font-size: 14.5px;
  color: var(--slate-faint);
  border-radius: var(--radius-sm);
  transition: color .2s var(--ease), background .2s var(--ease);
}
.nav-link:hover, .nav-link[aria-expanded="true"] { color: var(--paper); background: rgba(255,255,255,0.05); }
.nav-link svg { width: 13px; height: 13px; transition: transform .2s var(--ease); }
.nav-item:hover .nav-link svg { transform: rotate(180deg); }

.dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  min-width: 300px;
  background: var(--ink-soft);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
  box-shadow: var(--shadow-pop);
}
.nav-item:hover .dropdown, .nav-item:focus-within .dropdown {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}
.dropdown-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background .15s var(--ease);
}
.dropdown-link:hover { background: rgba(255,255,255,0.06); }
.dropdown-link .dl-name { font-family: var(--font-mono); font-size: 13.5px; color: var(--paper); font-weight: 600; }
.dropdown-link .dl-desc { font-size: 12.5px; color: var(--slate-faint); }

.header-actions { display: flex; align-items: center; gap: 10px; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--paper);
  width: 36px; height: 36px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.nav-toggle span { width: 20px; height: 2px; background: currentColor; border-radius: 2px; transition: all .2s var(--ease); }

.nav-mobile {
  display: none;
  position: fixed;
  inset: 68px 0 0 0;
  background: var(--ink);
  z-index: 99;
  overflow-y: auto;
  padding: 8px 20px 40px;
}
.nav-mobile.open { display: block; }
.nav-mobile-group { border-bottom: 1px solid var(--ink-line); padding: 14px 0; }
.nav-mobile-title { font-family: var(--font-mono); color: var(--slate-faint); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.nav-mobile a { display: block; padding: 10px 0; color: var(--paper); font-size: 15.5px; }
.nav-mobile-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

body.nav-open { overflow: hidden; }

@media (max-width: 960px) {
  .nav-desktop, .header-actions .btn-ghost-dark { display: none; }
  .nav-toggle { display: flex; }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: var(--slate-faint);
  padding: 72px 0 28px;
  border-top: 1px solid var(--ink-line);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 32px;
  padding-bottom: 48px;
}
.footer-brand .logo { margin-bottom: 14px; }
.footer-brand p { color: var(--slate-faint); font-size: 14px; max-width: 30ch; }
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--paper);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}
.footer-col a {
  display: block;
  font-size: 14px;
  color: var(--slate-faint);
  padding: 6px 0;
  transition: color .15s var(--ease);
}
.footer-col a:hover { color: var(--signal); }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--ink-line);
  font-size: 13px;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-legal { display: flex; gap: 20px; }
.footer-legal a:hover { color: var(--signal); }

@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---------- Sections ---------- */
.section { padding: 100px 0; }
.section-tight { padding: 64px 0; }
.section-dark { background: var(--ink); color: var(--paper); }
.section-dark p { color: var(--slate-faint); }
.section-dark h2, .section-dark h3 { color: var(--paper); }
.section-alt { background: var(--paper-dim); }

.section-head { max-width: 640px; margin-bottom: 56px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }

/* ---------- Page hero (subpages) ---------- */
.page-hero {
  background: var(--ink);
  color: var(--paper);
  padding: 64px 0 72px;
  position: relative;
  overflow: hidden;
}
.page-hero .eyebrow { color: var(--signal); }
.page-hero .eyebrow::before { color: var(--slate-faint); }
.page-hero h1 { color: var(--paper); }
.page-hero p { color: var(--slate-faint); }
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--slate-faint);
  margin-bottom: 24px;
}
.breadcrumb a:hover { color: var(--signal); }

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border: 1px solid rgba(11,15,20,0.08);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid, .footer-bottom { text-align: left; }
  .section { padding: 64px 0; }
}

/* ---------- Status pill (SMTP-code motif) ---------- */
.code-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 5px;
}
.code-pill.ok { background: var(--signal-ghost); color: var(--signal-dim); }
.code-pill.warn { background: var(--amber-ghost); color: #B87500; }
.code-pill.err { background: rgba(255,92,92,0.12); color: #C93737; }

/* ---------- Terminal / log window (signature element) ---------- */
.terminal {
  background: var(--ink-soft);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-pop);
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--ink-line);
}
.terminal-bar .tdot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-bar .tdot:nth-child(1) { background: #FF5C5C; }
.terminal-bar .tdot:nth-child(2) { background: #FFB020; }
.terminal-bar .tdot:nth-child(3) { background: var(--signal); }
.terminal-bar .tlabel { margin-left: 10px; font-family: var(--font-mono); font-size: 12px; color: var(--slate-faint); }
.terminal-body { padding: 20px; font-family: var(--font-mono); font-size: 13px; }
.log-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--slate-faint);
  opacity: 0;
  animation: logIn .5s var(--ease) forwards;
}
.log-row:last-child { border-bottom: none; }
.log-row .lr-time { color: var(--slate-soft); flex-shrink: 0; }
.log-row .lr-to { color: var(--paper); flex: 1; }
@keyframes logIn { to { opacity: 1; } }

/* ---------- Utility ---------- */
.center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-40 { margin-top: 40px; }
.flex-row { display: flex; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; }

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.reveal.in { opacity: 1; transform: translateY(0); }
