/*
Theme Name: UGC Template Hub
Description: Business template sharing platform - clean Japanese business design.
Version: 2.0
Author: Antigravity
Text Domain: ugc-template-hub
*/

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

:root {
  --navy:       #1e3a5f;
  --navy-dark:  #142a47;
  --blue:       #2563a8;
  --blue-light: #e8f0fa;
  --accent:     #c8102e;
  --gray-50:    #f8f9fb;
  --gray-100:   #f0f2f5;
  --gray-200:   #e4e7ec;
  --gray-400:   #9ca3af;
  --gray-600:   #6b7280;
  --gray-800:   #1f2937;
  --white:      #ffffff;
  --text:       #1f2937;
  --text-sub:   #6b7280;
  --border:     #e4e7ec;
  --radius:     6px;
  --radius-sm:  4px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow:     0 2px 8px rgba(0,0,0,0.10);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.10);
  --transition: all 0.18s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic Pro', 'メイリオ', sans-serif;
  background: var(--white);
  color: var(--text);
  line-height: 1.75;
  font-size: 15px;
}

a { color: var(--blue); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--navy); text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ===== HEADER ===== */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 2px solid var(--navy);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.header-inner {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-logo a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--navy);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.site-logo a:hover { text-decoration: none; color: var(--navy-dark); }

.logo-mark {
  background: var(--navy);
  color: #fff;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

#site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

#site-nav a {
  color: var(--gray-600);
  font-size: 0.88rem;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
}

#site-nav a:hover {
  color: var(--navy);
  background: var(--gray-100);
  text-decoration: none;
}

.btn-nav-login {
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

.btn-nav-primary {
  background: var(--navy) !important;
  color: var(--white) !important;
  font-weight: 600 !important;
}

.btn-nav-primary:hover {
  background: var(--navy-dark) !important;
  color: var(--white) !important;
}

/* ===== LAYOUT ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.section { padding: 64px 24px; }
.section-sm { padding: 40px 24px; }

/* ===== SECTION HEADER ===== */
.section-header { margin-bottom: 36px; }
.section-header.center { text-align: center; }

.section-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
  border-left: 3px solid var(--navy);
  padding-left: 8px;
  margin-bottom: 8px;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.section-desc {
  color: var(--text-sub);
  font-size: 0.92rem;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--navy);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--navy-dark);
  color: var(--white);
}

.btn-outline {
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--navy);
}

.btn-outline:hover {
  background: var(--navy);
  color: var(--white);
}

.btn-ghost {
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--gray-200);
  color: var(--text);
}

.btn-copy {
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid #b8d0f0;
  font-size: 0.82rem;
  padding: 5px 12px;
}

.btn-copy:hover {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

/* ===== HERO ===== */
#hero {
  background: var(--navy);
  color: var(--white);
  padding: 72px 24px 60px;
  border-bottom: 4px solid var(--accent);
}

.hero-inner {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}

.hero-eyecatch {
  display: inline-block;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.9);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 4px 14px;
  border-radius: 2px;
  margin-bottom: 24px;
  border: 1px solid rgba(255,255,255,0.2);
}

.hero-title {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 16px;
  color: var(--white);
}

.hero-sub {
  font-size: 1rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.9;
  margin-bottom: 32px;
}

/* ===== HERO SEARCH ===== */
.hero-search {
  display: flex;
  max-width: 560px;
  margin: 0 auto 40px;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.hero-search input[type="text"] {
  flex: 1;
  border: none;
  outline: none;
  padding: 14px 20px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  min-width: 0;
}

.hero-search input[type="text"]::placeholder {
  color: var(--gray-400);
  font-size: 0.92rem;
}

.hero-search button {
  background: var(--accent);
  color: var(--white);
  border: none;
  padding: 14px 28px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.hero-search button:hover {
  background: #a80d25;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.hero-actions .btn-primary {
  background: var(--white);
  color: var(--navy);
}

.hero-actions .btn-primary:hover {
  background: var(--gray-100);
  color: var(--navy);
}

.hero-actions .btn-outline {
  border-color: rgba(255,255,255,0.5);
  color: var(--white);
  background: transparent;
}

.hero-actions .btn-outline:hover {
  background: rgba(255,255,255,0.1);
  color: var(--white);
}

.hero-stats {
  display: flex;
  gap: 0;
  justify-content: center;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 32px;
}

.hero-stat {
  flex: 1;
  max-width: 160px;
  border-right: 1px solid rgba(255,255,255,0.15);
  padding: 0 24px;
}

.hero-stat:last-child { border-right: none; }

.hero-stat .num {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
  margin-bottom: 4px;
}

.hero-stat .label {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.65);
}

/* ===== FEATURES ===== */
#features { background: var(--gray-50); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.feature-item {
  background: var(--white);
  padding: 28px 24px;
}

.feature-icon-wrap {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.feature-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.feature-desc {
  font-size: 0.85rem;
  color: var(--text-sub);
  line-height: 1.7;
}

/* ===== CATEGORY SECTION ===== */
#categories { background: var(--white); }

.cat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-50);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.88rem;
  padding: 7px 16px;
  border-radius: 2px;
  text-decoration: none;
  transition: var(--transition);
}

.cat-tag:hover {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
  text-decoration: none;
}

.cat-tag .count {
  font-size: 0.75rem;
  color: var(--text-sub);
  background: var(--gray-200);
  padding: 1px 6px;
  border-radius: 10px;
}

.cat-tag:hover .count {
  background: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.8);
}

/* ===== TEMPLATE CARDS ===== */
#latest-templates { background: var(--gray-50); border-top: 1px solid var(--border); }

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.template-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.template-card:hover {
  border-color: var(--navy);
  box-shadow: var(--shadow);
}

.template-card-top {
  padding: 20px;
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.template-cat-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--blue);
  background: var(--blue-light);
  padding: 2px 8px;
  border-radius: 2px;
  margin-bottom: 10px;
}

.template-card h3 {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.5;
}

.template-card h3 a { color: var(--text); text-decoration: none; }
.template-card h3 a:hover { color: var(--navy); text-decoration: underline; }

.template-preview {
  font-size: 0.83rem;
  color: var(--text-sub);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-card-bottom {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gray-50);
}

.template-author {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-sub);
}

.author-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ===== HOW IT WORKS ===== */
#how-it-works { background: var(--white); }

.steps-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  counter-reset: step-counter;
}

.step-item {
  counter-increment: step-counter;
  position: relative;
  padding-left: 0;
  text-align: center;
}

.step-num {
  width: 44px; height: 44px;
  background: var(--navy);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 auto 14px;
}

.step-item h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.step-item p {
  font-size: 0.85rem;
  color: var(--text-sub);
  line-height: 1.7;
}

/* ===== CTA ===== */
#cta-section {
  background: var(--navy);
  padding: 56px 24px;
}

.cta-inner {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.cta-inner h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 12px;
  line-height: 1.5;
}

.cta-inner p {
  color: rgba(255,255,255,0.75);
  font-size: 0.92rem;
  margin-bottom: 28px;
}

.cta-inner .btn-primary {
  background: var(--white);
  color: var(--navy);
}

.cta-inner .btn-primary:hover {
  background: var(--gray-100);
}

/* ===== FOOTER ===== */
#site-footer {
  background: var(--gray-800);
  color: rgba(255,255,255,0.7);
  padding: 48px 24px 28px;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 24px;
}

.footer-brand .logo-text { color: var(--white); font-size: 1rem; font-weight: 700; display: block; margin-bottom: 10px; }
.footer-brand p { font-size: 0.85rem; line-height: 1.8; color: rgba(255,255,255,0.55); }

.footer-col h5 {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { font-size: 0.88rem; color: rgba(255,255,255,0.65); text-decoration: none; transition: var(--transition); }
.footer-col ul li a:hover { color: var(--white); }

.footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
}

/* ===== FORMS ===== */
.page-form-wrap {
  padding: 60px 24px;
  min-height: 80vh;
  background: var(--gray-50);
}

.form-box {
  max-width: 680px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 40px;
}

.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group label .req {
  color: var(--accent);
  margin-left: 3px;
  font-size: 0.78rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 13px;
  font-size: 0.92rem;
  font-family: inherit;
  background: var(--white);
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(30,58,95,0.08);
}

.form-group textarea { resize: vertical; min-height: 200px; line-height: 1.8; }

/* ===== NOTICES ===== */
.notice {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 20px;
  border-left: 4px solid;
}

.notice-success { background: #f0faf4; border-color: #28a745; color: #1d6b31; }
.notice-error   { background: #fef2f2; border-color: var(--accent); color: #9b1c1c; }
.notice-info    { background: var(--blue-light); border-color: var(--blue); color: var(--navy); }

/* ===== SINGLE TEMPLATE ===== */
.single-template-wrap {
  padding: 40px 24px 64px;
  min-height: 80vh;
  background: var(--gray-50);
}

.single-col { max-width: 820px; margin: 0 auto; }

.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--text-sub); text-decoration: none; }
.breadcrumb a:hover { color: var(--navy); text-decoration: underline; }

.template-meta-bar {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 16px;
}

.template-meta-bar h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
  line-height: 1.4;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.83rem;
  color: var(--text-sub);
}

.meta-row .author-link { color: var(--blue); text-decoration: none; }
.meta-row .author-link:hover { text-decoration: underline; }

.template-desc-box {
  background: var(--blue-light);
  border: 1px solid #b8d0f0;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--navy);
  line-height: 1.8;
}

.template-body-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.template-body-header {
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.template-body-header span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-sub);
}

.copy-main-btn {
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: var(--transition);
}

.copy-main-btn:hover { background: var(--navy-dark); }

.template-text-content {
  padding: 28px 28px;
  white-space: pre-wrap;
  font-size: 0.93rem;
  line-height: 2;
  color: var(--text);
}

/* ===== ARCHIVE / LIST ===== */
.archive-wrap {
  min-height: 80vh;
  background: var(--gray-50);
  padding: 40px 24px 64px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.filter-tag {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 0.83rem;
  color: var(--text-sub);
  background: var(--white);
  text-decoration: none;
  transition: var(--transition);
}

.filter-tag:hover, .filter-tag.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
  text-decoration: none;
}

/* ===== MY PAGE ===== */
.mypage-header {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.mypage-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  #site-header { padding: 0 16px; }
  .section { padding: 48px 16px; }
  .footer-inner { grid-template-columns: 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; gap: 4px; }
  .hero-stats { gap: 0; flex-wrap: nowrap; }
  .hero-stat { padding: 0 16px; }
  .hero-stat .num { font-size: 1.4rem; }
  .form-box { padding: 24px 20px; }
  .template-text-content { padding: 20px; }
}

@media (max-width: 480px) {
  #site-nav .btn-nav-login { display: none; }
  .hero-stat:nth-child(3) { display: none; }
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-40 { margin-top: 40px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* Pagination */
.page-numbers {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 32px;
}

.page-numbers a, .page-numbers span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-sub);
  background: var(--white);
  text-decoration: none;
  transition: var(--transition);
}

.page-numbers a:hover { border-color: var(--navy); color: var(--navy); }
.page-numbers .current { background: var(--navy); color: var(--white); border-color: var(--navy); }
