/* ==========================================================================
   AppClimb Blog — editorial design system
   Alpine green accent · warm climber personality · macOS-native feel.
   ========================================================================== */

:root {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  color: #0f1210;
  background: #f7f8f7;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  line-height: 1.72;

  --paper: #f7f8f7;
  --paper-2: #eef0ef;
  --ink: #0f1210;
  --ink-soft: #2d3430;
  --muted: #5c6560;
  --faint: #8a928c;
  --line: #dde2de;
  --line-strong: #c8cfc9;

  --green: #0b7a4f;
  --green-dark: #08613f;
  --green-tint: #e6f4ed;
  --green-line: #b9dcc9;
  --amber: #d98e24;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(15, 18, 16, 0.05), 0 2px 8px rgba(15, 18, 16, 0.03);
  --shadow-md: 0 1px 2px rgba(15, 18, 16, 0.05), 0 16px 40px rgba(15, 18, 16, 0.09);

  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
a { color: inherit; }

/* Reading progress bar — scroll-driven, degrades gracefully */
.read-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 100;
  background: linear-gradient(90deg, var(--green), #12a06a);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
@supports (animation-timeline: scroll()) {
  .read-progress {
    animation: grow linear both;
    animation-timeline: scroll(root);
  }
  @keyframes grow { to { transform: scaleX(1); } }
}

/* Header — sticky, blurred */
.blog-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 247, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.blog-header .container {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 0.85rem; padding-bottom: 0.85rem;
}
.brand-lockup {
  display: inline-flex; align-items: center; gap: 0.6rem;
  text-decoration: none; color: var(--ink);
  font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em;
}
.brand-lockup img {
  width: 30px; height: 30px; border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.brand-lockup:hover img { transform: rotate(-6deg) scale(1.08); }
.header-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 14px;
  border: 0; border-radius: 7px;
  color: #fff; background: var(--green); text-decoration: none;
  font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em;
  box-shadow: 0 0 0 1px rgba(8, 97, 63, 0.35), 0 1px 2px rgba(8, 97, 63, 0.25);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.header-cta:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(8, 97, 63, 0.4), 0 6px 16px rgba(8, 97, 63, 0.22); }
.header-cta:active { transform: translateY(0); }

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

/* Hero */
.blog-hero { padding: 3.5rem 0 2rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--green);
  background: var(--green-tint);
  border: 1px solid var(--green-line);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 1.1rem;
}
.blog-hero h1 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
  font-weight: 800;
  color: var(--ink);
}
.blog-hero .meta {
  color: var(--muted); font-size: 0.9rem;
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
.blog-hero .meta a { color: var(--green); text-decoration: none; font-weight: 600; }
.blog-hero .meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }

/* Body */
.blog-body { padding-bottom: 3rem; font-size: 1.06rem; color: var(--ink-soft); }
.blog-body h2 {
  font-size: 1.5rem; letter-spacing: -0.02em;
  margin: 2.8rem 0 0.9rem; font-weight: 750; color: var(--ink);
  scroll-margin-top: 5rem;
}
.blog-body h3 {
  font-size: 1.15rem; margin: 1.8rem 0 0.6rem; font-weight: 700; color: var(--ink);
}
.blog-body p { margin: 0 0 1.3rem; }
.blog-body ul, .blog-body ol { margin: 0 0 1.4rem; padding-left: 1.4rem; }
.blog-body li { margin-bottom: 0.55rem; }
.blog-body li::marker { color: var(--green); }
.blog-body strong { font-weight: 700; color: var(--ink); }

/* Links — animated underline */
.blog-body a {
  color: var(--green); text-decoration: none; font-weight: 600;
  background-image: linear-gradient(var(--green), var(--green));
  background-size: 0% 1.5px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.blog-body a:hover { background-size: 100% 1.5px; }

/* Inline code */
.blog-body code {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--green-tint); color: var(--green-dark);
  padding: 0.15em 0.45em; border-radius: 5px;
  border: 1px solid var(--green-line);
}

/* Code blocks — macOS terminal motif */
.blog-body pre {
  position: relative;
  background: #0b0f0d;
  color: #dfe6e1;
  padding: 2.4rem 1.4rem 1.4rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.65;
  box-shadow: var(--shadow-md);
  margin: 0 0 1.6rem;
}
.blog-body pre::before {
  content: "";
  position: absolute; top: 0.85rem; left: 1rem;
  width: 11px; height: 11px; border-radius: 50%;
  background: #ff5f57;
  box-shadow: 18px 0 0 #febc2e, 36px 0 0 #28c840;
}
.blog-body pre code {
  background: none; border: none; padding: 0; color: inherit; font-size: inherit;
}

/* Key-point callout */
.callout {
  border-left: 3px solid var(--green);
  background: var(--green-tint);
  padding: 1rem 1.3rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 1.8rem 0;
  font-size: 0.98rem;
}
.callout p:last-child { margin-bottom: 0; }

/* CTA card */
.blog-cta {
  position: relative;
  background: linear-gradient(160deg, #0f1a15, #0b7a4f 140%);
  border-radius: var(--radius-lg);
  padding: 2.4rem 2rem 2.2rem;
  margin: 3rem 0 1rem;
  text-align: center;
  color: #eaf4ee;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.blog-cta::after {
  content: "";
  position: absolute; right: -40px; top: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(216, 242, 24, 0.18), transparent 70%);
}
.blog-cta strong { color: #fff; font-size: 1.25rem; letter-spacing: -0.01em; }
.blog-cta p { color: #bfe0cd; margin: 0.5rem auto 0; max-width: 34ch; font-size: 0.96rem; }
.blog-cta a {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 0; border-radius: 8px;
  background: #f5f4ee; color: var(--ink); text-decoration: none;
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  margin-top: 1.3rem;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.blog-cta a:hover {
  background: #ffffff; transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.blog-cta a:active { transform: translateY(0); }

/* Footer */
.blog-footer {
  border-top: 1px solid var(--line);
  padding: 2.2rem 0 3rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.blog-footer a { color: var(--green); text-decoration: none; font-weight: 600; }
.blog-footer a:hover { text-decoration: underline; }

/* Post index list */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-card {
  display: block;
  padding: 1.6rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  margin-bottom: 1rem;
  text-decoration: none;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s, border-color 0.25s;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--green-line);
}
.post-card .date {
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--green);
}
.post-card h2 {
  font-size: 1.22rem; line-height: 1.3; letter-spacing: -0.015em;
  margin: 0.5rem 0 0.5rem; color: var(--ink); font-weight: 720;
}
.post-card p { margin: 0; color: var(--muted); font-size: 0.94rem; line-height: 1.6; }
.post-card .read {
  display: inline-flex; align-items: center; gap: 0.3rem;
  margin-top: 0.9rem; font-size: 0.85rem; font-weight: 700; color: var(--green);
}
.post-card .read span { transition: transform 0.25s; }
.post-card:hover .read span { transform: translateX(4px); }

/* Scroll reveal — progressive enhancement */
@supports (animation-timeline: view()) {
  .blog-body > *, .post-card {
    animation: reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 35%;
  }
  @keyframes reveal {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
