:root {
  --green-900: #064e2c;
  --green-700: #0b7a3b;
  --green-600: #16a34a;
  --green-50: #ecfdf5;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e5e7eb;
  --bg: #ffffff;
  --surface: #f8faf8;
  --surface-2: #f1f5f4;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --shadow-md: 0 4px 6px -1px rgba(15,23,42,.06), 0 2px 4px -2px rgba(15,23,42,.05);
  --shadow-lg: 0 10px 20px -5px rgba(15,23,42,.08), 0 4px 8px -4px rgba(15,23,42,.06);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --max: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; letter-spacing: -.01em; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; color: var(--ink-2); }

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

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--max); margin: 0 auto; padding: 14px 20px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; color: var(--ink); font-size: 1.15rem; letter-spacing: -.02em;
  text-decoration: none;
}
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 15px;
  box-shadow: var(--shadow-md);
}
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links a {
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 15px;
}
.nav-links a:hover { color: var(--green-700); }
.nav-links .btn { color: #fff; }
.nav-toggle {
  display: none; background: none; border: 0; padding: 8px; cursor: pointer;
}
.nav-toggle svg { width: 24px; height: 24px; }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 100%; right: 0; left: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    flex-direction: column; gap: 0; padding: 8px 0;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 20px; border-bottom: 1px solid var(--surface); }
  .nav-links .btn { margin: 12px 20px; display: inline-block; text-align: center; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green-700); color: #fff; padding: 11px 20px;
  border-radius: 10px; font-weight: 600; font-size: 15px;
  border: 1px solid transparent; cursor: pointer; transition: transform .1s ease, background .15s;
  text-decoration: none;
}
.btn:hover { background: var(--green-600); text-decoration: none; transform: translateY(-1px); }
.btn-outline {
  background: transparent; color: var(--green-700); border-color: var(--green-700);
}
.btn-outline:hover { background: var(--green-50); color: var(--green-900); }
.btn-ghost {
  background: var(--surface); color: var(--ink); border-color: var(--line);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-lg { padding: 14px 26px; font-size: 16px; border-radius: 12px; }

/* Hero */
.hero {
  padding: 70px 0 60px;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(22,163,74,.12), transparent 60%),
    radial-gradient(800px 400px at -10% 10%, rgba(11,122,59,.08), transparent 60%),
    linear-gradient(180deg, #fff, var(--surface));
  border-bottom: 1px solid var(--line);
}
.hero h1 { margin-bottom: .35em; }
.hero p.lead { font-size: 1.2rem; color: var(--ink-2); max-width: 640px; margin-bottom: 1.6em; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--ink-2);
  font-weight: 500; margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.hero-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-600); box-shadow: 0 0 0 4px rgba(22,163,74,.2); }

/* Sections */
.section { padding: 70px 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 32px; flex-wrap: wrap; gap: 12px; }
.section-title h2 { margin: 0; }
.section-title .link { color: var(--green-700); font-weight: 600; font-size: 15px; }

.surface { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* Cards */
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 24px; transition: transform .15s ease, box-shadow .15s, border-color .15s;
}
.card:hover { border-color: #d6e2db; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 15px; margin-bottom: 12px; }

.post-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s;
  display: flex; flex-direction: column;
}
.post-card:hover { border-color: #d6e2db; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.post-card .thumb {
  aspect-ratio: 16/9; background: linear-gradient(135deg, var(--green-700), var(--green-600));
  position: relative; color: #fff; display: grid; place-items: center; padding: 20px;
}
.post-card .thumb::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 48px);
}
.post-card .thumb .cat {
  position: absolute; top: 14px; left: 14px;
  background: rgba(255,255,255,.22); padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; backdrop-filter: blur(8px); letter-spacing: .02em;
}
.post-card .thumb svg { width: 64px; height: 64px; opacity: .95; }
.post-card .body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.post-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.post-card h3 a { color: var(--ink); }
.post-card p { font-size: 14px; color: var(--muted); flex: 1; }
.post-card .meta { font-size: 13px; color: var(--muted); margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.post-card .meta .dot { width: 3px; height: 3px; background: var(--muted); border-radius: 50%; }

.category-pill {
  display: inline-block; padding: 4px 10px; font-size: 12px; font-weight: 600;
  background: var(--green-50); color: var(--green-900); border-radius: 999px;
  letter-spacing: .02em;
}

/* Features */
.feature {
  display: flex; gap: 16px; align-items: flex-start;
}
.feature-icon {
  width: 44px; height: 44px; border-radius: 10px; background: var(--green-50);
  color: var(--green-700); display: grid; place-items: center; flex-shrink: 0;
}
.feature-icon svg { width: 22px; height: 22px; }
.feature h3 { margin: 0 0 4px; font-size: 1.05rem; }
.feature p { font-size: 15px; margin: 0; color: var(--muted); }

/* Article */
.breadcrumbs { font-size: 14px; color: var(--muted); margin: 32px 0 16px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--green-700); }

.article-header {
  padding: 40px 0 24px; border-bottom: 1px solid var(--line); margin-bottom: 36px;
}
.article-header .category-pill { margin-bottom: 14px; }
.article-header h1 { margin-bottom: 12px; }
.article-header .lead { font-size: 1.15rem; color: var(--ink-2); max-width: 700px; }
.article-meta { font-size: 14px; color: var(--muted); margin-top: 14px; }

.article-body { font-size: 17px; color: #1e293b; }
.article-body h2 { margin-top: 2em; margin-bottom: .7em; }
.article-body h3 { margin-top: 1.8em; margin-bottom: .5em; }
.article-body p { margin-bottom: 1.1em; }
.article-body ul, .article-body ol { margin: 0 0 1.3em; padding-left: 1.3em; }
.article-body li { margin-bottom: .45em; }
.article-body strong { color: var(--ink); }
.article-body blockquote {
  border-left: 4px solid var(--green-600); padding: 8px 18px;
  background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.5em 0; color: var(--ink-2); font-style: italic;
}
.article-body code {
  background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: .92em;
}
.callout {
  background: var(--green-50); border: 1px solid #bfe8ce; border-radius: var(--radius);
  padding: 18px 20px; margin: 1.8em 0;
}
.callout strong { color: var(--green-900); }

.article-footer {
  margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line);
}
.next-posts { margin: 48px 0; }
.next-posts h3 { margin-bottom: 16px; font-size: 1.15rem; }

/* Footer */
.site-footer {
  background: #0f1a14; color: #cbd5e1; padding: 56px 0 28px; margin-top: 80px;
}
.site-footer h4 { color: #fff; font-size: 1rem; margin-bottom: 14px; }
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 8px; font-size: 14px; }
.footer-brand { max-width: 320px; }
.footer-brand p { color: #94a3b8; font-size: 14px; }
.footer-bottom {
  margin-top: 40px; padding-top: 24px; border-top: 1px solid #1e293b;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  font-size: 13px; color: #94a3b8;
}
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

/* App / pitch */
.pitch-wrap {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-md);
}
.app-controls {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px;
}
.app-controls label { font-size: 13px; color: var(--muted); font-weight: 500; }
.select, .input {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; font: inherit; font-size: 14px; color: var(--ink);
}
.select:focus, .input:focus { outline: 2px solid var(--green-600); outline-offset: -1px; border-color: var(--green-600); }

.btn-sm { padding: 8px 14px; font-size: 14px; border-radius: 8px; }

/* Utility */
.muted { color: var(--muted); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.stack-sm > * + * { margin-top: 10px; }

/* Category chips on blog index */
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 32px; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-size: 14px; font-weight: 500; color: var(--ink-2);
  cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--green-600); color: var(--green-700); }
.chip.active { background: var(--green-700); color: #fff; border-color: var(--green-700); }

/* Stat */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin: 30px 0 0; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; text-align: left;
}
.stat b { font-size: 1.6rem; color: var(--green-700); display: block; line-height: 1; margin-bottom: 4px; }
.stat span { font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ============ Auth / Community UI ============ */
.nav-user { display: flex; align-items: center; gap: 12px; margin-left: 10px; }
.nav-auth { font-size: 14px; color: var(--ink-2) !important; font-weight: 600 !important; }
.nav-auth:hover { color: var(--green-700) !important; }
.nav-link-icon { display: inline-flex; padding: 6px; color: var(--ink-2); border-radius: 8px; }
.nav-link-icon:hover { background: var(--surface-2); color: var(--green-700); }

.avatar {
  display: inline-block; border-radius: 50%; object-fit: cover;
  background: var(--surface-2); vertical-align: middle;
}
.avatar-letter {
  color: #fff; font-weight: 700; display: inline-grid; place-items: center;
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
}

details.user-menu { position: relative; }
details.user-menu > summary {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border-radius: 999px; border: 1px solid var(--line); cursor: pointer; list-style: none;
  background: #fff;
}
details.user-menu > summary::-webkit-details-marker { display: none; }
details.user-menu > summary:hover { border-color: var(--green-600); }
details.user-menu .user-name { font-size: 14px; font-weight: 600; color: var(--ink); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 200px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 8px; z-index: 60;
}
.user-menu-panel a, .user-menu-panel button {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px; border-radius: 8px; color: var(--ink-2);
  background: none; border: 0; cursor: pointer; font-size: 14px; font-weight: 500;
}
.user-menu-panel a:hover, .user-menu-panel button:hover { background: var(--surface-2); color: var(--green-700); }

/* Forms */
.form { max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.form-wide { max-width: 720px; }
.form label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.form input, .form textarea, .form select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 15px; color: var(--ink); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .form textarea:focus, .form select:focus {
  outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
.form textarea { resize: vertical; min-height: 90px; }
.form .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form .row { grid-template-columns: 1fr; } }

.btn-block { width: 100%; justify-content: center; }
.form-error {
  background: #fef2f2; color: #991b1b; border: 1px solid #fecaca;
  padding: 10px 12px; border-radius: 8px; font-size: 14px;
}
.form-success {
  background: var(--green-50); color: var(--green-900); border: 1px solid #a7f3d0;
  padding: 10px 12px; border-radius: 8px; font-size: 14px;
}

/* Toast */
.fdt-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 100;
}
.fdt-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.fdt-toast-error { background: #991b1b; }
.fdt-toast-success { background: var(--green-700); }

/* Profile page */
.profile-hero {
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  color: #fff; padding: 60px 0 80px;
}
.profile-card {
  background: #fff; border-radius: var(--radius-lg); padding: 24px; margin-top: -60px;
  box-shadow: var(--shadow-lg); display: grid; grid-template-columns: 140px 1fr auto; gap: 24px; align-items: start;
}
.profile-card .avatar { width: 120px; height: 120px; border: 4px solid #fff; box-shadow: var(--shadow-md); }
.profile-card h1 { margin: 0 0 4px; font-size: 1.8rem; }
.profile-card .username { color: var(--muted); font-size: 15px; margin-bottom: 10px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }
.profile-meta span { display: inline-flex; align-items: center; gap: 6px; }
.profile-stats { display: flex; gap: 20px; font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.profile-stats b { color: var(--ink); font-weight: 700; }
.profile-actions { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 720px) {
  .profile-card { grid-template-columns: 1fr; text-align: center; padding: 20px; }
  .profile-card .avatar { margin: 0 auto; }
  .profile-meta, .profile-stats { justify-content: center; }
  .profile-actions { flex-direction: row; justify-content: center; }
}

.profile-section { margin-top: 32px; }
.profile-section h2 { font-size: 1.25rem; margin-bottom: 12px; }
.timeline { display: flex; flex-direction: column; gap: 14px; }
.timeline-item {
  border-left: 3px solid var(--green-600); padding: 6px 0 6px 16px;
}
.timeline-item h3 { font-size: 1rem; margin: 0 0 2px; }
.timeline-item .meta { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.timeline-item p { font-size: 14px; color: var(--ink-2); margin: 0; }

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 500;
  margin: 2px 4px 2px 0;
}
.badge-green { background: var(--green-50); color: var(--green-900); }

/* Feed / posts */
.feed-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; margin-top: 24px; }
@media (max-width: 900px) { .feed-layout { grid-template-columns: 1fr; } }

.composer, .post {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.composer textarea { width: 100%; border: 0; resize: vertical; min-height: 80px; font: inherit; font-size: 15px; color: var(--ink); outline: none; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.composer-tags { flex: 1; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }

.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post-head .who { display: flex; flex-direction: column; }
.post-head .who b { font-size: 14px; color: var(--ink); font-weight: 700; }
.post-head .who span { font-size: 12px; color: var(--muted); }
.post-body { font-size: 15px; color: var(--ink); white-space: pre-wrap; word-wrap: break-word; }
.post-tags { margin-top: 8px; }
.post-actions { display: flex; gap: 16px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.post-actions button {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 4px 8px; border-radius: 6px;
}
.post-actions button:hover { background: var(--surface-2); color: var(--green-700); }
.post-actions button.liked { color: #dc2626; }

.comments { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.comment { display: flex; gap: 10px; margin-bottom: 10px; }
.comment-body { flex: 1; background: var(--surface-2); padding: 8px 12px; border-radius: 10px; }
.comment-body b { font-size: 13px; color: var(--ink); }
.comment-body span.time { font-size: 11px; color: var(--muted); margin-left: 6px; }
.comment-body p { font-size: 14px; margin: 2px 0 0; color: var(--ink); }

/* Directory card */
.dts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 20px; }
.dt-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; text-align: center; transition: all .15s;
}
.dt-card:hover { border-color: var(--green-600); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dt-card .avatar { width: 64px; height: 64px; margin: 0 auto 10px; }
.dt-card h3 { margin: 0 0 4px; font-size: 1rem; }
.dt-card .uname { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.dt-card .club { font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
