/* ==========================================================================
   GreenDragon — Claude Minimalist Editorial Theme (Standalone Preview CSS)
   Matches src/styles/theme.css 1-to-1 without requiring a build step.
   ========================================================================== */

:root,
[data-theme="light"] {
  color-scheme: light;

  /* Surfaces */
  --paper: #faf9f5;
  --canvas: var(--paper);
  --surface: rgba(255, 254, 250, 0.86);
  --surface-solid: #fffefa;
  --wash: #f0eee6;
  --wash-hover: #e7e4da;

  /* Ink & Typography Colors */
  --ink: #141413;
  --body-ink: #3d3d3a;
  --muted: #73726c;

  /* Borders & Hairlines */
  --rule: #e6e3da;
  --rule-strong: #d8d4c8;

  /* Claude Terracotta Accent */
  --accent: #c96442;
  --accent-hover: #b55232;
  --accent-soft: rgba(201, 100, 66, 0.12);
  --link: #c96442;
  --link-hover: #b55232;
  --selection: rgba(201, 100, 66, 0.18);

  /* Elevation & Interactive Motion Surfaces */
  --nav-bg: var(--surface);
  --nav-border: rgba(20, 20, 19, 0.09);
  --nav-shadow: 0 1px 2px rgba(20, 20, 19, 0.04), 0 10px 28px rgba(20, 20, 19, 0.06);
  --nav-group-bg: var(--wash);
  --nav-hover-bg: var(--surface-solid);
  --tilt-shadow: rgba(20, 20, 19, 0.07);
  --tilt-shine: rgba(255, 255, 255, 0.65);
  --media-filter: none;

  /* Font Stacks */
  --ui-font: "Inter", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif-font: "Newsreader", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", Georgia, serif;
  --reading-font: "Newsreader", "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, serif;
  --brand: "Newsreader", "Noto Serif SC", Georgia, serif;

  /* Layout & Rhythm Tokens */
  --gutter: 48px;
  --frame: 1024px;
  --reading-width: 736px;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;
  --radius: 10px;
  --feedback: 0.2s ease-out;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  color-scheme: dark;

  /* Surfaces — Claude Warm Charcoal */
  --paper: #1f1e1d;
  --canvas: var(--paper);
  --surface: rgba(39, 38, 36, 0.86);
  --surface-solid: #282725;
  --wash: #2a2926;
  --wash-hover: #353430;

  /* Ink & Typography Colors */
  --ink: #f0eee9;
  --body-ink: #d4d1c8;
  --muted: #9b988e;

  /* Borders & Hairlines */
  --rule: #34332f;
  --rule-strong: #44423c;

  /* Claude Luminous Clay Accent */
  --accent: #d97757;
  --accent-hover: #e68c6e;
  --accent-soft: rgba(217, 119, 87, 0.16);
  --link: #d97757;
  --link-hover: #e68c6e;
  --selection: rgba(217, 119, 87, 0.28);

  /* Elevation & Interactive Motion Surfaces */
  --nav-bg: var(--surface);
  --nav-border: rgba(240, 238, 233, 0.09);
  --nav-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 14px 36px rgba(0, 0, 0, 0.38);
  --nav-group-bg: #262523;
  --nav-hover-bg: #353430;
  --tilt-shadow: rgba(0, 0, 0, 0.3);
  --tilt-shine: rgba(255, 248, 236, 0.08);
  --media-filter: brightness(0.93) contrast(1.02);
}

/* Minimal Utility Helpers (replacing Tailwind utilities in standalone preview) */
.min-h-screen { min-height: 100vh; }
.w-full { width: 100%; }
.max-w-full { max-width: 100%; }
.mx-auto { margin-inline: auto; }
.overflow-x-hidden { overflow-x: hidden; }
.h-4 { height: 1rem; }
.w-4 { width: 1rem; }
.-rotate-45 { transform: rotate(-45deg); }
.rotate-180 { transform: rotate(180deg); }

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

html {
  background-color: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 400 16px/1.68 var(--ui-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1,
h2,
h3 {
  font-family: var(--serif-font);
  text-wrap: pretty;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}

p {
  margin: 0;
}

a,
button {
  color: inherit;
  transition: color var(--feedback), background-color var(--feedback), border-color var(--feedback);
}

a {
  text-decoration: none;
}

button {
  cursor: pointer;
  background: transparent;
  border: 0;
  font: inherit;
}

a:hover,
a:active,
button:hover,
button:active {
  color: var(--link-hover);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

[tabindex="-1"]:focus {
  outline: none;
}

::selection {
  color: var(--ink);
  background: var(--selection);
}

/* Containers */
.page-shell,
.site-footer {
  width: min(calc(100% - 2 * var(--gutter)), var(--frame));
  margin-inline: auto;
}

.site-footer,
.site-footer > div,
.return-link,
.author-note {
  display: flex;
  align-items: center;
}

/* Sticky Minimalist Header Pill */
.site-header {
  position: sticky;
  top: 16px;
  z-index: 40;
  width: min(100% - 72px, 1120px);
  height: 0;
  margin: 0 auto;
}

.nav-pill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 58px;
  padding: 6px 8px 6px 14px;
  border-radius: 999px;
  background: var(--nav-bg);
  border: 1px solid var(--nav-border);
  box-shadow: var(--nav-shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.brand-link,
.back-to-top,
.text-link {
  display: inline-flex;
  align-items: center;
}

.brand-link {
  gap: 10px;
  width: fit-content;
  min-width: 0;
  white-space: nowrap;
  font-family: var(--brand);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}

.brand-link:hover {
  color: var(--ink);
}

.brand-mark {
  display: block;
  flex: none;
  width: 34px;
  height: 34px;
  object-fit: contain;
  transform-origin: 50%;
  transition: transform 0.22s var(--ease-out);
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border-radius: 999px;
  background: var(--nav-group-bg);
  border: 1px solid var(--rule);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--body-ink);
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover {
  color: var(--ink);
  background: var(--nav-hover-bg);
  transform: translateY(-0.5px);
}

.nav-divider {
  width: 1px;
  height: 16px;
  margin-inline: 3px;
  background: var(--rule-strong);
  flex: none;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  color: var(--muted);
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.22s var(--ease-out);
}

.theme-toggle:hover {
  color: var(--accent);
  background: var(--nav-hover-bg);
  transform: translateY(-0.5px);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
}

@media (hover: hover) and (pointer: fine) {
  .brand-link:hover .brand-mark {
    transform: scale(1.1);
  }
}

/* Main Content Spacing */
#main-content {
  padding-top: 88px;
}

.analysis-index,
.author-note,
.article-case-study h3[id] {
  scroll-margin-top: 96px;
}

/* Home Hero — Serene Claude Editorial */
.analysis-home-hero {
  position: relative;
  text-align: center;
  padding-block: 60px 64px;
  border-radius: var(--radius);
}

.analysis-home-mark {
  display: inline-block;
  width: 28px;
  height: 2px;
  margin-bottom: 22px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.85;
}

.analysis-home-hero h1 {
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.28;
}

.analysis-home-hero p {
  margin-top: 16px;
  font-size: 17px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* Index Section */
.analysis-index-heading {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--rule);
}

.analysis-index-heading h2 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.4;
}

.section-gloss {
  color: var(--muted);
  font: italic 15px/1.4 var(--brand);
  letter-spacing: 0.01em;
}

/* Article Feature Cards */
.article-feature {
  position: relative;
  display: grid;
  grid-template-columns: minmax(250px, 0.62fr) minmax(0, 1fr);
  align-items: center;
  column-gap: var(--space-5);
  padding-block: 32px;
  border-bottom: 1px solid var(--rule);
  border-radius: var(--radius);
}

.article-feature-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.article-feature-media {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--wash);
  border: 1px solid var(--rule);
}

.article-feature-media .project-media {
  aspect-ratio: 16 / 9;
}

.article-feature-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: var(--media-filter);
  transition: transform 0.45s var(--ease-out), filter 0.3s ease;
}

.article-feature:hover .article-feature-media img {
  transform: scale(1.02);
  filter: none;
}

.article-feature-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

.article-feature-meta span:not(:first-child)::before {
  content: "·";
  margin-right: 10px;
  opacity: 0.65;
}

.article-feature-copy h3 {
  margin: 8px 0 4px;
  font-size: 25px;
  font-weight: 500;
  line-height: 1.42;
  letter-spacing: -0.012em;
}

.article-feature-copy h3 a {
  color: var(--ink);
}

.article-feature-copy h3 a:hover {
  color: var(--accent);
}

.article-feature-summary {
  font: 400 16px/1.85 var(--reading-font);
  color: var(--body-ink);
  text-wrap: pretty;
}

.feature-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-2);
  margin-top: 16px;
}

.article-feature-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-feature-tags li {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 450;
  color: var(--muted);
  background: var(--wash);
  border: 1px solid var(--rule);
}

.text-link,
.return-link {
  gap: 6px;
  width: fit-content;
  min-height: 40px;
  font-size: 14px;
  font-weight: 500;
}

.text-link,
.original-link {
  color: var(--accent);
}

.text-link:hover,
.original-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.return-link:hover,
.back-to-top:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.link-arrow {
  flex: none;
  width: 15px;
  height: 15px;
  transition: transform 0.25s var(--ease-out);
}

.text-link:hover .link-arrow {
  transform: translateX(3px);
}

.return-link:hover .link-arrow {
  transform: translateX(-3px);
}

/* Author Note */
.author-note {
  gap: var(--space-3);
  padding: var(--space-5) 0;
}

.author-note img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  flex: none;
}

.author-note h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font: 500 22px/1.4 var(--brand);
  letter-spacing: -0.015em;
}

.author-note h2 span {
  font: 450 13.5px/1.5 var(--ui-font);
  color: var(--muted);
  letter-spacing: 0;
}

.author-note p {
  margin-top: 4px;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
}

/* Site Footer */
.site-footer {
  justify-content: space-between;
  gap: var(--space-2);
  padding-block: 20px 32px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
}

.site-footer > div {
  gap: 12px;
  font-size: 13.5px;
}

.site-footer strong {
  font: 500 17px/1 var(--brand);
  letter-spacing: -0.015em;
  color: var(--ink);
}

.back-to-top {
  gap: 6px;
  min-height: 40px;
  font-size: 13.5px;
  color: var(--muted);
}

/* Reader / Article Detail */
.reader {
  max-width: var(--reading-width);
  margin-top: var(--space-2);
}

.return-link {
  color: var(--muted);
}

.article-detail-header {
  margin-top: 10px;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--rule);
}

.article-detail-header h1 {
  font-size: clamp(28px, 4.2vw, 38px);
  font-weight: 600;
  line-height: 1.38;
  letter-spacing: -0.018em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.article-detail-header .article-feature-meta {
  margin-top: 14px;
}

.article-body {
  margin-top: var(--space-4);
  font: 400 18px/1.95 var(--reading-font);
  color: var(--body-ink);
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.article-body p + p {
  margin-top: 1.15em;
}

.article-section {
  margin-top: 52px;
}

.article-section h2,
.article-case-study h3 {
  color: var(--ink);
  margin-bottom: var(--space-2);
  line-height: 1.45;
  letter-spacing: -0.012em;
}

.article-section h2 {
  font-size: 26px;
  font-weight: 600;
}

.article-case-study {
  margin-top: var(--space-4);
}

.article-case-study h3 {
  font-size: 21px;
  font-weight: 600;
}

.article-body blockquote {
  margin: var(--space-3) 0;
  padding: 0.9em 1.25em;
  border-left: 2.5px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--wash);
  color: var(--ink);
  font-size: 0.96em;
  line-height: 1.85;
}

.article-body img,
.article-body video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  filter: var(--media-filter);
  transition: filter 0.3s ease;
}

.article-body img:hover {
  filter: none;
}

.article-case-study-media {
  margin: var(--space-2) 0 var(--space-3);
}

.article-case-study-caption {
  margin-top: 10px;
  font-family: var(--ui-font);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted);
}

.original-link {
  display: inline-block;
  padding-inline: 0.45em;
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.end-link {
  margin-block: var(--space-5) var(--space-6);
}

/* Subtle Interactive Tilt */
.analysis-home-hero::before,
.article-feature::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    circle at var(--tilt-shine-x, 50%) var(--tilt-shine-y, 50%),
    var(--tilt-shine),
    transparent 42%
  );
}

.article-feature::after {
  z-index: 2;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .analysis-home-hero {
    transition: transform 0.25s var(--ease-out);
    will-change: transform;
  }

  .analysis-home-hero:hover {
    transform: perspective(1000px) rotateX(var(--tilt-rotate-x, 0deg))
      rotateY(var(--tilt-rotate-y, 0deg)) translateY(var(--tilt-lift, 0px));
  }

  .analysis-home-hero::before,
  .article-feature::after {
    transition: opacity 0.2s var(--ease-out);
  }

  .analysis-home-hero:hover::before,
  .article-feature:hover::after {
    opacity: var(--tilt-shine-opacity, 0);
  }

  .article-feature {
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
    will-change: transform;
  }

  .article-feature:hover {
    box-shadow: var(--tilt-shadow-x, 0) var(--tilt-shadow-y, 10px) 24px -10px var(--tilt-shadow);
    transform: perspective(1200px) rotateX(var(--tilt-rotate-x, 0deg))
      rotateY(var(--tilt-rotate-y, 0deg)) translateY(var(--tilt-lift, 0px));
  }
}

/* Responsive */
@media (width <= 1100px) {
  .site-header {
    width: min(100% - 48px, 1020px);
  }
}

@media (width <= 767px) {
  :root,
  [data-theme="light"],
  [data-theme="dark"] {
    --gutter: 20px;
  }

  .site-header {
    width: calc(100% - 24px);
    top: 10px;
  }

  .nav-pill {
    gap: 6px;
    min-height: 52px;
    padding: 5px 6px 5px 10px;
  }

  .brand-link {
    gap: 7px;
    font-size: 16px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .nav-desktop {
    gap: 1px;
    padding: 3px;
  }

  .nav-link {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12.5px;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
  }

  #main-content {
    padding-top: 76px;
  }

  .analysis-home-hero {
    padding-block: 36px 40px;
  }

  .article-feature {
    grid-template-columns: 1fr;
    row-gap: 18px;
    padding-block: 24px;
  }

  .article-body {
    font-size: 17px;
    line-height: 1.9;
  }
}
