/* =================================================================
   楠システム技研 - メインスタイルシート
   ================================================================= */

/* ------------------------------
   Global Theme Variables
------------------------------ */
:root {
  --bg: #0b1020;           /* 背景濃紺 */
  --panel: #111731;        /* パネル色 */
  --text: #e8ecf3;         /* 文字色 */
  --muted: #a7b0c3;        /* 補助文字 */
  --accent: #5aa7ff;       /* アクセント */
  --accent-2: #75e0a9;     /* サブアクセント */
  --warn: #ffd166;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.25);
  --maxw: 1100px;
}

/* ------------------------------
   Base Styles & Reset
------------------------------ */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  line-height: 1.75;
  font-feature-settings: "liga" 1, "kern" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Fallback styles for pages where external CSS might not load */
.fallback-styles {
  background: #0b1020 !important;
  color: #e8ecf3 !important;
  font-family: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif !important;
  line-height: 1.75 !important;
  margin: 0 !important;
  padding: 0 !important;
  font-feature-settings: "liga" 1, "kern" 1 !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 0 20px;
}

/* ------------------------------
   Header & Navigation
------------------------------ */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, rgba(11,16,32,.98), rgba(11,16,32,.90));
  backdrop-filter: saturate(120%) blur(10px);
  -webkit-backdrop-filter: saturate(120%) blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.brand-logo:hover {
  transform: scale(1.1);
  filter: brightness(1.1);
}

/* Remove previous SVG-specific animations */

nav ul {
  display: flex;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav a {
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.nav a:hover {
  color: var(--accent);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hamburger:hover {
  background: rgba(255,255,255,.15);
  border-color: var(--accent);
}

.hamburger span {
  width: 26px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: all 0.2s ease;
}

/* Mobile Navigation */
@media (max-width: 840px) {
  nav ul {
    display: none;
  }
  
  .hamburger {
    display: flex;
  }
  
  .brand-logo {
    width: 28px;
    height: 28px;
  }
}

/* Mobile Drawer */
.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(320px, 85%);
  /* 複数のフォールバック背景色 */
  background-color: #111731 !important;
  background: #111731;
  background: linear-gradient(180deg, #111731, #0e1629);
  background: linear-gradient(180deg, var(--panel), #0e1629);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  translate: 100% 0;
  transition: translate .25s ease;
  box-shadow: 0 20px 50px rgba(0,0,0,.6);
  padding: 24px;
  border-left: 1px solid rgba(255,255,255,.1);
  z-index: 1000;
  /* 追加の背景確保 */
  border: 1px solid rgba(255,255,255,.05);
}

.drawer.open {
  translate: 0 0;
}

/* メニューオーバーレイ */
.drawer::before {
  content: '';
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,.5) !important;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: -1;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}

.drawer.open::before {
  opacity: 1;
  pointer-events: auto;
}

/* ドロワーヘッダー */
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 2px solid rgba(255,255,255,.1);
}

.drawer-header h3 {
  margin: 0;
  color: var(--accent);
  color: #5aa7ff;
  font-size: 18px;
  font-weight: 700;
}

.close-btn {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: var(--text);
  color: #e8ecf3;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(255,100,100,.2);
  border-color: rgba(255,100,100,.4);
}

.drawer a {
  display: block;
  padding: 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: var(--text);
  color: #e8ecf3;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: all 0.2s ease;
  background: rgba(255,255,255,.02);
  margin: 4px 0;
  border-radius: 8px;
}

.drawer a:hover {
  color: var(--accent);
  color: #5aa7ff;
  background: rgba(90,167,255,.15) !important;
  padding-left: 20px;
  transform: translateX(4px);
}

/* ------------------------------
   Hero Section
------------------------------ */
.hero {
  padding: 80px 0;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(90,167,255,.15), transparent 60%),
    radial-gradient(900px 400px at 90% -10%, rgba(117,224,169,.12), transparent 60%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 36px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  font-size: 12px;
}

.title {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.25;
  margin: 12px 0 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lead {
  color: var(--muted);
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 400;
}

.cta {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,.12);
  background: transparent;
  color: var(--text);
  transition: .2s;
  cursor: pointer;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #7cc2ff);
  color: #081221;
  border: none;
  box-shadow: 0 8px 22px rgba(90,167,255,.35);
}

.btn.primary:hover {
  filter: brightness(1.03);
}

.btn.secondary:hover {
  background: rgba(255,255,255,.06);
}

.hero-card {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ------------------------------
   Common Section Styles
------------------------------ */
section {
  padding: 72px 0;
  border-top: 1px solid rgba(255,255,255,.06);
}

.sec-title {
  font-size: 24px;
  margin: 0 0 18px;
}

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

/* ------------------------------
   Services Section
------------------------------ */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.card {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  padding: 20px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.price {
  font-weight: 800;
  font-size: 20px;
}

@media (max-width: 960px) {
  .cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .cards {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------
   Works/Portfolio Section
------------------------------ */
.works {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.work {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
}

.work img {
  display: block;
}

.work figcaption {
  position: absolute;
  inset: auto 0 0 0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.6));
  padding: 10px 12px;
  font-weight: 700;
}

@media (max-width: 960px) {
  .works {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .works {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------
   About Section
------------------------------ */
.about {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 840px) {
  .about {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------
   FAQ Section
------------------------------ */
details {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
}

details + details {
  margin-top: 10px;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

/* ------------------------------
   Contact Form Styles
------------------------------ */
form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
}

input, textarea, select {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: #0e142a;
  color: var(--text);
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
}

.note {
  font-size: 12px;
  color: var(--muted);
}

/* Contact Form Steps */
.contact-step {
  display: none;
}

.contact-step.active {
  display: block;
}

.step-indicator {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  justify-content: center;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(255,255,255,.05);
  color: var(--muted);
  font-size: 14px;
}

.step.active {
  background: var(--accent);
  color: #081221;
}

.step.completed {
  background: var(--accent-2);
  color: #081221;
}

.confirm-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.confirm-label {
  font-weight: 700;
  color: var(--accent);
}

.confirm-value {
  color: var(--text);
}

.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.loading {
  display: none;
  text-align: center;
  padding: 20px;
}

.loading.show {
  display: block;
}

.success-message {
  background: linear-gradient(135deg, var(--accent-2), #5cc77a);
  color: #081221;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  font-weight: 700;
}

/* Loading Animation */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ------------------------------
   Footer
------------------------------ */
footer {
  padding: 40px 0;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ------------------------------
   Page-specific Styles (tokutei, privacy)
------------------------------ */
/* Legal pages layout with card-style background */
.legal-page main {
  padding: 40px 0 60px;
}

.legal-content {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin: 24px 0;
}

/* Mobile adjustments for legal pages */
@media (max-width: 768px) {
  .legal-content {
    padding: 24px 16px;
    border-radius: 12px;
    margin: 16px 0;
  }
  
  .legal-page main {
    padding: 24px 0 40px;
  }
}

/* tokutei.htmlページ特有のスタイル */
.page-title {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.25;
  margin: 0 0 8px;
  font-weight: 800;
  color: var(--text);
  text-align: center;
}

.content {
  color: var(--text);
  line-height: 1.6;
}

/* Table layout for tokutei page */
.table {
  display: grid;
  gap: 20px;
  margin: 24px 0;
}

.row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  align-items: start;
}

.row:last-child {
  border-bottom: none;
}

.label {
  font-weight: 700;
  color: var(--accent);
  font-size: 16px;
}

.value {
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
}

.value a {
  color: var(--accent);
  text-decoration: none;
}

.value a:hover {
  text-decoration: underline;
}

/* 明示的にmainセクションにパディングを適用 */
main {
  padding: 40px 0;
}

/* フッターのスタイルを確実に適用 */
footer {
  padding: 40px 0;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid rgba(255,255,255,.06);
  background: var(--bg);
}

/* Section layout for privacy page */
.section {
  margin-bottom: 32px;
}

.section:last-child {
  margin-bottom: 0;
}

.section-divider {
  border: none;
  height: 1px;
  background: rgba(255,255,255,.06);
  margin: 24px 0;
}

.section h2 {
  font-size: 20px;
  margin: 0 0 16px;
  color: var(--accent);
  font-weight: 700;
}

.section h3 {
  font-size: 18px;
  margin: 24px 0 12px;
  color: var(--text);
  font-weight: 700;
}

.section p {
  margin: 0 0 12px;
  line-height: 1.7;
  color: var(--text);
}

.section ul {
  margin: 8px 0;
  padding-left: 20px;
  color: var(--text);
}

.section li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.section strong {
  color: var(--text);
  font-weight: 700;
}

/* ------------------------------
   Responsive Design Adjustments
------------------------------ */
@media (max-width: 768px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .confirm-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .btn-group {
    flex-direction: column;
  }
  
  /* Page-specific responsive */
  .row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }
  
  .step-indicator {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .step {
    font-size: 12px;
    padding: 6px 12px;
  }
}