/* ==================================================
   Yuibi Repo Prototype — css/style.css
   Chapter Guide
     [CH1] Design tokens / globals
     [CH2] Layout primitives
     [CH3] Components
     [CH4] Page-specific
     [CH5] Responsive
   ================================================== */

/* [CH1] Design tokens */
:root {
  --bg: #f7f7fa;
  --fg: #222;
  --accent: #3a6ea5;
  --accent-light: #d6e4f5;
  --border: #ddd;
  --card-bg: #fff;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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


/* [CH2] Base elements */
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--fg);
  background-color: var(--bg);
  line-height: 1.6;
}

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

a:hover {
  text-decoration: underline;
}


/* [CH3] Header */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background-color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 2000; /* 地図(Leaflet)のz-indexは400程度なので、それより大きくする */
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 1.2rem;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: #666;
}

.site-nav a {
  margin-left: 1rem;
  font-size: 0.9rem;
}


/* [CH4] Main layout */

main {
  max-width: 1380px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.hero {
  margin-bottom: 1.5rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
}


/* [CH4] Search area */

.search-area {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.5fr);
  grid-template-rows: auto auto;
  gap: 1rem;
  margin-bottom: 2rem;
}

#search-map {
  grid-column: 1 / 3;
}

.search-panel {
  background-color: var(--card-bg);
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
}

.search-panel h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.map-placeholder {
  border: 1px dashed var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  background-color: #fafafa;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

input[type="text"],
select {
  padding: 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

button {
  align-self: flex-start;
  padding: 0.5rem 1rem;
  border-radius: 0.4rem;
  border: none;
  background-color: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

button:hover {
  background-color: #2e5683;
}


/* [CH4] Route cards */

.route-list {
  margin-top: 2rem;
}

.route-card {
  background-color: var(--card-bg);
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.route-card h3 {
  margin-top: 0;
  margin-bottom: 0.3rem;
}

.route-meta {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.route-summary {
  font-size: 0.95rem;
}


/* [CH4] Route detail page */

.route-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.route-article {
  background-color: var(--card-bg);
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
}

.route-header h1 {
  margin-top: 0;
  margin-bottom: 0.3rem;
  font-size: 1.4rem;
}

.route-overview,
.route-meta-info,
.route-map-section,
.spot-list,
.references {
  margin-top: 1.5rem;
}

.route-meta-info dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 0.25rem 1rem;
  font-size: 0.95rem;
}

.route-meta-info dt {
  font-weight: 600;
}

.route-meta-info dd {
  margin: 0;
}

.route-map-section {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1rem;
}

.route-files ul {
  padding-left: 1.2rem;
}


/* [CH4] Spot blocks */

.spot-list .spot {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.spot-header h3 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.spot-coords {
  margin: 0;
  font-size: 0.85rem;
  color: #666;
}

.spot-caption {
  margin-top: 0.5rem;
}

.spot-notes {
  font-size: 0.9rem;
  color: #555;
}


/* [CH3] Footer */

.site-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: #777;
  background-color: #ffffff;
}


/* [CH5] Responsive */

@media (max-width: 768px) {
  .search-area {
    grid-template-columns: 1fr;
  }

  #search-map {
    grid-column: 1 / 2;
  }

  .route-map-section {
    grid-template-columns: 1fr;
  }
}


/* [CH3] Small UI helpers */
.ref-list-container {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
}
.ref-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid #eee;
  padding: 0.4rem 0;
  font-size: 0.9rem;
}
.ref-item:last-child { border-bottom: none; }
.ref-item button {
  font-size: 0.75rem; padding: 2px 6px; margin-left: 5px;
  background-color: #e53e3e; /* 赤系 */
}

/* [CH4] Profile Page */

.profile-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* プロフィールカード */
.profile-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* ヘッダー画像エリア (将来的に画像を入れる場所) */
.profile-cover {
  height: 120px;
  background-color: var(--accent-light);
  border-bottom: 1px solid var(--border);
}

.profile-body {
  padding: 1.5rem 2rem;
  position: relative;
}

/* アイコンとアクションボタンの配置 */
.profile-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: -3.5rem; /* カバー画像に食い込ませる */
  margin-bottom: 1rem;
}

.profile-avatar {
  width: 100px; height: 100px;
  background: #fff;
  border: 4px solid #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: #ccc;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 編集ボタン */
.btn-edit-profile {
  margin-top: 2.5rem; /* 位置調整 */
  background: #fff;
  border: 1px solid var(--border);
  color: var(--fg);
  font-weight: bold;
  padding: 0.5rem 1rem;
  border-radius: 999px; /* 角丸 */
  cursor: pointer;
  transition: background 0.2s;
}
.btn-edit-profile:hover {
  background: #f0f0f0;
}

/* テキスト情報 */
.profile-name {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 0.5rem;
}
.profile-bio {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #444;
  white-space: pre-wrap;
  margin-bottom: 1rem;
}
.profile-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  color: #666;
}
.profile-meta a {
  color: var(--accent);
  text-decoration: none;
  display: flex; align-items: center; gap: 4px;
}
.profile-meta a:hover { text-decoration: underline; }

/* 編集フォームモード */
.edit-form-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}
.edit-form-grid label {
  font-weight: bold; font-size: 0.9rem;
}
.edit-form-grid input, 
.edit-form-grid textarea {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
}
.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed var(--border);
}
.btn-save {
  background: var(--accent); color: #fff; border: none; padding: 0.6rem 1.5rem; border-radius: 999px; font-weight: bold; cursor: pointer;
}
.btn-cancel {
  background: transparent; border: 1px solid var(--border); padding: 0.6rem 1.5rem; border-radius: 999px; cursor: pointer;
}

/* 公開ルートリスト */
.section-title {
  font-size: 1.2rem; font-weight: bold; border-bottom: 2px solid #eee; padding-bottom: 0.5rem; margin-bottom: 1rem;
}

/* 編集フォームの微調整 */
.edit-form-grid {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 1rem;
}

.edit-form-grid label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 0.4rem;
}

.edit-form-grid input,
.edit-form-grid textarea {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafafa;
}

.edit-form-grid input:focus,
.edit-form-grid textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-light);
}

.btn-save {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: 6px; /* 丸みを少し抑えてモダンに */
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-save:hover {
  opacity: 0.9;
}

.btn-cancel {
  background: transparent;
  color: #666;
  border: 1px solid #ccc;
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
}

.btn-cancel:hover {
  background: #f5f5f5;
}

/* Dashboard Action Buttons */
.btn-text-danger {
  background: none; border: none; padding: 0; cursor: pointer;
  color: #e53e3e; font-size: 0.85rem; text-decoration: underline;
}
.btn-text-danger:hover { color: #c53030; }

.btn-text-warn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: #d69e2e; font-size: 0.85rem; text-decoration: underline;
}
.btn-text-warn:hover { color: #b7791f; }