/* ===== リセット & ベース ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f8f8f6;
  --surface:   #ffffff;
  --border:    #e5e5e0;
  --text:      #1a1a1a;
  --text-sub:  #6b6b6b;
  --accent:    #3d6cff;
  --accent-hover: #254de0;
  --radius:    10px;
  --shadow:    0 2px 12px rgba(0,0,0,0.07);
  --font-sans: 'Inter', 'Noto Sans JP', sans-serif;
}

/* ===== ダークテーマ ===== */
[data-theme="dark"] {
  --bg:        #111113;
  --surface:   #1c1c1f;
  --border:    #2e2e33;
  --text:      #e8e8e8;
  --text-sub:  #888890;
  --accent:    #6b8fff;
  --accent-hover: #4f72ff;
  --shadow:    0 2px 16px rgba(0,0,0,0.35);
}

/* ===== テーマ遷移アニメーション ===== */
*, *::before, *::after {
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease,
    box-shadow 0.3s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== ヘッダー ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.site-logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.site-logo:hover { color: var(--accent); }

/* ===== タブバー ===== */
.tab-bar { display: flex; gap: 0.25rem; flex: 1; }

.tab-btn {
  background: none;
  border: none;
  padding: 0.4rem 0.9rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-sub);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.tab-btn:hover  { background: var(--bg); color: var(--text); }
.tab-btn.active { background: var(--bg); color: var(--accent); font-weight: 600; }

/* ===== モバイルメニュー ===== */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  font-size: 1.1rem;
  cursor: pointer;
  margin-left: auto;
}

/* ===== テーマトグルスイッチ ===== */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0;
  flex-shrink: 0;
}

.theme-toggle-track {
  display: inline-block;
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  transition: background 0.3s ease;
}

[data-theme="dark"] .theme-toggle-track {
  background: var(--accent);
}

.theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

[data-theme="dark"] .theme-toggle-thumb {
  transform: translateX(16px);
}

.theme-toggle-icon {
  font-size: 1rem;
  transition: transform 0.4s ease, opacity 0.3s ease;
  display: inline-block;
}

.mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1.5rem;
}
.mobile-menu.open { display: flex; }
.mobile-menu button {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text);
  text-align: left;
  padding: 0.6rem 0;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.mobile-menu button:last-child { border-bottom: none; }

/* ===== メインコンテンツ ===== */
.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
  width: 100%;
}

/* ===== タブパネル ===== */
.tab-panel { display: none; animation: fadeIn 0.2s ease; }
.tab-panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== ページ共通ヘッダー ===== */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.page-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-header p {
  color: var(--text-sub);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

/* ===== ヒーロー ===== */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.5rem 0 3rem;
}
.hero-sub { font-size: 1rem; color: var(--text-sub); margin-bottom: 0.3rem; }
.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 1rem;
}
.hero-desc {
  color: var(--text-sub);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.8;
}
.hero-btns { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hero-badge {
  font-size: 5rem;
  flex-shrink: 0;
  opacity: 0.18;
  user-select: none;
  transition: opacity 0.3s ease;
}

/* ===== ボタン ===== */
.btn {
  display: inline-block;
  padding: 0.55rem 1.3rem;
  border-radius: 7px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

/* ===== ホームカード ===== */
.home-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-icon { font-size: 1.6rem; display: block; margin-bottom: 0.7rem; }
.card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.3rem; }
.card p { font-size: 0.85rem; color: var(--text-sub); }

/* ===== プロフィール ===== */
.profile-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  text-align: center;
  min-width: 200px;
  flex-shrink: 0;
}
.avatar {
  width: 80px;
  height: 80px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 auto 1rem;
}
.profile-card h3 { font-size: 1.1rem; font-weight: 700; }
.profile-tagline { font-size: 0.8rem; color: var(--text-sub); margin-top: 0.3rem; }

.profile-details { flex: 1; }

.info-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: 1rem;
}
.info-block h4 {
  font-size: 0.83rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-sub);
  margin-bottom: 0.7rem;
}
.bio-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.8;
}

.link-list { display: flex; flex-direction: column; gap: 0.5rem; }
.ext-link {
  font-size: 0.88rem;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s;
}
.ext-link:hover { opacity: 0.7; }

/* ===== ガジェット ===== */
.gadget-section { margin-bottom: 2rem; }

.gadget-category {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}

.works-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.work-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  transition: box-shadow 0.15s;
}
.work-card:hover { box-shadow: var(--shadow); }
.work-icon { font-size: 1.6rem; margin-bottom: 0.7rem; }
.work-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.3rem; }
.work-card p { font-size: 0.85rem; color: var(--text-sub); margin-bottom: 0.75rem; }
.work-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.work-tags span {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  color: var(--text-sub);
}

/* スペックテーブル */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.7rem 0;
  font-size: 0.82rem;
}
.spec-table tr {
  border-bottom: 1px solid var(--border);
}
.spec-table tr:last-child {
  border-bottom: none;
}
.spec-table th {
  width: 3.5rem;
  padding: 0.3rem 0.5rem 0.3rem 0;
  text-align: left;
  font-weight: 700;
  color: var(--text-sub);
  white-space: nowrap;
}
.spec-table td {
  padding: 0.3rem 0;
  color: var(--text);
}

/* PC グリッドは3列 */
.pc-grid {
  grid-template-columns: repeat(3, 1fr);
}


/* ===== リンク集（ブログロール） ===== */
.blogroll {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.blogroll-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.3rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.blogroll-card:hover {
  box-shadow: var(--shadow);
  border-color: #c5c5c0;
}

.blogroll-main {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}
.blogroll-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}
.blogroll-url {
  font-size: 0.78rem;
  color: var(--text-sub);
}
.blogroll-desc {
  font-size: 0.85rem;
  color: var(--text-sub);
}


/* ===== モーダル (外部リンク警告) ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-content h3 {
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
  color: var(--text);
}
.modal-content p {
  font-size: 0.95rem;
  color: var(--text-sub);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
.highlight-url {
  color: var(--accent);
  font-weight: 600;
  word-break: break-all;
}
.modal-btns {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* ===== フッター ===== */
.site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1.2rem;
  font-size: 0.8rem;
  color: var(--text-sub);
}

/* ===== レスポンシブ ===== */
@media (max-width: 700px) {
  .tab-bar { display: none; }
  .menu-toggle { display: block; }
  .hero { flex-direction: column; padding: 1.5rem 0 2rem; }
  .hero-title { font-size: 1.8rem; }
  .hero-badge { display: none; }
  .home-cards { grid-template-columns: 1fr; }
  .profile-layout { flex-direction: column; }
  .profile-card { min-width: unset; width: 100%; }
  .works-grid { grid-template-columns: 1fr; }
  .pc-grid    { grid-template-columns: 1fr; }
  .links-grid { grid-template-columns: 1fr; }
}
