/* ============================================================
   HomaClass Theme — Design System & Layout
   Built on: Linear design system (light-mode adaptation)
   ============================================================ */

/* ─── Design Tokens ───────────────────────────────── */
:root {
  --bg:      #f7f8f8;
  --surface: #ffffff;
  --surface-alt: #f0f1f3;
  --fg:      #1c1b1a;
  --muted:   #8a8f98;
  --border:  #d0d6e0;
  --accent:  #5e6ad2;
  --accent-dark: #4a55b8;

  --accent-blue:    #0ea5e9;
  --accent-teal:    #14b8a6;
  --accent-amber:   #f59e0b;
  --accent-rose:    #f43f5e;
  --accent-emerald: #10b981;
  --accent-violet:  #8b5cf6;

  --accent-soft: color-mix(in oklch, var(--accent) 12%, transparent);
  --fg-soft:     color-mix(in oklch, var(--fg) 5%, transparent);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);

  --font-display: 'Inter', -apple-system, 'PingFang TC', 'Microsoft JhengHei', 'Noto Sans TC', sans-serif;
  --font-body:    'Inter', -apple-system, 'PingFang TC', 'Microsoft JhengHei', 'Noto Sans TC', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --fs-h1: clamp(40px, 5.5vw, 64px);
  --fs-h2: clamp(28px, 3.5vw, 40px);
  --fs-h3: 22px;
  --fs-lead: 18px;
  --fs-body: 16px;
  --fs-meta: 13px;

  --gap-xs: 8px;
  --gap-sm: 12px;
  --gap-md: 20px;
  --gap-lg: 32px;
  --gap-xl: 56px;
  --gap-2xl: 96px;
  --container: 1120px;
  --gutter: 32px;

  --radius: 10px;
  --radius-lg: 16px;
}

/* ─── Reset & Base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% -10%, color-mix(in oklch, var(--accent-violet) 3%, transparent), transparent),
    radial-gradient(ellipse 50% 40% at 80% 80%, color-mix(in oklch, var(--accent-teal) 3%, transparent), transparent),
    var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.5; pointer-events: none;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, .btn { font: inherit; cursor: pointer; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; }

/* ─── Layout Primitives ─────────────────────────────── */
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(48px, 8vw, var(--gap-2xl)); }
.section + .section { border-top: 1px solid var(--border); }
.section-tinted { background: var(--surface-alt); }
.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--gap-md); }
.row { display: flex; align-items: center; gap: var(--gap-md); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-lg); }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--gap-xl); align-items: start; }

@media (max-width: 920px) {
  .grid-2, .grid-3, .grid-2-1 { grid-template-columns: 1fr; }
}

/* ─── Type ──────────────────────────────────────────── */
.h1, h1 { font-family: var(--font-display); font-size: var(--fs-h1); line-height: 1.08; letter-spacing: -0.025em; margin: 0; font-weight: 700; }
.h2, h2 { font-family: var(--font-display); font-size: var(--fs-h2); line-height: 1.15; letter-spacing: -0.018em; margin: 0; font-weight: 650; }
.h3, h3 { font-size: var(--fs-h3); font-weight: 600; line-height: 1.3; letter-spacing: -0.008em; margin: 0; }
.lead { font-size: var(--fs-lead); line-height: 1.6; color: var(--muted); max-width: 60ch; margin: 0; }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent);
  margin: 0 0 var(--gap-md);
}
.meta { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--muted); }
.num  { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ─── Chrome: Nav + Footer ──────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding-block: 14px; }
.site-logo { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.015em; }
.site-logo a { color: var(--fg); }
.primary-menu { display: flex; gap: var(--gap-lg); list-style: none; margin: 0; padding: 0; }
.primary-menu a { font-size: 15px; color: var(--muted); font-weight: 500; transition: color 0.15s; }
.primary-menu a:hover { color: var(--fg); }
.primary-menu .current-menu-item a { color: var(--fg); }

.site-footer { padding-block: var(--gap-xl); color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }

@media (max-width: 640px) {
  .primary-menu { display: none; }
}

/* ─── Buttons ────────────────────────────────────────── */
.btn, button[type="submit"], .wp-block-button__link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 15px; font-weight: 500;
  letter-spacing: -0.005em;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s;
  cursor: pointer;
}
.btn:active, button[type="submit"]:active { transform: translateY(1px); }
.btn-primary, button[type="submit"], .wp-block-button__link {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 2px 8px color-mix(in oklch, var(--accent) 35%, transparent);
}
.btn-primary:hover, button[type="submit"]:hover, .wp-block-button__link:hover {
  background: var(--accent-dark); border-color: var(--accent-dark);
  box-shadow: 0 4px 16px color-mix(in oklch, var(--accent) 45%, transparent);
}
.btn-secondary {
  background: var(--surface); color: var(--fg); border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { border-color: var(--fg); box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; color: var(--fg); border-color: transparent; padding-inline: 8px; }
.btn-ghost:hover { color: var(--accent); }
.btn-arrow::after { content: '→'; transition: transform 0.15s ease; }
.btn-arrow:hover::after { transform: translateX(2px); }

/* ─── Cards ──────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s, border-color 0.25s, transform 0.25s;
}
.card:hover { box-shadow: var(--shadow-md); }

/* ─── Category Cards ──────────────────────────────────── */
.cat-card {
  position: relative; overflow: hidden;
}
.cat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cat-accent, var(--accent)), color-mix(in oklch, var(--cat-accent, var(--accent)) 50%, transparent));
  opacity: 0; transition: opacity 0.25s;
}
.cat-card:hover { box-shadow: var(--shadow-md); border-color: var(--cat-accent, var(--fg)); transform: translateY(-2px); }
.cat-card:hover::before { opacity: 1; }

/* ─── Pills & Tags ───────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: color-mix(in oklch, var(--accent-teal) 16%, transparent);
  color: var(--accent-teal);
  border-radius: 999px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.tag {
  display: inline-flex; align-items: center;
  padding: 5px 12px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; font-weight: 500;
  transition: all 0.15s;
}
.tag:hover, .tag.active { color: var(--fg); border-color: var(--fg); }
.tag.active { background: var(--fg-soft); font-weight: 600; }

/* ─── Hero ───────────────────────────────────────────── */
.hero {
  padding-block: clamp(80px, 12vw, 160px);
  position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse 60% 40% at 20% 0%, color-mix(in oklch, var(--accent-violet) 6%, transparent), transparent 50%),
    radial-gradient(ellipse 50% 35% at 80% 0%, color-mix(in oklch, var(--accent-blue) 6%, transparent), transparent 50%),
    radial-gradient(ellipse 40% 30% at 50% 100%, color-mix(in oklch, var(--accent-teal) 5%, transparent), transparent 50%);
}
.hero::before {
  content: ''; position: absolute;
  top: -120px; right: -60px;
  width: 320px; height: 320px;
  border: 2px solid color-mix(in oklch, var(--accent-violet) 20%, transparent);
  border-radius: 50%;
  opacity: 0.4;
}
.hero::after {
  content: ''; position: absolute;
  bottom: -80px; left: -40px;
  width: 200px; height: 200px;
  border: 2px solid color-mix(in oklch, var(--accent-teal) 20%, transparent);
  border-radius: 50%;
  opacity: 0.3;
}
.hero-center { text-align: center; max-width: 38ch; margin-inline: auto; position: relative; z-index: 1; }
.hero h1 { margin-bottom: var(--gap-md); }
.hero .lead { margin-bottom: var(--gap-lg); }
.hero-cta { display: inline-flex; gap: var(--gap-sm); flex-wrap: wrap; }
.hero-center .hero-cta { justify-content: center; }

/* ─── Article List ───────────────────────────────────── */
.post-item {
  display: grid; grid-template-columns: 110px 1fr auto;
  gap: var(--gap-lg); padding: 22px 12px;
  border-top: 1px solid var(--border); align-items: baseline;
  transition: background 0.2s; border-radius: var(--radius);
  margin: 0 -12px;
}
.post-item:first-child { border-top: 0; }
.post-item:hover { background: var(--fg-soft); }
.post-item .entry-title { font-size: 19px; margin: 0; }
.post-item .entry-title a:hover { color: var(--accent); }

/* ─── Single Post ────────────────────────────────────── */
.post-single .entry-header { text-align: center; padding-bottom: var(--gap-xl); border-bottom: 1px solid var(--border); margin-bottom: var(--gap-xl); }
.post-single .entry-meta { display: flex; align-items: center; justify-content: center; gap: var(--gap-md); margin-top: var(--gap-md); flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.post-single .entry-content { max-width: 760px; margin: 0 auto; }
.post-single .entry-content p { margin: 0 0 20px; font-size: 17px; }
.post-single .entry-content blockquote {
  margin: 28px 0; padding: 16px 24px;
  border-left: 2px solid var(--accent);
  background: var(--fg-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted); font-size: 16px;
}
.post-single .entry-content h2 { font-size: var(--fs-h2); margin: 32px 0 16px; }
.post-single .entry-content h3 { font-size: var(--fs-h3); margin: 24px 0 8px; }
.post-single .entry-content ul, .post-single .entry-content ol { margin: 0 0 20px; padding-left: 24px; }
.post-single .entry-content li { margin-bottom: 8px; }

/* ─── Forms ──────────────────────────────────────────── */
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="url"], textarea, select {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font: inherit; font-size: 15px;
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 140px; resize: vertical; line-height: 1.6; }

/* ─── Pagination ─────────────────────────────────────── */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: var(--gap-lg); }
.pagination .page {
  display: grid; place-items: center; min-width: 36px; height: 36px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; color: var(--muted);
}
.pagination .page:hover { border-color: var(--fg); color: var(--fg); }
.pagination .page.active, .pagination .current {
  background: var(--fg); color: var(--surface); border-color: var(--fg); font-weight: 600;
}

/* ─── Sidebar Widgets ────────────────────────────────── */
.widget { margin-bottom: var(--gap-lg); }
.widget-title {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 14px;
}
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.widget li:last-child { border-bottom: 0; }
.widget a { font-size: 14px; color: var(--fg); }
.widget a:hover { color: var(--accent); }

/* ─── Comments ───────────────────────────────────────── */
.comments-area { max-width: 760px; margin: 0 auto; }
.comment-list { list-style: none; padding: 0; margin: 0; }
.comment { padding: 20px 0; border-top: 1px solid var(--border); }
.comment:first-child { border-top: 0; }
.comment-author { font-weight: 600; font-size: 15px; }
.comment-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.comment-content p { margin: 0; font-size: 15px; }

/* ─── Breadcrumb ─────────────────────────────────────── */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: var(--gap-md); }
.breadcrumb a:hover { color: var(--fg); }

/* ─── CTA Strip ──────────────────────────────────────── */
.cta-strip { text-align: center; position: relative; }
.cta-strip::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 50% 40% at 30% 0%, color-mix(in oklch, var(--accent-violet) 5%, transparent), transparent 60%),
    radial-gradient(ellipse 40% 30% at 70% 100%, color-mix(in oklch, var(--accent-blue) 4%, transparent), transparent 50%);
  z-index: 0;
}
.cta-strip > * { position: relative; z-index: 1; }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 640px) {
  .post-item { grid-template-columns: 1fr; gap: 4px; }
  .hero { padding-block: clamp(48px, 10vw, 80px); }
  :root { --gutter: 20px; }
}

/* ─── Elementor Integration ──────────────────────────── */
.elementor-section { margin: 0 !important; }

/* Allow Elementor to paint full-width without theme constraints */
.elementor-template-fullwidth .site-main,
.elementor-template-canvas .site-main {
  max-width: 100%; padding: 0;
}
