/*
 * MASAMUNE Static Site — Design System v3.0
 * 2026-03-27
 */

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
  /* Color palette */
  --primary: #003366;
  --primary-dark: #002244;
  --accent: #2F80ED;
  --accent-hover: #1E5AA8;
  --text: #333333;
  --text-light: #555555;
  --text-muted: #6b7280;
  --bg: #ffffff;
  --bg-alt: #F0F4FA;
  --border: #D5DEE9;
  --white: #ffffff;
  --success: #059669;
  --danger: #dc2626;

  /* Typography */
  --font: "Noto Sans JP", "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;

  /* Layout */
  --max-w: 1120px;
  --header-h: 72px;
  --radius: 10px;
  --radius-sm: 6px;
  --pad: clamp(16px, 4vw, 32px);

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-8: 3rem;
  --sp-10: 4rem;
  --sp-12: 5rem;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,51,102,0.08);
  --shadow-md: 0 4px 12px rgba(0,51,102,0.1);
  --shadow-lg: 0 10px 30px rgba(0,51,102,0.12);
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: var(--font); color: var(--text); background: var(--bg); margin: 0; padding: 0; line-height: 1.7; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary); }
h1,h2,h3,h4,h5,h6 { color: var(--primary); margin-top: 0; line-height: 1.3; font-weight: 700; }
p { margin: 0 0 1.25em; }
ul,ol { padding-left: 1.5em; margin: 0 0 1.25em; }
li { margin-bottom: 0.5em; }
table { border-collapse: collapse; width: 100%; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ============================================================
   3. LAYOUT
   ============================================================ */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--pad); width: 100%; }
.section { padding: clamp(48px, 7vw, 80px) 0; }
.section--alt { background: var(--bg-alt); }
.section--dark { background: var(--primary); color: #fff; }
.section--dark h2 { color: #fff; }
.section--dark p { color: rgba(255,255,255,0.85); }
.section-header { text-align: center; max-width: 700px; margin: 0 auto var(--sp-10); }
.section-title { font-size: clamp(1.6rem, 2.4vw, 2.25rem); margin-bottom: var(--sp-4); }
.section-subtitle { color: var(--text-light); font-size: 1.05rem; margin-bottom: 0; }
.content-wrapper { max-width: var(--max-w); }

/* Page content (non-homepage) */
.page-content { padding: var(--sp-10) 0; }
.page-content h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); margin-bottom: var(--sp-6); }
.page-content h2 { font-size: clamp(1.3rem, 2vw, 1.6rem); margin-top: var(--sp-8); margin-bottom: var(--sp-4); }

/* ============================================================
   4. HEADER & NAV
   ============================================================ */
.site-header { height: var(--header-h); background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; }
.header-inner { display: flex; justify-content: space-between; align-items: center; height: 100%; gap: var(--sp-5); }
.site-title { font-size: 1.4rem; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.site-title a { color: var(--primary); text-decoration: none; }

.main-navigation { display: flex; align-items: center; gap: var(--sp-4); }
.main-navigation > ul { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(1rem, 2vw, 2rem); align-items: center; }
.main-navigation li { position: relative; }
.main-navigation a { color: var(--primary); font-weight: 500; font-size: 0.9rem; text-decoration: none; white-space: nowrap; }
.main-navigation a:hover { color: var(--accent); }
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: var(--sp-2); }

/* Dropdown */
.main-navigation .sub-menu { display: none; position: absolute; top: 100%; left: 0; z-index: 1200; min-width: 220px; padding: var(--sp-3); margin-top: 0; border-radius: var(--radius); background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-lg); list-style: none; }
.main-navigation li.menu-item-has-children::before { content: ''; position: absolute; top: 100%; left: 0; right: 0; height: 12px; background: transparent; z-index: 1199; }
.main-navigation .sub-menu a { display: block; padding: 8px 12px; border-radius: var(--radius-sm); }
.main-navigation .sub-menu a:hover { background: var(--bg-alt); }
.main-navigation li:hover > .sub-menu, .main-navigation li:focus-within > .sub-menu { display: block; }

/* Language switcher */
.lang-switcher { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--border); }
.lang-switcher a { color: var(--text-muted); font-weight: 600; }
.lang-switcher a:hover { color: var(--accent); }
.lang-switcher strong { color: var(--primary); }

/* ============================================================
   5. HERO
   ============================================================ */
.hero-section { padding: clamp(56px, 8vw, 96px) 0; background: var(--white); overflow: hidden; }
.hero-container { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 64px); align-items: center; }
.hero-title { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.2; margin-bottom: var(--sp-5); letter-spacing: -0.02em; }
.hero-title .highlight { color: var(--accent); }
.hero-description { font-size: clamp(1rem, 1.2vw, 1.1rem); color: var(--text-light); margin-bottom: var(--sp-6); }
.hero-buttons { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.hero-visual { height: 360px; border-radius: var(--radius); border: 1px solid var(--border); background: radial-gradient(600px 280px at 20% 20%, rgba(47,128,237,0.18), transparent 60%), radial-gradient(520px 240px at 80% 60%, rgba(0,51,102,0.18), transparent 60%), linear-gradient(135deg, #ffffff 0%, var(--bg-alt) 100%); box-shadow: var(--shadow-lg); }

/* ============================================================
   6. BUTTONS
   ============================================================ */
.btn { display: inline-block; padding: 0.75rem 1.75rem; border-radius: var(--radius-sm); font-weight: 700; font-size: 0.95rem; text-align: center; transition: all 0.2s ease; text-decoration: none !important; cursor: pointer; border: 2px solid transparent; }
.btn-primary { background: var(--accent); color: #fff !important; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary) !important; }
.btn-outline:hover { background: var(--primary); color: #fff !important; }
.btn-white { background: #fff; color: var(--primary) !important; border-color: #fff; }
.btn-white:hover { background: var(--bg-alt); }
.btn-outline-white { background: transparent; border-color: rgba(255,255,255,0.5); color: #fff !important; }
.btn-outline-white:hover { background: rgba(255,255,255,0.1); border-color: #fff; }
.btn-sm { padding: 0.5rem 1.25rem; font-size: 0.85rem; }
.btn-full { width: 100%; }

/* ============================================================
   7. CARDS (unified)
   ============================================================ */
.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); margin: var(--sp-6) 0; }
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-6); background: var(--white); display: flex; flex-direction: column; transition: box-shadow 0.2s, transform 0.2s; }
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card h3 { font-size: 1.1rem; margin-bottom: var(--sp-3); }
.card p { color: var(--text-light); font-size: 0.95rem; margin-bottom: var(--sp-4); flex-grow: 1; }
.card .card-link { font-weight: 700; font-size: 0.9rem; margin-top: auto; }
.card .card-icon { font-size: 2.4rem; line-height: 1; margin-bottom: var(--sp-3); }
.card--center { text-align: center; align-items: center; }

/* Feature cards (numbered) */
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); }
.feature-card { background: #fff; padding: var(--sp-6); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); transition: transform 0.2s, box-shadow 0.2s; }
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.feature-icon { font-size: 2rem; margin-bottom: var(--sp-5); color: var(--accent); font-weight: 800; }

/* Pricing cards */
.pricing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-5); margin: var(--sp-6) 0; }
.pricing-card { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-6); background: var(--white); display: flex; flex-direction: column; }
.pricing-card--accent { border-top: 3px solid var(--accent); }
.pricing-card h3 { font-size: 1.15rem; margin-bottom: var(--sp-3); }
.pricing-price { font-size: 1.8rem; font-weight: 800; color: var(--accent); margin-bottom: var(--sp-4); }
.pricing-price span { font-size: 0.9rem; font-weight: 400; color: var(--text-muted); }
.pricing-card ul { font-size: 0.9rem; padding-left: 1.2em; margin-bottom: var(--sp-5); flex-grow: 1; }
.pricing-card li { margin-bottom: 0.4em; }

/* ============================================================
   8. CTA SECTIONS
   ============================================================ */
.cta-box { margin-top: var(--sp-8); padding: var(--sp-6); border-radius: var(--radius); background: var(--bg-alt); border: 1px solid var(--border); }
.cta-box strong { display: block; margin-bottom: var(--sp-3); }

/* Dark CTA (inline section) */
.imei-box { background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%); border-radius: 14px; padding: var(--sp-6) var(--sp-6); margin: var(--sp-6) 0; color: #fff; }
.imei-box-title { font-size: 1.3rem; font-weight: 700; color: #fff; margin: 0 0 var(--sp-3); }
.imei-box-desc { font-size: 0.95rem; color: rgba(255,255,255,0.9); line-height: 1.75; margin: 0 0 var(--sp-4); }
.imei-btn { display: inline-block; background: #fff; color: #1e3a8a !important; font-weight: 700; padding: 0.65rem 1.75rem; border-radius: 8px; text-decoration: none !important; }
.imei-btn:hover { background: #dbeafe; }

/* ============================================================
   9. TABLES
   ============================================================ */
/* Base table styles */
table { border-collapse: collapse; width: 100%; margin: var(--sp-5) 0; }
table th, table td { padding: 12px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }

/* Comparison table (feature matrices: ✅/❌ centered, text left) */
.compare-table { margin: var(--sp-6) 0; font-size: 0.9rem; }
.compare-table thead { background: var(--bg-alt); }
.compare-table thead th { text-align: center; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.02em; }
.compare-table thead th:first-child { text-align: left; }
.compare-table td { text-align: left; }
/* Only center cells that contain short content (✅/❌/—) — use .text-center on td or data-center class */
.compare-table td[data-center], .compare-table .tc { text-align: center; }
/* For feature comparison tables where all non-first cells are icons */
.compare-table--icons td:not(:first-child) { text-align: center; }

/* Zebra striping for readability */
.compare-table tbody tr:nth-child(even) { background: rgba(0,0,0,0.015); }
.compare-table tbody tr:hover { background: rgba(47,128,237,0.04); }

/* ============================================================
   10. FORMS
   ============================================================ */
.form-group { margin-bottom: var(--sp-5); }
.form-label { display: block; font-weight: 600; margin-bottom: var(--sp-2); font-size: 0.95rem; }
.form-label .badge-required { display: inline-block; font-size: 0.7rem; color: #fff; background: var(--danger); padding: 1px 6px; border-radius: 3px; margin-left: 6px; font-weight: 500; }
.form-label .badge-optional { display: inline-block; font-size: 0.7rem; color: var(--text-muted); border: 1px solid var(--border); padding: 1px 6px; border-radius: 3px; margin-left: 6px; font-weight: 400; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.95rem; font-family: inherit; background: #fff; color: var(--text); transition: border-color 0.15s, box-shadow 0.15s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,128,237,0.12); }
.form-textarea { min-height: 140px; resize: vertical; }
.form-privacy { text-align: center; font-size: 0.8rem; color: var(--text-muted); margin-top: var(--sp-3); }

/* ============================================================
   11. DATA TABLE (about, etc.)
   ============================================================ */
.info-table { margin: var(--sp-5) 0; }
.info-table th { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); width: 200px; background: var(--bg-alt); font-weight: 600; font-size: 0.9rem; }
.info-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.95rem; }

/* ============================================================
   12. FOOTER
   ============================================================ */
.site-footer { background: var(--primary-dark); color: rgba(255,255,255,0.7); padding: var(--sp-8) 0 var(--sp-6); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-6); margin-bottom: var(--sp-6); }
.footer-col h4 { color: #fff; font-size: 0.95rem; margin-bottom: var(--sp-4); }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: var(--sp-2); }
.footer-col a { color: rgba(255,255,255,0.65); font-size: 0.88rem; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); padding-top: var(--sp-5); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--sp-4); font-size: 0.85rem; }
.footer-bottom p { margin: 0; }
.footer-bottom a { color: rgba(255,255,255,0.65); }

/* ============================================================
   12b. FAQ ITEMS
   ============================================================ */
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 0.75rem; transition: border-color 0.2s; }
.faq-item:hover { border-color: var(--accent); }
.faq-item summary { font-weight: 700; cursor: pointer; padding: 4px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); }
.faq-item summary::after { content: "+"; font-size: 1.2rem; color: var(--text-muted); flex-shrink: 0; transition: transform 0.2s; }
.faq-item[open] summary::after { content: "−"; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p, .faq-item ul, .faq-item ol { margin-top: 0.75rem; color: var(--text-light); line-height: 1.8; }
.faq-item a { color: var(--accent); }

/* ============================================================
   12c. CTA BOX FIXES
   ============================================================ */
.cta-box .btn { margin-top: 0.75rem; }
.cta-box p { margin-bottom: 0.5rem; }

/* ============================================================
   12d. CARD BUTTON ALIGNMENT
   ============================================================ */
.card .btn { margin-top: auto; align-self: flex-start; }
.card--center .btn { align-self: center; }

/* ============================================================
   12e. HERO ON SUBPAGES (inline style override)
   ============================================================ */
.page-hero { padding: clamp(40px, 6vw, 72px) 0; text-align: center; }
.page-hero h1 { color: #fff; margin-bottom: var(--sp-4); font-size: clamp(1.6rem, 3vw, 2.5rem); }
.page-hero p { color: rgba(255,255,255,0.85); max-width: 700px; margin: 0 auto; }

/* ============================================================
   13. UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.max-w-form { max-width: 700px; margin-left: auto; margin-right: auto; }

/* ============================================================
   14. RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   14a. TABLET (max-width: 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   14b. MOBILE (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {
  :root { --header-h: 60px; }

  /* Layout */
  .hero-container { grid-template-columns: 1fr; text-align: center; gap: var(--sp-6); }
  .hero-buttons { justify-content: center; flex-wrap: wrap; }
  .hero-visual { height: 180px; }
  .hero-title { font-size: clamp(1.6rem, 5vw, 2.2rem); }
  .hero-description { font-size: 0.95rem; }

  /* Grids to single column */
  .cards-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }

  /* Footer */
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-bottom { flex-direction: column; text-align: center; }

  /* Mobile navigation */
  .main-navigation > ul {
    display: none;
  }
  .main-navigation.is-open > ul {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: absolute;
    top: var(--header-h);
    right: var(--pad);
    left: var(--pad);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4);
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    max-height: 80vh;
    overflow-y: auto;
  }
  .main-navigation.is-open > ul > li {
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
  }
  .main-navigation.is-open > ul > li:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  .main-navigation.is-open > ul a {
    font-size: 1rem;
    padding: 6px 0;
    display: block;
  }

  /* Mobile submenu: show inline */
  .main-navigation .sub-menu {
    position: static;
    display: block;
    border: 0;
    box-shadow: none;
    padding: 4px 0 0 16px;
    background: transparent;
    min-width: auto;
  }
  .main-navigation .sub-menu a {
    font-size: 0.9rem;
    color: var(--text-light);
    padding: 4px 0;
  }
  .main-navigation li.menu-item-has-children::before {
    display: none;
  }

  /* Hamburger button */
  .menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: var(--sp-2);
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }
  .menu-toggle .icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
  }

  /* Language switcher on mobile */
  .lang-switcher {
    border-left: none;
    margin-left: 8px;
    padding-left: 8px;
  }

  /* Tables: horizontal scroll */
  .compare-table { font-size: 0.8rem; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .compare-table th, .compare-table td { padding: 8px 10px; white-space: nowrap; }

  /* Info tables: stack */
  .info-table th, .info-table td { display: block; width: 100%; }
  .info-table th { border-bottom: none; padding-bottom: 4px; }

  /* Section padding */
  .section { padding: clamp(32px, 5vw, 56px) 0; }
  .page-content { padding: var(--sp-6) 0; }
  .page-content h1 { font-size: clamp(1.5rem, 4vw, 2rem); }

  /* CTA box */
  .cta-box { padding: var(--sp-4); }

  /* Pricing cards */
  .pricing-card { padding: var(--sp-4); }
  .pricing-price { font-size: 1.5rem; }

  /* IMEI box */
  .imei-box { padding: var(--sp-4); }

  /* Buttons full width on small screens */
  .hero-buttons .btn { min-width: 140px; text-align: center; }
}

/* ============================================================
   14c. SMALL MOBILE (max-width: 480px)
   ============================================================ */
@media (max-width: 480px) {
  .hero-title { font-size: 1.5rem; }
  .hero-visual { height: 140px; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-buttons { flex-direction: column; align-items: center; }
  .hero-buttons .btn { width: 100%; }
  .section-title { font-size: 1.3rem; }
}
