/* ============================================================
   Penraft Landing — Design Tokens
   ============================================================ */
:root {
  --bg: #f5f3ef;
  --bg-2: #efece6;
  --surface: #fbfaf8;
  --surface-2: #ffffff;
  --ink: #24201a;
  --ink-strong: #111827;
  --muted: #7c746a;
  --muted-2: #a49b90;
  --line: #e8e2d8;
  --line-strong: #d8d0c2;
  --accent: #22c55e;
  --link: #0366d6;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --shadow-card: 0 1px 0 rgba(28, 22, 16, 0.04), 0 6px 18px rgba(28, 22, 16, 0.06);
  --shadow-float: 0 18px 50px rgba(28, 22, 16, 0.14);
  --shadow-screenshot: 0 30px 70px rgba(28, 22, 16, 0.18), 0 4px 12px rgba(28, 22, 16, 0.08);

  --ff-sans: "PingFang SC", "Helvetica Neue", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ff-mono: "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --container: 1180px;
  --nav-height: 64px;
}

/* ============================================================
   Reset / Base
   ============================================================ */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

code, kbd, pre {
  font-family: var(--ff-mono);
  font-size: 0.92em;
}

code {
  background: var(--bg-2);
  padding: 0.12em 0.42em;
  border-radius: 6px;
  color: var(--ink-strong);
  border: 1px solid var(--line);
}

kbd {
  display: inline-block;
  padding: 0.1em 0.5em;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  color: var(--ink-strong);
  font-size: 0.85em;
  white-space: nowrap;
}

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

/* ============================================================
   Nav
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 243, 239, 0.85);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.nav.is-scrolled {
  border-bottom-color: var(--line);
}

.nav-inner {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-strong);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.brand-mark {
  border-radius: 7px;
  box-shadow: 0 1px 3px rgba(28, 22, 16, 0.15);
}

.nav-links {
  display: flex;
  gap: 28px;
  margin-left: 8px;
  flex: 1;
}
.nav-links a {
  font-size: 14.5px;
  color: var(--muted);
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--ink-strong); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lang-toggle {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.lang-btn {
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}
.lang-btn.is-active {
  background: var(--surface-2);
  color: var(--ink-strong);
  box-shadow: 0 1px 2px rgba(28, 22, 16, 0.08);
}
.lang-btn:hover:not(.is-active) { color: var(--ink-strong); }

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.icon-link:hover {
  background: var(--bg-2);
  color: var(--ink-strong);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-sm {
  padding: 8px 14px;
  font-size: 13.5px;
  border-radius: 10px;
}
.btn-primary {
  background: var(--ink-strong);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 6px 16px rgba(17, 24, 39, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 10px 22px rgba(17, 24, 39, 0.3);
}
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--ink-strong);
  border-color: var(--line-strong);
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--ink);
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding: 72px 0 96px;
  overflow: hidden;
  position: relative;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 500px at 90% -10%, rgba(34, 197, 94, 0.06), transparent 60%),
    radial-gradient(700px 400px at 0% 20%, rgba(28, 22, 16, 0.04), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 56px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: inline-block;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 22px;
}

.hero-title {
  font-size: clamp(34px, 4.6vw, 54px);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--ink-strong);
  margin: 0 0 22px;
}

.hero-sub {
  font-size: 17.5px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0 0 32px;
  max-width: 540px;
}
.hero-sub code {
  font-size: 0.88em;
  white-space: nowrap;
}

.hero-tags {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  font-size: 14px;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.hero-tags li {
  display: inline;
}
.hero-tags li + li::before {
  content: "·";
  margin: 0 12px;
  color: var(--muted-2);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.hero-meta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 18px 24px;
  font-size: 13.5px;
  color: var(--muted);
}
.hero-meta .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  vertical-align: middle;
}

/* ============================================================
   Screenshot frame
   ============================================================ */
.screenshot {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-screenshot);
}
.screenshot-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  background: linear-gradient(180deg, #f7f4ef, #f1ede5);
  border-bottom: 1px solid var(--line);
}
.dot-mac {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ddd;
}
.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }

.screenshot-img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg);
}

.hero-visual { position: relative; }
.hero-visual .screenshot {
  transform: perspective(1200px) rotateY(-1.5deg) rotateX(0.3deg);
}

/* Hide raw img until JS confirms it loaded; show mock by default */
.screenshot-frame img.screenshot-img {
  display: none;
}
.screenshot-frame.has-image img.screenshot-img {
  display: block;
}
.screenshot-frame.has-image .screenshot-mock {
  display: none;
}

/* ============================================================
   Screenshot mock (in-browser fallback)
   ============================================================ */
.screenshot-mock {
  background: var(--surface-2);
  padding: 0;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.mock-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px 0;
  background: linear-gradient(180deg, #f6f3ee, #f1ede5);
  border-bottom: 1px solid var(--line);
}
.mock-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 8px;
  border-radius: 10px 10px 2px 2px;
  font-size: 12.5px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mock-tab.is-active {
  background: var(--surface-2);
  color: var(--ink-strong);
  font-weight: 500;
  box-shadow: 0 -1px 0 var(--line), 1px 0 0 var(--line), -1px 0 0 var(--line);
}
.mock-tab[data-mock-tab] {
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.mock-tab[data-mock-tab]:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
}
.mock-tab[data-mock-tab]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.mock-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.mock-tab-plus,
.mock-source-toggle {
  margin-left: auto;
  padding: 6px 10px;
  color: var(--muted-2);
  font-size: 13px;
  font-family: var(--ff-mono);
}

.mock-body {
  padding: 28px 40px 32px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink);
  flex: 1;
  display: none;
}
.mock-body.is-active {
  display: block;
}
.mock-h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  letter-spacing: -0.01em;
}
.mock-h2 {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink-strong);
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.mock-quote {
  margin: 0 0 14px;
  padding: 4px 14px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
  font-size: 13.5px;
}
.mock-list {
  margin: 0 0 10px;
  padding-left: 20px;
  color: var(--ink);
}
.mock-list li { margin: 5px 0; font-size: 13.5px; }
.mock-list strong { color: var(--ink-strong); }
.mock-p {
  margin: 14px 0 0;
  font-size: 13.5px;
}
.mock-p code {
  font-size: 0.85em;
  padding: 0.1em 0.36em;
}

/* Source mode variant */
.mock-source {
  margin: 0;
  padding: 26px 36px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff-mono);
  font-size: 13px;
  line-height: 1.85;
  flex: 1;
  white-space: pre-wrap;
  overflow: hidden;
}
.mock-source code { background: none; border: none; padding: 0; }
.mock-source .src-h { color: #b45309; font-weight: 600; }
.mock-source .src-q { color: var(--muted); }
.mock-source .src-c {
  color: var(--ink-strong);
  background: rgba(36, 30, 21, 0.06);
  padding: 0.05em 0.3em;
  border-radius: 4px;
}

/* ============================================================
   Section base
   ============================================================ */
.section {
  padding: 96px 0;
  position: relative;
}
.section-alt {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-head {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 56px;
}
.section-head .eyebrow { margin-bottom: 16px; }
.section-title {
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.25;
  letter-spacing: -0.018em;
  font-weight: 700;
  color: var(--ink-strong);
  margin: 0 0 14px;
}
.section-sub {
  font-size: 16.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.65;
}

/* ============================================================
   Feature grid
   ============================================================ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px 26px;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
  border-color: var(--line-strong);
}

.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-strong);
  margin-bottom: 18px;
}
.feature-icon svg { width: 22px; height: 22px; }

.feature-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-strong);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.feature-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}
.feature-desc code { font-size: 0.85em; }
.feature-desc kbd { font-size: 0.8em; padding: 0.05em 0.4em; }

/* ============================================================
   Highlight
   ============================================================ */
.highlight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 64px;
  align-items: center;
}

.highlight-visual .screenshot {
  transform: perspective(1200px) rotateY(1.5deg);
}

.principle-list {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
}
.principle-list li {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.principle-list li:first-child { padding-top: 0; }
.principle-list li:last-child { border-bottom: none; padding-bottom: 0; }
.principle-list h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--ink-strong);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.principle-list p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 48px 0 36px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px 40px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.footer-brand img {
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(28, 22, 16, 0.15);
}
.footer-name {
  font-weight: 600;
  color: var(--ink-strong);
  font-size: 15px;
}
.footer-tag {
  color: var(--muted);
  font-size: 12.5px;
}
.footer-links {
  display: flex;
  gap: 22px;
  flex: 1;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--muted);
  font-size: 13.5px;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--ink-strong); }
.footer-copy {
  color: var(--muted-2);
  font-size: 12.5px;
  width: 100%;
  text-align: center;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 960px) {
  .hero { padding: 56px 0 72px; }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .hero-visual .screenshot { transform: none; }
  .hero-meta { gap: 12px 22px; }

  .section { padding: 72px 0; }
  .section-head { margin-bottom: 40px; }

  .highlight-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .highlight-visual .screenshot { transform: none; }
  .principle-list { margin-top: 16px; }

  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .nav-links { display: none; }
  .nav-inner { gap: 14px; }
  .nav-actions { gap: 10px; margin-left: auto; }
}

@media (max-width: 600px) {
  .container { padding-left: 18px; padding-right: 18px; }
  .hero { padding: 44px 0 56px; }
  .hero-title { font-size: 30px; line-height: 1.22; }
  .hero-sub { font-size: 16px; }
  .hero-cta .btn { width: 100%; justify-content: center; }

  .section { padding: 60px 0; }
  .section-title { font-size: 26px; }
  .section-sub { font-size: 15px; }

  .feature-grid { grid-template-columns: 1fr; }

  .icon-link { display: none; }
  .nav-actions .btn { padding: 7px 12px; font-size: 13px; }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .footer-copy { text-align: left; }
}

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

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 6px;
}
