/*
Theme Name: HomeRepair Premium
Theme URI: https://homerepair.toothvia.com
Description: Premium child theme for home repair guide
Author: ROBOTION
Template: twentytwentyfive
Version: 1.0.0
Text Domain: homerepair
*/

:root {
  --c-primary: #1B3A5C;
  --c-primary-light: #264D78;
  --c-primary-dark: #122740;
  --c-accent: #C27A3A;
  --c-accent-light: #D4944F;
  --c-accent-hover: #A8652E;
  --c-bg: #F8F9FB;
  --c-surface: #FFFFFF;
  --c-text: #1F2937;
  --c-text-muted: #6B7280;
  --c-text-light: #9CA3AF;
  --c-border: #E5E7EB;
  --c-border-light: #F3F4F6;
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-xl: 28px;
  --s-xs: 4px;
  --s-sm: 8px;
  --s-md: 16px;
  --s-lg: 24px;
  --s-xl: 32px;
  --s-2xl: 48px;
  --s-3xl: 64px;
  --s-4xl: 96px;
  --s-5xl: 128px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.1);
  --shadow-xl: 0 16px 48px rgba(0,0,0,.12);
  --font: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Noto Sans KR', sans-serif;
  --max-w: 1200px;
  --content-w: 780px;
  --transition: 200ms cubic-bezier(.4,0,.2,1);
}

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

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

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.75;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--c-accent); }
a:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; border-radius: var(--r-sm); }

.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--s-lg); }
.content-wrap { max-width: var(--content-w); margin: 0 auto; padding: 0 var(--s-lg); }

/* ===== HEADER ===== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
  transition: box-shadow var(--transition);
}
.site-header.scrolled { box-shadow: var(--shadow-md); }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}
.site-logo { display: flex; align-items: center; gap: var(--s-md); text-decoration: none; }
.site-logo svg { width: 40px; height: 40px; flex-shrink: 0; }
.site-logo-text {
  font-size: 1.125rem; font-weight: 700; color: var(--c-primary);
  letter-spacing: -0.02em; line-height: 1.3;
}
.site-logo-text small {
  display: block; font-size: 0.7rem; font-weight: 400; color: var(--c-text-muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}

.main-nav { display: flex; align-items: center; gap: var(--s-xl); }
.main-nav a {
  font-size: 0.9375rem; font-weight: 500; color: var(--c-text);
  padding: var(--s-sm) 0; position: relative;
  transition: color var(--transition);
}
.main-nav a::after {
  content: ''; position: absolute; bottom: 0; left: 0;
  width: 0; height: 2px; background: var(--c-accent);
  transition: width var(--transition);
}
.main-nav a:hover { color: var(--c-accent); }
.main-nav a:hover::after { width: 100%; }

.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  width: 44px; height: 44px; align-items: center; justify-content: center;
}
.nav-toggle svg { width: 24px; height: 24px; color: var(--c-text); }

@media (max-width: 768px) {
  .site-header .wrap { height: 60px; }
  .main-nav {
    position: fixed; top: 60px; left: 0; right: 0; bottom: 0;
    flex-direction: column; background: var(--c-surface);
    padding: var(--s-2xl) var(--s-lg); gap: var(--s-lg);
    transform: translateX(100%); transition: transform 300ms ease;
    z-index: 99;
  }
  .main-nav.open { transform: translateX(0); }
  .main-nav a { font-size: 1.125rem; }
  .nav-toggle { display: flex; }
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.35; letter-spacing: -0.02em; color: var(--c-primary); }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.625rem; margin-top: var(--s-3xl); margin-bottom: var(--s-lg); padding-bottom: var(--s-md); border-bottom: 2px solid var(--c-border-light); }
h3 { font-size: 1.25rem; margin-top: var(--s-2xl); margin-bottom: var(--s-md); color: var(--c-primary-light); }
h2::before { content: ''; display: inline-block; width: 4px; height: 1em; background: var(--c-accent); border-radius: 2px; margin-right: var(--s-sm); vertical-align: middle; }

p { margin-bottom: var(--s-lg); line-height: 1.8; }

/* ===== ARTICLE ===== */
.article-hero {
  position: relative; width: 100%; aspect-ratio: 21/9; overflow: hidden;
  border-radius: 0 0 var(--r-lg) var(--r-lg); margin-bottom: var(--s-3xl);
}
.article-hero img {
  width: 100%; height: 100%; object-fit: cover;
}
.article-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(27,58,92,.7) 0%, transparent 60%);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: var(--s-2xl) var(--s-lg);
}
.article-hero-overlay h1 {
  color: #fff; font-size: 2rem; max-width: var(--content-w); margin: 0 auto; width: 100%;
}
.article-meta {
  max-width: var(--content-w); margin: 0 auto var(--s-xl);
  display: flex; align-items: center; gap: var(--s-md);
  font-size: 0.875rem; color: var(--c-text-muted);
  padding: 0 var(--s-lg);
}
.article-meta .cat {
  background: var(--c-primary); color: #fff; padding: 2px 12px;
  border-radius: 100px; font-size: 0.8125rem; font-weight: 500;
}

.article-body {
  max-width: var(--content-w); margin: 0 auto;
  padding: 0 var(--s-lg); font-size: 1.0625rem; line-height: 1.8;
}
.article-body img {
  border-radius: var(--r-md); margin: var(--s-xl) 0;
  box-shadow: var(--shadow-sm);
}
.article-body figure { margin: var(--s-2xl) 0; }
.article-body figcaption {
  text-align: center; font-size: 0.875rem; color: var(--c-text-muted);
  margin-top: var(--s-sm);
}

/* Tables */
.article-body table, .styled-table {
  width: 100%; border-collapse: collapse; margin: var(--s-xl) 0;
  font-size: 0.9375rem; border-radius: var(--r-md); overflow: hidden;
  box-shadow: var(--shadow-sm); border: 1px solid var(--c-border);
}
.article-body thead th, .styled-table thead th {
  background: var(--c-primary); color: #fff; padding: 14px 16px;
  text-align: left; font-weight: 600; font-size: 0.875rem;
  letter-spacing: 0.02em;
}
.article-body tbody td, .styled-table tbody td {
  padding: 12px 16px; border-bottom: 1px solid var(--c-border-light);
  vertical-align: top;
}
.article-body tbody tr:nth-child(even), .styled-table tbody tr:nth-child(even) { background: #FAFBFC; }
.article-body tbody tr:hover, .styled-table tbody tr:hover { background: #F0F4F8; }

@media (max-width: 640px) {
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: var(--s-xl) calc(var(--s-lg) * -1); padding: 0 var(--s-lg); }
  .table-responsive table { min-width: 540px; }
}

/* Lists */
.article-body ul, .article-body ol { margin: var(--s-md) 0 var(--s-xl) var(--s-lg); }
.article-body li { margin-bottom: var(--s-sm); padding-left: var(--s-xs); }
.article-body ul li::marker { color: var(--c-accent); }
.article-body ol li::marker { color: var(--c-primary); font-weight: 600; }

/* Blockquote / Callout */
.article-body blockquote, .callout {
  background: linear-gradient(135deg, #F0F4FA 0%, #F8FAFC 100%);
  border-left: 4px solid var(--c-accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--s-lg) var(--s-xl);
  margin: var(--s-xl) 0;
  font-size: 1rem; color: var(--c-text);
}
.article-body blockquote p:last-child { margin-bottom: 0; }

.tip-box {
  background: #FFF8F0; border: 1px solid #F0D4B0; border-left: 4px solid var(--c-accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--s-lg) var(--s-xl); margin: var(--s-xl) 0;
}
.tip-box strong { color: var(--c-accent); }

.info-box {
  background: #F0F4FA; border: 1px solid #C8D6E8; border-left: 4px solid var(--c-primary);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--s-lg) var(--s-xl); margin: var(--s-xl) 0;
}

/* Bar Chart */
.bar-chart { margin: var(--s-xl) 0; }
.bar-chart-item { display: flex; align-items: center; gap: var(--s-md); margin-bottom: var(--s-md); }
.bar-chart-label { flex: 0 0 120px; font-size: 0.875rem; font-weight: 500; text-align: right; }
.bar-chart-track { flex: 1; height: 28px; background: var(--c-border-light); border-radius: 14px; overflow: hidden; position: relative; }
.bar-chart-fill {
  height: 100%; border-radius: 14px; background: linear-gradient(90deg, var(--c-primary), var(--c-primary-light));
  display: flex; align-items: center; justify-content: flex-end; padding-right: var(--s-md);
  font-size: 0.8125rem; color: #fff; font-weight: 600;
  transition: width 800ms cubic-bezier(.4,0,.2,1);
}
.bar-chart-fill.accent { background: linear-gradient(90deg, var(--c-accent), var(--c-accent-light)); }

/* Step Diagram */
.step-diagram { display: flex; gap: var(--s-md); margin: var(--s-xl) 0; flex-wrap: wrap; justify-content: center; }
.step-item {
  flex: 1; min-width: 140px; text-align: center; position: relative;
  padding: var(--s-lg) var(--s-md);
}
.step-num {
  width: 40px; height: 40px; border-radius: 50%; background: var(--c-primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; margin: 0 auto var(--s-sm);
}
.step-title { font-size: 0.875rem; font-weight: 600; color: var(--c-primary); margin-bottom: var(--s-xs); }
.step-desc { font-size: 0.8125rem; color: var(--c-text-muted); }
.step-item:not(:last-child)::after {
  content: ''; position: absolute; top: 36px; right: -12px;
  width: 20px; height: 2px; background: var(--c-border);
}
@media (max-width: 640px) {
  .step-diagram { flex-direction: column; gap: var(--s-sm); }
  .step-item:not(:last-child)::after { display: none; }
  .step-item {
    display: flex; align-items: center; gap: var(--s-md); text-align: left;
    padding: var(--s-md);
    background: var(--c-surface); border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  }
  .step-num { margin: 0; flex-shrink: 0; }
}

/* ===== CARDS ===== */
.post-card {
  background: var(--c-surface); border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); border: 1px solid var(--c-border-light);
  transition: transform var(--transition), box-shadow var(--transition);
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.post-card-img { aspect-ratio: 16/10; overflow: hidden; }
.post-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms ease; }
.post-card:hover .post-card-img img { transform: scale(1.04); }
.post-card-body { padding: var(--s-lg); }
.post-card-body h3 {
  font-size: 1.0625rem; margin: 0 0 var(--s-sm); color: var(--c-text);
  line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-body h3::before { display: none; }
.post-card-body p {
  font-size: 0.875rem; color: var(--c-text-muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: var(--s-md);
}
.post-card-body .read-more {
  font-size: 0.8125rem; font-weight: 600; color: var(--c-accent);
  display: inline-flex; align-items: center; gap: var(--s-xs);
}

.posts-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-xl);
}
@media (max-width: 900px) { .posts-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .posts-grid { grid-template-columns: 1fr; } }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--c-primary-dark); color: rgba(255,255,255,.8);
  padding: var(--s-3xl) 0 var(--s-xl); margin-top: var(--s-5xl);
}
.footer-top { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--s-2xl); margin-bottom: var(--s-2xl); }
.footer-brand .site-logo-text { color: #fff; font-size: 1.25rem; margin-bottom: var(--s-md); }
.footer-brand .site-logo-text small { color: rgba(255,255,255,.5); }
.footer-brand p { font-size: 0.875rem; color: rgba(255,255,255,.6); line-height: 1.7; max-width: 360px; }
.footer-links h4 { color: #fff; font-size: 0.9375rem; margin-bottom: var(--s-md); font-weight: 600; }
.footer-links h4::before { display: none; }
.footer-links ul { list-style: none; }
.footer-links li { margin-bottom: var(--s-sm); }
.footer-links a { color: rgba(255,255,255,.6); font-size: 0.875rem; }
.footer-links a:hover { color: var(--c-accent-light); }

.footer-legal {
  border-top: 1px solid rgba(255,255,255,.1); padding-top: var(--s-xl);
  font-size: 0.8rem; color: rgba(255,255,255,.4); line-height: 1.8;
}
.footer-legal p { margin-bottom: var(--s-sm); }
.footer-copyright { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--s-md); margin-top: var(--s-lg); }
.footer-copyright p { margin: 0; }

@media (max-width: 768px) {
  .footer-top { grid-template-columns: 1fr; gap: var(--s-xl); }
  .footer-copyright { flex-direction: column; text-align: center; }
}

/* ===== PAGE ===== */
.page-header { padding: var(--s-3xl) 0 var(--s-2xl); text-align: center; }
.page-header h1 { margin-bottom: var(--s-md); }
.page-body { max-width: var(--content-w); margin: 0 auto; padding: 0 var(--s-lg) var(--s-3xl); }

/* ===== RELATED POSTS ===== */
.related-posts { margin-top: var(--s-3xl); padding-top: var(--s-2xl); border-top: 1px solid var(--c-border); }
.related-posts h2 { text-align: center; border-bottom: none; }
.related-posts h2::before { display: none; }

/* ===== TOC ===== */
.toc-box {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); padding: var(--s-lg) var(--s-xl);
  margin-bottom: var(--s-2xl);
}
.toc-box h4 { font-size: 0.9375rem; color: var(--c-primary); margin-bottom: var(--s-md); }
.toc-box h4::before { display: none; }
.toc-box ol { margin: 0; padding-left: var(--s-lg); }
.toc-box li { margin-bottom: var(--s-xs); font-size: 0.9375rem; }
.toc-box a { color: var(--c-text-muted); }
.toc-box a:hover { color: var(--c-accent); }

/* ===== LEGAL NOTICES ===== */
.legal-notice { font-size: 0.85em !important; color: #777 !important; }
.ai-notice { font-size: 0.85em; color: #888; margin-top: 2em; }
.affiliate-notice { font-size: 0.9em; color: #666; background: #fffbea; border: 1px solid #f6e05e; padding: 8px 12px; border-radius: 6px; }

/* ===== ANIMATIONS ===== */
@media (prefers-reduced-motion: no-preference) {
  .fade-up {
    opacity: 0; transform: translateY(20px);
    transition: opacity 500ms ease, transform 500ms ease;
  }
  .fade-up.visible { opacity: 1; transform: translateY(0); }
}

/* ===== ARCHIVE / INDEX ===== */
.archive-header { padding: var(--s-3xl) 0 var(--s-xl); }
.archive-header h1 { font-size: 1.75rem; }

/* Remove WP block theme defaults that leak through */
body .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) { max-width: none; margin-left: auto; margin-right: auto; }
.wp-site-blocks { padding-top: 0; }

/* ===== SUMMARY BOX ===== */
.summary-box {
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-light) 100%);
  color: #fff; border-radius: var(--r-lg); padding: var(--s-xl) var(--s-2xl);
  margin-bottom: var(--s-2xl);
}
.summary-box h4 { color: rgba(255,255,255,.8); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: var(--s-sm); }
.summary-box h4::before { display: none; }
.summary-box ul { list-style: none; margin: 0; padding: 0; }
.summary-box li { padding: var(--s-xs) 0; font-size: 0.9375rem; padding-left: var(--s-lg); position: relative; }
.summary-box li::before { content: ''; position: absolute; left: 0; top: 12px; width: 6px; height: 6px; background: var(--c-accent-light); border-radius: 50%; }

/* ===== PRINT ===== */
@media print {
  .site-header, .site-footer, .nav-toggle, .toc-box, .related-posts { display: none; }
  body { color: #000; background: #fff; }
}
