/* ============================================================
   AI Photo Studio — Asymmetric Editorial Layout
   Warm Amber · Left Tool + Right Blog Sidebar
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
  --color-bg: #faf7f2;
  --color-surface: #ffffff;
  --color-primary: #b45309;
  --color-primary-hover: #92400e;
  --color-primary-soft: #fffbeb;
  --color-primary-glow: rgba(180, 83, 9, 0.10);
  --color-accent: #d97706;
  --color-text: #1a1a1a;
  --color-text-secondary: #5c5549;
  --color-text-muted: #a39b8f;
  --color-border: #e8e2d6;
  --color-error: #dc2626;
  --color-error-bg: #fef2f2;
  --color-success: #16a34a;
  --color-success-bg: #f0fdf4;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-sm: 0 1px 3px rgba(180, 83, 9, 0.05);
  --shadow-md: 0 4px 16px rgba(180, 83, 9, 0.06);
  --shadow-lg: 0 12px 32px rgba(180, 83, 9, 0.07);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: 400ms var(--ease-out-expo);
  --transition-fast: 250ms var(--ease-out-expo);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(180, 83, 9, 0.04), transparent),
    radial-gradient(ellipse 50% 60% at 90% 80%, rgba(217, 119, 6, 0.03), transparent),
    var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  min-height: 100vh;
  padding: 36px 32px 48px;
}

/* ---- Noise / Grain Overlay ---- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* ---- Full-Width Container ---- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* ---- Header — full width, left-aligned ---- */
.header {
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.04em;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(180, 83, 9, 0.08);
  color: var(--color-accent);
  flex-shrink: 0;
}

.subtitle {
  font-size: 13px;
  color: var(--color-text-secondary);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-top: 4px;
}

/* ---- Main Grid: 2 columns ---- */
.main-grid {
  display: grid;
  grid-template-columns: 5fr 4fr;
  gap: 28px;
  align-items: start;
}

/* ---- Left Column: Tool — centered ---- */
.tool-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
  align-items: center;
}

.tool-column .card-shell {
  width: 100%;
  text-align: left;
}

/* ---- Right Column: Blog Sidebar ---- */
.blog-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 20px;
}

/* ---- Tool Intro ---- */
.tool-intro {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.7;
  max-width: 440px;
}

/* ---- Mode Selector — inside tool column, centered ---- */
.mode-selector {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border: 1px solid var(--color-border);
  border-radius: 26px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  letter-spacing: -0.01em;
}

.mode-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  transform: translateY(-1px);
}

.mode-btn.active {
  background: linear-gradient(135deg, #b45309, #d97706);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 2px 12px var(--color-primary-glow);
}

/* ============================================================
   Cards
   ============================================================ */

.card-shell {
  position: relative;
  background: rgba(180, 83, 9, 0.035);
  border: 1px solid rgba(180, 83, 9, 0.06);
  border-radius: var(--radius-xl);
  padding: 2px;
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition);
}

.card {
  background: var(--color-surface);
  border-radius: calc(var(--radius-xl) - 2px);
  padding: 28px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

/* ---- Pricing — below upload area, centered ---- */
.pricing-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 0 0;
}

.pricing-label { font-size: 14px; font-weight: 500; color: var(--color-text-secondary); }

.pricing-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: -0.03em;
}

.pricing-desc { font-size: 12px; color: var(--color-text-muted); }

/* ---- Upload Area — tall to fill column ---- */
.upload-area {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 72px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(180, 83, 9, 0.03), transparent),
    linear-gradient(180deg, #fdfaf5, #faf7f2);
  position: relative;
  overflow: hidden;
}

.upload-area::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(180, 83, 9, 0.05), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.upload-area:hover::before { opacity: 1; }

.upload-area:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.upload-area.drag-over {
  border-color: var(--color-accent);
  border-style: solid;
  background: var(--color-primary-soft);
  box-shadow: 0 0 0 6px var(--color-primary-glow);
  transform: scale(1.012);
}

.upload-icon {
  color: var(--color-text-muted);
  margin-bottom: 20px;
  transition: all var(--transition);
  position: relative;
  z-index: 1;
}

.upload-area:hover .upload-icon { color: var(--color-accent); transform: translateY(-2px); }

.upload-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
  letter-spacing: -0.02em;
}

.upload-hint {
  font-size: 13px;
  color: var(--color-text-muted);
  position: relative;
  z-index: 1;
}

/* ---- Local Preview ---- */
.local-preview { text-align: center; }

.local-preview img {
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background-color: #f5f0e8;
  margin-bottom: 20px;
}

.preview-actions { display: flex; gap: 10px; justify-content: center; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border: none;
  border-radius: 28px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #ffffff;
  min-width: 130px;
  box-shadow: 0 2px 8px var(--color-primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #92400e, #b45309);
  box-shadow: 0 6px 20px var(--color-primary-glow);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-outline {
  background-color: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.btn-outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background-color: var(--color-primary-soft);
}

.btn-download {
  background: #1a1a1a;
  color: #ffffff;
  padding: 12px 24px;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 28px;
}

.btn-download:hover {
  background: #333;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-download:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ---- Creem Pay Button ---- */
.btn-creem-pay {
  width: 100%;
  padding: 15px 24px;
  background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.btn-creem-pay:hover {
  background: linear-gradient(135deg, #b45309, #d97706);
  box-shadow: 0 8px 28px var(--color-primary-glow);
  transform: translateY(-2px);
}

.btn-creem-pay:active { transform: scale(0.98); }
.btn-creem-pay:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-spinner svg { animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Processing — tall to match upload area ---- */
.processing-card { text-align: center; padding: 80px 28px; }
.processing-animation { margin-bottom: 22px; }

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

.processing-text { font-size: 16px; font-weight: 600; color: var(--color-text); margin-bottom: 6px; }
.processing-hint { font-size: 13px; color: var(--color-text-muted); }

/* ---- Result ---- */
.result-card { padding: 24px; }

.result-preview { position: relative; text-align: center; margin-bottom: 4px; }

.result-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  z-index: 2;
  letter-spacing: 0.04em;
}

.result-preview img {
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: repeating-conic-gradient(#f5f0e8 0% 25%, #faf7f2 0% 50%) 50% / 20px 20px;
}

/* ---- Code Toggle / Download ---- */
.code-toggle {
  text-align: center;
  font-size: 11px;
  color: var(--color-text-muted);
  cursor: pointer;
  margin-bottom: 10px;
  transition: color var(--transition-fast);
}

.code-toggle:hover { color: var(--color-accent); }

.download-section { margin-top: 6px; }

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-border), transparent);
  margin: 20px 0;
}

.download-title { font-size: 15px; font-weight: 600; color: var(--color-text); margin-bottom: 4px; }

.code-input-group { display: flex; gap: 8px; }

.code-input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  letter-spacing: 0.05em;
  color: var(--color-text);
  background: #faf8f4;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.code-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.code-input::placeholder { color: var(--color-text-muted); letter-spacing: 0; }

/* ---- Messages ---- */
.message {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.message.error { background-color: var(--color-error-bg); color: var(--color-error); }
.message.success { background-color: var(--color-success-bg); color: var(--color-success); }

.btn-restart { margin-top: 16px; width: 100%; }

/* ---- Error — tall to match column ---- */
.error-card { text-align: center; padding: 80px 28px; }
.error-icon { color: var(--color-error); margin-bottom: 16px; }
.error-text { font-size: 15px; color: var(--color-text-secondary); margin-bottom: 20px; line-height: 1.7; }

/* ============================================================
   Footer — inside tool column, centered
   ============================================================ */
.footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
  position: relative;
  z-index: 1;
  text-align: center;
}

.footer p { font-size: 11px; color: var(--color-text-muted); margin-bottom: 6px; }

.footer-links { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: center; }

.footer-links a {
  font-size: 11px;
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.footer-links a:hover { color: var(--color-primary); }
.footer-sep { color: var(--color-border); margin: 0 6px; font-size: 11px; }

/* ============================================================
   Blog Sidebar — Vertical Card Stack
   ============================================================ */

.blog-sidebar-header {
  margin-bottom: 4px;
}

.blog-sidebar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.blog-sidebar-header h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.blog-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.blog-stack-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 15px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.blog-stack-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-lg);
  transform: translateX(2px);
}

.blog-stack-card.featured {
  border-left: 3px solid var(--color-accent);
  padding-left: 14px;
}

.blog-stack-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(180, 83, 9, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
}

.blog-stack-content {
  flex: 1;
  min-width: 0;
}

.blog-stack-category {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  margin-bottom: 2px;
}

.blog-stack-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin-bottom: 3px;
}

.blog-stack-date {
  font-size: 10px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.blog-stack-arrow {
  flex-shrink: 0;
  opacity: 0;
  transform: translateX(-4px);
  transition: all var(--transition-fast);
  color: var(--color-accent);
  align-self: center;
}

.blog-stack-card:hover .blog-stack-arrow {
  opacity: 1;
  transform: translateX(0);
}

.blog-sidebar-footer {
  margin-top: 4px;
}

.blog-sidebar-footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  transition: all var(--transition-fast);
  padding: 8px 16px;
  border-radius: 24px;
  border: 1px solid transparent;
}

.blog-sidebar-footer a:hover {
  border-color: var(--color-accent);
  background: var(--color-primary-soft);
}

.blog-sidebar-footer a .arrow-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(217, 119, 6, 0.12);
  transition: all var(--transition-fast);
}

.blog-sidebar-footer a:hover .arrow-circle {
  transform: translateX(3px);
}

/* ============================================================
   Scroll Reveal
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 600ms var(--ease-out-expo),
              transform 600ms var(--ease-out-expo);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.blog-stack-card:nth-child(1).reveal { transition-delay: 0ms; }
.blog-stack-card:nth-child(2).reveal { transition-delay: 40ms; }
.blog-stack-card:nth-child(3).reveal { transition-delay: 80ms; }
.blog-stack-card:nth-child(4).reveal { transition-delay: 120ms; }
.blog-stack-card:nth-child(5).reveal { transition-delay: 160ms; }

/* ---- Blog Article Shared Styles ---- */
.article-card { padding: 32px; }
.article-card h2 {
  font-size: 20px; margin: 28px 0 10px; color: var(--color-text);
  font-weight: 600; letter-spacing: -0.02em; line-height: 1.25;
}
.article-card h2:first-of-type { margin-top: 0; }
.article-card p {
  font-size: 15px; color: var(--color-text-secondary); line-height: 1.85; margin-bottom: 14px;
  max-width: 65ch;
}
.blog-date { font-size: 12px; color: var(--color-text-muted); margin-bottom: 20px; }
.breadcrumb { font-size: 13px; color: var(--color-text-muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--color-accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.blog-card { padding: 28px 32px; }
.blog-card h2 { font-size: 18px; margin-bottom: 6px; }
.blog-card h2 a {
  color: var(--color-text); text-decoration: none; font-weight: 600; letter-spacing: -0.02em;
}
.blog-card h2 a:hover { color: var(--color-accent); }
.blog-card .meta { font-size: 12px; color: var(--color-text-muted); margin-bottom: 10px; }
.blog-card p { font-size: 14px; color: var(--color-text-secondary); line-height: 1.75; }
.blog-list { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }

/* ---- About Page ---- */
.about-card { padding: 32px; }
.about-card h2 {
  font-size: 20px; margin: 28px 0 10px; color: var(--color-text);
  font-weight: 600; letter-spacing: -0.02em; line-height: 1.25;
}
.about-card h2:first-of-type { margin-top: 0; }
.about-card p { font-size: 14px; color: var(--color-text-secondary); line-height: 1.85; margin-bottom: 16px; }
.about-card ul { font-size: 14px; color: var(--color-text-secondary); line-height: 1.85; padding-left: 20px; margin-bottom: 16px; }
.about-card ul li { margin-bottom: 6px; }

/* ============================================================
   Responsive — Single Column below 860px
   ============================================================ */
@media (max-width: 860px) {
  body { padding: 24px 14px 48px; }

  .main-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .header {
    margin-bottom: 22px;
  }

  .title { font-size: 22px; }

  .blog-column {
    position: static;
    order: 1;
  }

  .tool-column { order: 0; }

  .card { padding: 20px 16px; }
  .card-shell { padding: 2px; border-radius: var(--radius-md); }

  .upload-area { padding: 48px 18px; }
  .processing-card { padding: 48px 18px; }
  .error-card { padding: 48px 18px; }

  .blog-stack-card { padding: 13px 14px; gap: 10px; }
  .blog-stack-card:hover { transform: none; }
  .blog-stack-arrow { opacity: 1; transform: none; }

  .code-input-group { flex-direction: column; }
  .btn-download { width: 100%; }
  .preview-actions { flex-direction: column; }
  .preview-actions .btn { width: 100%; }
}
