/* ═══════════════════════════════════════════════════════════
   CellSeg — main.css
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS custom properties ────────────────────────────── */
:root {
  --primary:       #006B5E;
  --primary-light: #3D9E8E;
  --primary-dark:  #004D44;
  --primary-bg:    #EAF5F3;
  --on-primary:    #ffffff;
  --surface:       #ffffff;
  --bg:            #F5FAF9;
  --border:        #D8EEEA;
  --text:          #1A1A1A;
  --text-subtle:   #555555;
  --text-light:    #888888;
  --warn-bg:       #FEF2F2;
  --warn-border:   #FECACA;
  --warn-text:     #991B1B;
  --note-bg:       #FFFBEB;
  --note-border:   #FDE68A;
  --note-text:     #92400E;
  --radius:        10px;
  --shadow:        0 2px 14px rgba(0, 107, 94, 0.10);
  --font:          -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                   Helvetica, Arial, sans-serif;
  --mono:          ui-monospace, "SF Mono", "Cascadia Code", "Fira Code",
                   monospace;
}

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a            { color: var(--primary); text-decoration: none; }
a:hover      { color: var(--primary-dark); text-decoration: underline; }
img          { max-width: 100%; display: block; }
ul           { list-style: none; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ─── Header / Nav ─────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  height: 60px;
  gap: 0.5rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo:hover { text-decoration: none; color: var(--primary-dark); }
.nav-logo-icon  { flex-shrink: 0; border-radius: 6px; display: block; }

/* hidden checkbox */
.nav-toggle { display: none; }

.nav-toggle-label {
  display: none;
  margin-left: auto;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}
.nav-toggle-label span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: background 0.15s;
}
.nav-toggle-label:hover span { background: var(--primary); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
}
.nav-links li a {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  border-radius: 7px;
  font-size: 0.9rem;
  color: var(--text-subtle);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-links li a:hover,
.nav-links li a.active {
  background: var(--primary-bg);
  color: var(--primary);
  text-decoration: none;
}
.nav-links li a.nav-github {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  margin-left: 0.4rem;
}
.nav-links li a.nav-github:hover {
  background: var(--primary-dark);
  color: #fff;
  text-decoration: none;
}

@media (max-width: 700px) {
  .nav-toggle-label { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
    gap: 0.15rem;
  }
  .nav-toggle:checked ~ .nav-links { display: flex; }
  .nav-links li a { padding: 0.6rem 0.75rem; }
  .nav-links li a.nav-github { margin-left: 0; margin-top: 0.25rem; text-align: center; }
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
  line-height: 1.4;
}
.btn-primary        { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); color: #fff; text-decoration: none; }
.btn-outline        { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover  { background: var(--primary-bg); text-decoration: none; }
.btn-lg             { padding: 0.8rem 1.9rem; font-size: 1.05rem; }

/* ─── Hero ──────────────────────────────────────────────── */
.hero {
  padding: 5rem 0 4.5rem;
  text-align: center;
  background: linear-gradient(160deg, #DEEEED 0%, var(--bg) 55%);
}

.hero-badge {
  display: inline-block;
  background: var(--note-bg);
  color: var(--note-text);
  border: 1px solid var(--note-border);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.9rem;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.1rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}
.hero h1 em { color: var(--primary); font-style: normal; }

.hero-sub {
  font-size: 1.1rem;
  color: var(--text-subtle);
  max-width: 560px;
  margin: 0 auto 2.25rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ─── Feature grid ──────────────────────────────────────── */
.features { padding: 4.5rem 0; }

.section-title {
  text-align: center;
  margin-bottom: 2.5rem;
}
.section-title h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-title p {
  color: var(--text-subtle);
  margin-top: 0.5rem;
  font-size: 1rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s;
}
.feature-card:hover { box-shadow: 0 4px 20px rgba(0,107,94,0.15); }
.feature-icon      { font-size: 2rem; margin-bottom: 0.75rem; }
.feature-card h3   { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; }
.feature-card p    { font-size: 0.9rem; color: var(--text-subtle); line-height: 1.55; }

/* ─── Built-on bar ──────────────────────────────────────── */
.built-on {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}
.built-on-label {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-light);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 1.1rem;
}
.built-on-row {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
  flex-wrap: wrap;
}
.built-on-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.4rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-subtle);
  white-space: nowrap;
}

/* ─── Page hero ─────────────────────────────────────────── */
.page-hero {
  background: linear-gradient(160deg, #DEEEED 0%, var(--bg) 60%);
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
}
.page-hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.page-hero p {
  color: var(--text-subtle);
  margin-top: 0.5rem;
  font-size: 1.05rem;
}

/* ─── Content (prose) ───────────────────────────────────── */
.content { padding: 3rem 0 4rem; }

.content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 2.5rem 0 0.75rem;
  color: var(--text);
  border-bottom: 2px solid var(--primary-bg);
  padding-bottom: 0.35rem;
}
.content h2:first-child { margin-top: 0; }

.content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.75rem 0 0.5rem;
  color: var(--primary-dark);
}

.content p { margin-bottom: 1rem; }

.content ul,
.content ol {
  margin: 0.5rem 0 1rem 1.5rem;
  list-style: disc;
}
.content ol { list-style: decimal; }
.content li { margin-bottom: 0.35rem; }

.content code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: #E5F0EE;
  color: var(--primary-dark);
  padding: 0.15em 0.45em;
  border-radius: 4px;
}

.content pre {
  background: #1A2926;
  color: #A8D5CC;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  font-size: 0.88rem;
  line-height: 1.6;
}
.content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.9rem;
}
.content th {
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-weight: 700;
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 2px solid var(--border);
}
.content td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.content tr:last-child td { border-bottom: none; }

.content blockquote {
  border-left: 4px solid var(--primary-light);
  padding: 0.8rem 1.1rem;
  background: var(--primary-bg);
  border-radius: 0 8px 8px 0;
  margin: 1rem 0 1.5rem;
  color: var(--primary-dark);
  font-style: italic;
}
.content blockquote p { margin-bottom: 0; }

/* callout boxes */
.warn {
  border-left: 4px solid #EF4444;
  padding: 0.85rem 1.1rem;
  background: var(--warn-bg);
  border-radius: 0 8px 8px 0;
  margin: 1rem 0 1.5rem;
  color: var(--warn-text);
  font-size: 0.9rem;
}
.note {
  border-left: 4px solid #F59E0B;
  padding: 0.85rem 1.1rem;
  background: var(--note-bg);
  border-radius: 0 8px 8px 0;
  margin: 1rem 0 1.5rem;
  color: var(--note-text);
  font-size: 0.9rem;
}
.warn strong,
.note strong { display: block; margin-bottom: 0.2rem; }

.tip {
  border-left: 4px solid var(--primary-light);
  padding: 0.85rem 1.1rem;
  background: var(--primary-bg);
  border-radius: 0 8px 8px 0;
  margin: 1rem 0 1.5rem;
  color: var(--primary-dark);
  font-size: 0.9rem;
}
.tip strong { display: block; margin-bottom: 0.2rem; }

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  margin: 0 0 2rem;
  font-size: 0.9rem;
  display: inline-block;
  min-width: 220px;
}
.toc strong {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  margin-bottom: 0.6rem;
}
.toc ol {
  margin: 0;
  padding-left: 1.25rem;
}
.toc li { margin-bottom: 0.3rem; }
.toc a  { color: var(--primary); font-size: 0.875rem; }

/* ─── Download page ─────────────────────────────────────── */
.download-hero { padding: 3.5rem 0 2.5rem; text-align: center; }

/* ─── Download hero ─────────────────────────────────────── */
.download-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  background: linear-gradient(135deg, var(--primary-bg) 0%, #d4ede9 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.25rem 2.5rem;
  margin-bottom: 2.25rem;
}
.download-hero-info .app-name {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.download-hero-info .app-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.2em 0.65em;
  border-radius: 20px;
}
.download-hero-info .app-meta {
  font-size: 0.875rem;
  color: var(--text-subtle);
}
.download-hero-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}
.download-hero-actions .release-link {
  font-size: 0.8rem;
  color: var(--text-light);
  text-align: center;
}
@media (max-width: 640px) {
  .download-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1.5rem 1.25rem;
  }
  .download-hero-actions {
    align-items: stretch;
    width: 100%;
  }
  .download-hero-actions .btn { text-align: center; }
}

/* ─── Footer ────────────────────────────────────────────── */
.site-footer {
  background: #1A2926;
  color: #A8C5C1;
  margin-top: 4rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  padding: 3rem 0 2rem;
}
.footer-col strong {
  display: block;
  color: #fff;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}
.footer-col p { font-size: 0.875rem; line-height: 1.6; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 0.4rem; }
.footer-col ul li a {
  color: #A8C5C1;
  font-size: 0.875rem;
  text-decoration: none;
}
.footer-col ul li a:hover { color: #fff; text-decoration: none; }

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.25rem 0;
  font-size: 0.8rem;
  color: #6B8E8A;
}

@media (max-width: 700px) {
  .footer-inner { grid-template-columns: 1fr; gap: 1.75rem; }
  .hero          { padding: 3.5rem 0 3rem; }
  .features      { padding: 3rem 0; }
}

/* ─── Utilities ─────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-sm       { margin-top: 0.5rem; }
.mt-md       { margin-top: 1rem; }
.mt-lg       { margin-top: 2rem; }
.mono        { font-family: var(--mono); }
