/**
 * Off-Grid Life - Mobile Optimization (v2.1)
 * ブレークポイント:
 *   - 小型スマホ: 〜480px
 *   - 一般スマホ〜タブレット縦: 481-768px
 *   - PC: 769px以上（このファイルでは触らない）
 */

/* ============================================================
   共通: すべての幅で効かせるベース調整
   ============================================================ */
img, video, iframe { max-width: 100%; height: auto; }
img { image-orientation: from-image; }

/* タップハイライトの色を控えめに */
* { -webkit-tap-highlight-color: rgba(46,125,50,.15); }

/* iOSでのフォーム16px（ズーム防止） */
input[type="text"], input[type="email"], input[type="url"],
input[type="tel"], input[type="number"], input[type="search"],
textarea, select {
	font-size: 16px;
}

/* ============================================================
   スクロールで消えるヘッダー
   ============================================================ */
.site-header {
	transition: transform .3s cubic-bezier(.4, 0, .2, 1);
	will-change: transform;
}
body.ogl-header-hidden .site-header {
	transform: translateY(-100%);
}
/* ページトップから離れると背景を少し濃く */
body.ogl-scrolled .site-header {
	box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

/* ============================================================
   タブレット以下 (〜 768px)
   ============================================================ */
@media (max-width: 768px) {
	/* ---- header ---- */
	.site-header-inner {
		padding: 10px 16px !important;
	}
	.site-logo svg,
	.site-logo img {
		max-height: 32px;
		width: auto;
	}
	/* デスクトップ用ナビを隠す（ハンバーガーに委ねる） */
	.site-nav > a,
	.site-nav .menu,
	.site-nav > ul {
		display: none !important;
	}
	.site-nav .theme-toggle {
		width: 44px; height: 44px;
	}

	/* ---- main padding for bottom nav ---- */
	body {
		padding-bottom: 64px;
	}

	/* ---- article body ---- */
	.site-main {
		padding: 16px !important;
	}
	.entry-title {
		font-size: 26px !important;
		line-height: 1.35 !important;
	}
	.entry-content {
		font-size: 16px;
		line-height: 1.9;
	}
	.entry-content h2 {
		font-size: 22px !important;
		line-height: 1.4;
		margin-top: 2em !important;
	}
	.entry-content h3 {
		font-size: 18px !important;
		line-height: 1.5;
	}
	.entry-content blockquote {
		padding: 12px 16px !important;
		margin: 1.2em -4px !important;
		font-size: 15px;
	}
	.entry-content pre,
	.entry-content code {
		font-size: 13px !important;
	}
	.entry-content ul,
	.entry-content ol {
		padding-left: 1.4em !important;
	}
	.entry-content img,
	.entry-content .wp-block-image {
		margin-left: -16px !important;
		margin-right: -16px !important;
		width: calc(100% + 32px) !important;
		max-width: none !important;
		border-radius: 0 !important;
	}
	.entry-content figure figcaption {
		padding: 6px 16px;
		font-size: 12px;
	}

	/* ---- share buttons ---- */
	.share-buttons,
	.ogl-share {
		display: grid;
		grid-template-columns: repeat(4, 1fr);
		gap: 8px;
	}
	.share-buttons a,
	.ogl-share a {
		min-height: 44px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 8px;
		font-size: 13px;
	}

	/* ---- content/sidebar layout ---- */
	.entry-layout,
	.site-content,
	.content-with-sidebar {
		display: block !important;
		grid-template-columns: 1fr !important;
	}
	.sidebar,
	#secondary,
	aside.widget-area {
		width: 100% !important;
		margin-top: 32px;
	}

	/* ---- footer ---- */
	.site-footer-inner {
		grid-template-columns: 1fr !important;
		gap: 24px !important;
		padding: 24px 16px !important;
	}
	.site-footer-bottom {
		flex-direction: column;
		gap: 6px;
		padding: 16px !important;
		font-size: 12px;
	}

	/* ---- cards / archive grid ---- */
	.card-grid,
	.posts-grid {
		grid-template-columns: 1fr !important;
		gap: 16px !important;
	}
	.card,
	.post-card {
		border-radius: 12px !important;
	}

	/* ---- dashboard grid ---- */
	.ogl-dashboard,
	.stats-grid {
		grid-template-columns: repeat(2, 1fr) !important;
		gap: 10px !important;
	}
	.ogl-dashboard .stat,
	.stats-grid .stat {
		padding: 14px !important;
	}
	.ogl-dashboard .stat .value,
	.stats-grid .stat .value {
		font-size: 22px !important;
	}

	/* ---- hero ---- */
	.hero, .site-hero, .front-hero {
		padding: 32px 16px !important;
		min-height: auto !important;
	}
	.hero h1, .site-hero h1, .front-hero h1 {
		font-size: 28px !important;
		line-height: 1.3 !important;
	}
	.hero p, .site-hero p, .front-hero p {
		font-size: 15px !important;
	}

	/* ---- ticker ---- */
	.site-ticker {
		font-size: 11px !important;
		padding: 6px 10px !important;
		gap: 12px !important;
		overflow-x: auto;
		white-space: nowrap;
	}

	/* ---- category chip ---- */
	.cat-chip {
		font-size: 12px !important;
		padding: 4px 10px !important;
	}

	/* ---- tap targets ---- */
	a.button, button, .btn, input[type="submit"] {
		min-height: 44px;
		padding: 10px 16px;
	}
}

/* ============================================================
   小型スマホ (〜 480px)
   ============================================================ */
@media (max-width: 480px) {
	body { font-size: 15px; }

	.entry-title { font-size: 22px !important; }
	.entry-content { font-size: 15.5px; line-height: 1.85; }
	.entry-content h2 { font-size: 20px !important; }
	.entry-content h3 { font-size: 17px !important; }

	.hero h1, .site-hero h1, .front-hero h1 { font-size: 24px !important; }

	.ogl-dashboard,
	.stats-grid { grid-template-columns: 1fr !important; }

	.share-buttons,
	.ogl-share {
		grid-template-columns: repeat(3, 1fr);
	}
	.share-buttons a .label,
	.ogl-share a .label {
		display: none;
	}
}

/* ============================================================
   下部固定ナビゲーションバー
   ============================================================ */
.ogl-bottom-nav {
	display: none;
}
@media (max-width: 768px) {
	.ogl-bottom-nav {
		position: fixed;
		left: 0; right: 0; bottom: 0;
		display: grid;
		grid-template-columns: repeat(5, 1fr);
		background: #ffffff;
		border-top: 1px solid #e5e7eb;
		z-index: 50;
		padding-bottom: env(safe-area-inset-bottom);
		box-shadow: 0 -2px 12px rgba(0,0,0,.05);
	}
	body.ogl-skin-night-battery .ogl-bottom-nav {
		background: #0b1220;
		border-top-color: #1e293b;
	}
	.ogl-bottom-nav a {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 8px 4px 6px;
		min-height: 56px;
		color: #6b7280;
		text-decoration: none;
		font-size: 10.5px;
		font-weight: 500;
		gap: 3px;
		transition: color .15s;
	}
	.ogl-bottom-nav a:hover,
	.ogl-bottom-nav a.is-active {
		color: var(--brand, #2e7d32);
	}
	.ogl-bottom-nav svg {
		width: 22px;
		height: 22px;
		stroke: currentColor;
	}
}

/* ============================================================
   フローティングボタン群（TOCボタン、ページトップ、共有）
   ============================================================ */
.ogl-fab-wrap {
	position: fixed;
	right: 12px;
	bottom: 76px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	z-index: 40;
	pointer-events: none;
}
.ogl-fab-wrap > * { pointer-events: auto; }

.ogl-fab {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: var(--brand, #2e7d32);
	color: #fff;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 16px rgba(0,0,0,.15);
	cursor: pointer;
	opacity: 0;
	transform: translateY(20px);
	transition: opacity .25s, transform .25s;
}
.ogl-fab.is-visible {
	opacity: 1;
	transform: translateY(0);
}
.ogl-fab:hover {
	background: var(--brand-dark, #1b5e20);
	transform: translateY(-2px) scale(1.05);
}
.ogl-fab svg { width: 22px; height: 22px; stroke: currentColor; }

/* Hide FABs on PC by default */
@media (min-width: 769px) {
	.ogl-fab-wrap { bottom: 20px; right: 20px; }
	.ogl-fab-toc { display: none; } /* PCではサイドバーに目次が出るため */
}

/* ============================================================
   目次モーダル / 共有シート（下からスライドイン）
   ============================================================ */
.ogl-sheet {
	position: fixed;
	inset: 0;
	z-index: 100;
	visibility: hidden;
	pointer-events: none;
}
.ogl-sheet.is-open {
	visibility: visible;
	pointer-events: auto;
}
.ogl-sheet-backdrop {
	position: absolute; inset: 0;
	background: rgba(0,0,0,.4);
	opacity: 0;
	transition: opacity .3s;
}
.ogl-sheet.is-open .ogl-sheet-backdrop { opacity: 1; }

.ogl-sheet-panel {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	background: #fff;
	border-radius: 20px 20px 0 0;
	padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
	max-height: 80vh;
	overflow-y: auto;
	transform: translateY(100%);
	transition: transform .3s cubic-bezier(.4, 0, .2, 1);
	box-shadow: 0 -8px 32px rgba(0,0,0,.15);
}
.ogl-sheet.is-open .ogl-sheet-panel { transform: translateY(0); }
body.ogl-skin-night-battery .ogl-sheet-panel { background: #111827; color: #e5e7eb; }

.ogl-sheet-handle {
	display: block;
	width: 40px; height: 4px;
	background: #d1d5db;
	border-radius: 2px;
	margin: 4px auto 12px;
}
.ogl-sheet h3 {
	margin: 0 0 12px;
	font-size: 15px;
	font-weight: 600;
}
.ogl-sheet ul,
.ogl-sheet ol {
	list-style: none;
	margin: 0; padding: 0;
}
.ogl-sheet a,
.ogl-sheet button {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 14px 4px;
	border: none;
	background: transparent;
	color: inherit;
	text-align: left;
	font-size: 15px;
	text-decoration: none;
	border-bottom: 1px solid rgba(0,0,0,.06);
	cursor: pointer;
	min-height: 48px;
}
.ogl-sheet a:last-child,
.ogl-sheet button:last-child { border-bottom: none; }

.ogl-sheet-share-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
	padding: 12px 0 20px;
}
.ogl-sheet-share-grid a {
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 12px 4px;
	border: none;
	font-size: 12px;
}
.ogl-sheet-share-grid svg {
	width: 32px; height: 32px;
}

/* ============================================================
   記事末尾「もっと読む」ボタン
   ============================================================ */
.ogl-more-cta {
	display: block;
	text-align: center;
	margin: 40px -16px 24px;
	padding: 20px 24px;
	background: var(--brand, #2e7d32);
	color: #fff;
	font-size: 16px;
	font-weight: 600;
	text-decoration: none;
	border-radius: 16px;
	box-shadow: 0 6px 20px rgba(46,125,50,.25);
	transition: transform .15s, box-shadow .15s;
}
.ogl-more-cta:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 28px rgba(46,125,50,.35);
}
.ogl-more-cta::after {
	content: ' →';
}
@media (max-width: 768px) {
	.ogl-more-cta {
		margin-left: 0;
		margin-right: 0;
		border-radius: 12px;
		animation: ogl-pulse 2.5s ease-in-out infinite;
	}
}
@keyframes ogl-pulse {
	0%, 100% { transform: translateY(0); box-shadow: 0 6px 20px rgba(46,125,50,.25); }
	50%      { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(46,125,50,.35); }
}
