/* ====== ichigo.js — Example / demo page styles ======
   いちごミルクの絵本トーン。ランディング（styles.css）と同じテーマトークンを
   共有し、サンプルページ全体で一貫した見た目をつくる。
   data-theme で milk / sky / matcha を切り替え可能。 */

:root {
  --font-display: 'Baloo 2', 'M PLUS Rounded 1c', sans-serif;
  --font-body: 'M PLUS Rounded 1c', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;
  --maxw: 1080px;
}

/* ---- Theme: Strawberry Milk (default) ---- */
html[data-theme='milk'] {
  --bg: #fff8f3;
  --bg-alt: #fff0e9;
  --card: #ffffff;
  --ink: #4d2c31;
  --ink-soft: #927076;
  --line: #ffe3d8;
  --primary: #ed5a77;
  --primary-deep: #d83a5d;
  --primary-soft: #ffe3ec;
  --leaf: #57b894;
  --leaf-soft: #e3f6ec;
  --sun: #f1a73a;
  --sun-soft: #ffeccc;
  --hero-top: #ffe1ec;
  --hero-mid: #fff0ea;
  --hero-bot: #fff8f3;
  --badge-bg: rgba(255, 255, 255, 0.7);
  --shadow: rgba(150, 70, 85, 0.13);
  --shadow-soft: rgba(150, 70, 85, 0.08);
  --code-bg: #3a2329;
  --code-panel: #2c191e;
  --code-text: #ffe9ef;
  --code-muted: #c79aa6;
  --tint-1: linear-gradient(160deg, #ffe3ec, #ffcdda);
  --tint-2: linear-gradient(160deg, #ffeede, #ffdcc0);
  --tint-3: linear-gradient(160deg, #e3f6ec, #cbeede);
}

/* ---- Theme: Blueberry Sky ---- */
html[data-theme='sky'] {
  --bg: #f6faff;
  --bg-alt: #ecf3ff;
  --card: #ffffff;
  --ink: #2f3656;
  --ink-soft: #76809e;
  --line: #dce6fb;
  --primary: #6b8bf5;
  --primary-deep: #4f6fe0;
  --primary-soft: #e1e9ff;
  --leaf: #56b8b0;
  --leaf-soft: #e3f6ef;
  --sun: #f0a93f;
  --sun-soft: #ffeccc;
  --hero-top: #dceaff;
  --hero-mid: #ecf2ff;
  --hero-bot: #f6faff;
  --badge-bg: rgba(255, 255, 255, 0.7);
  --shadow: rgba(70, 95, 160, 0.14);
  --shadow-soft: rgba(70, 95, 160, 0.08);
  --code-bg: #232a40;
  --code-panel: #1a2034;
  --code-text: #e9efff;
  --code-muted: #9aa6c7;
  --tint-1: linear-gradient(160deg, #e1e9ff, #cdd8ff);
  --tint-2: linear-gradient(160deg, #ddeffb, #c4e4f5);
  --tint-3: linear-gradient(160deg, #e3f6ef, #cbeede);
}

/* ---- Theme: Matcha Cream ---- */
html[data-theme='matcha'] {
  --bg: #fbfaf2;
  --bg-alt: #f4f2e3;
  --card: #ffffff;
  --ink: #3e3f2c;
  --ink-soft: #847e63;
  --line: #e8e6cf;
  --primary: #82a94d;
  --primary-deep: #6a9038;
  --primary-soft: #eaf2d6;
  --leaf: #5fae7a;
  --leaf-soft: #e0f3e6;
  --sun: #d99b35;
  --sun-soft: #f6e7c6;
  --hero-top: #eef3da;
  --hero-mid: #f6f6e6;
  --hero-bot: #fbfaf2;
  --badge-bg: rgba(255, 255, 255, 0.7);
  --shadow: rgba(110, 120, 60, 0.14);
  --shadow-soft: rgba(110, 120, 60, 0.08);
  --code-bg: #2f3322;
  --code-panel: #24281a;
  --code-text: #eef2df;
  --code-muted: #aab290;
  --tint-1: linear-gradient(160deg, #eaf2d6, #d7e7b3);
  --tint-2: linear-gradient(160deg, #fdeccf, #f8dca9);
  --tint-3: linear-gradient(160deg, #e0f3e6, #c8e9d3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  line-height: 1.7;
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% -10%, var(--hero-top) 0%, transparent 60%),
    var(--bg);
  font-weight: 400;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--primary-deep); }

/* ===== Top nav ===== */
.demo-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(255, 250, 246, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 6px 24px var(--shadow-soft);
}
.demo-nav .back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.demo-nav .back .mark { font-size: 23px; line-height: 1; transition: transform 0.25s cubic-bezier(.34,1.56,.64,1); }
.demo-nav .back:hover .mark { transform: rotate(-12deg) scale(1.1); }
.demo-nav .back .dot { color: var(--primary); }
.demo-nav .back .arrow { color: var(--ink-soft); font-weight: 700; margin-right: 1px; }
.demo-nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
}
.demo-nav-links a {
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--primary-soft);
  background: var(--card);
  box-shadow: 0 6px 16px -10px var(--shadow);
  transition: transform 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.demo-nav-links a:hover { transform: translateY(-2px); color: var(--primary-deep); border-color: var(--primary); }

/* ===== Demo header ===== */
.demo-header {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(36px, 6vw, 64px) 20px clamp(20px, 3vw, 30px);
  text-align: center;
}
.demo-eyebrow {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 12px;
}
.demo-logo {
  font-size: 56px;
  line-height: 1;
  display: inline-block;
  animation: demo-float 3.2s ease-in-out infinite;
  filter: drop-shadow(0 10px 14px rgba(216, 58, 93, 0.22));
}
@keyframes demo-float {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-12px) rotate(6deg); }
}
.demo-header h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 14px 0 10px;
  color: var(--ink);
}
.demo-header h1 .dot { color: var(--primary); }
.demo-lead {
  font-size: 16px;
  color: var(--ink-soft);
  max-width: 620px;
  margin: 0 auto 18px;
  text-wrap: pretty;
}
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--primary-deep);
  background: var(--badge-bg);
  border: 1.5px solid #fff;
  padding: 6px 15px;
  border-radius: 999px;
  box-shadow: 0 8px 20px -12px var(--shadow);
  backdrop-filter: blur(6px);
}

/* ===== Main / panels ===== */
.demo-main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px clamp(48px, 8vw, 88px);
}
.demo-main.narrow { max-width: 640px; }
.demo-main.wide { max-width: 1180px; }

.panel {
  background: var(--card);
  border-radius: 24px;
  border: 1.5px solid #fff;
  box-shadow: 0 18px 44px -26px var(--shadow);
  overflow: hidden;
}
.panel + .panel { margin-top: 22px; }
.panel-pad { padding: clamp(20px, 3vw, 28px); }
.panel-head {
  padding: 20px clamp(20px, 3vw, 28px);
  border-bottom: 1.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.panel-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 9px;
}
.panel-sub { font-size: 13.5px; color: var(--ink-soft); }
.panel-foot {
  padding: 16px clamp(20px, 3vw, 28px);
  border-top: 1.5px solid var(--line);
  background: var(--bg-alt);
}
.panel-section { padding: clamp(18px, 3vw, 24px) clamp(20px, 3vw, 28px); }
.panel-section + .panel-section { border-top: 1.5px solid var(--line); }

/* grid helper for laying panels side by side */
.demo-grid {
  display: grid;
  gap: 22px;
}
@media (min-width: 860px) {
  .demo-grid.cols-2 { grid-template-columns: 1fr 1fr; }
  .demo-grid.side { grid-template-columns: 360px 1fr; align-items: start; }
}

/* ===== Buttons ===== */
.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  padding: 11px 22px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.25s, background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
  line-height: 1.2;
}
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 22px -10px var(--primary);
}
.btn-primary:not(:disabled):hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 30px -12px var(--primary);
  background: var(--primary-deep);
}
.btn-primary:not(:disabled):active { transform: translateY(0) scale(0.99); }
.btn-secondary {
  background: var(--card);
  color: var(--primary-deep);
  border: 2px solid var(--primary-soft);
  box-shadow: 0 8px 18px -12px var(--shadow);
}
.btn-secondary:not(:disabled):hover { transform: translateY(-2px); border-color: var(--primary); }
.btn-ghost {
  background: var(--bg-alt);
  color: var(--ink);
  box-shadow: none;
}
.btn-ghost:not(:disabled):hover { background: var(--primary-soft); color: var(--primary-deep); }
.btn-danger {
  background: var(--primary-soft);
  color: var(--primary-deep);
}
.btn-danger:not(:disabled):hover { background: var(--primary); color: #fff; transform: translateY(-2px); }
.btn-sm { font-size: 13px; padding: 8px 16px; }
.btn-block { width: 100%; }

/* icon-only round button (e.g. quantity steppers, delete) */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  background: var(--bg-alt);
  color: var(--ink);
  border: 1.5px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-icon:not(:disabled):hover { background: var(--primary-soft); color: var(--primary-deep); border-color: var(--primary-soft); transform: scale(1.08); }
.btn-icon:disabled { opacity: 0.45; cursor: not-allowed; }

/* ===== Form controls ===== */
.field {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg-alt);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 12px 16px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.field::placeholder { color: var(--ink-soft); opacity: 0.7; }
.field:focus {
  outline: none;
  background: var(--card);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
select.field {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23927076' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
textarea.field { resize: vertical; min-height: 96px; line-height: 1.6; }
.field-sm { padding: 8px 12px; font-size: 14px; border-radius: 11px; }

.label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  display: block;
}
.field-row { display: flex; gap: 12px; align-items: center; }
.field-row .field { flex: 1; }
.control { display: flex; flex-direction: column; }

/* native checkbox / radio accent */
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); cursor: pointer; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.check input { width: 18px; height: 18px; }

/* ===== Segmented / filter buttons ===== */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  background: var(--bg-alt);
  border-radius: 999px;
}
.seg button, .seg .seg-btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.seg button:hover, .seg .seg-btn:hover { color: var(--primary-deep); }
.seg button.active, .seg .seg-btn.active {
  background: var(--card);
  color: var(--primary-deep);
  box-shadow: 0 6px 16px -10px var(--shadow);
}

/* ===== Badges / chips / tags ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  white-space: nowrap;
}
.badge.leaf { background: var(--leaf-soft); color: var(--leaf); }
.badge.sun { background: var(--sun-soft); color: var(--sun); }
.badge.ink { background: var(--bg-alt); color: var(--ink-soft); }
.badge-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* ===== Stats row ===== */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.stat {
  flex: 1;
  min-width: 110px;
  background: var(--bg-alt);
  border-radius: 16px;
  padding: 14px 16px;
  text-align: center;
}
.stat-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.1;
  color: var(--primary-deep);
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}
.stat.leaf .stat-value { color: var(--leaf); }
.stat.sun .stat-value { color: var(--sun); }

/* ===== List rows ===== */
.rows { list-style: none; }
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px clamp(18px, 3vw, 26px);
  border-bottom: 1.5px solid var(--line);
  transition: background 0.2s;
  animation: demo-slide-in 0.3s ease-out;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--bg-alt); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 15px; color: var(--ink); font-weight: 500; }
.row-meta { font-size: 12.5px; color: var(--ink-soft); }
.row.done .row-title { text-decoration: line-through; color: var(--ink-soft); }
.row.done { opacity: 0.7; }
@keyframes demo-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Card grid (products, etc.) ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}
.card {
  background: var(--card);
  border-radius: 22px;
  overflow: hidden;
  border: 1.5px solid #fff;
  box-shadow: 0 16px 38px -26px var(--shadow);
  transition: transform 0.28s cubic-bezier(.34,1.4,.64,1), box-shadow 0.28s;
  animation: demo-fade-up 0.4s ease-out;
}
.card:hover { transform: translateY(-7px); box-shadow: 0 28px 50px -28px var(--shadow); }
.card-media {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 58px;
  position: relative;
  overflow: hidden;
  background: var(--tint-1);
}
.card-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.5) 1.4px, transparent 1.6px);
  background-size: 18px 18px;
  opacity: 0.5;
}
.card-media > * { position: relative; z-index: 1; }
.card.tint-peach .card-media { background: var(--tint-2); }
.card.tint-mint .card-media { background: var(--tint-3); }
.card-body { padding: 18px 20px 20px; }
@keyframes demo-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Empty state ===== */
.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--ink-soft);
}
.empty-emoji { font-size: 52px; margin-bottom: 12px; opacity: 0.85; filter: grayscale(0.1); }
.empty h3 { font-family: var(--font-display); font-size: 19px; color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: 14px; }

/* ===== Metric readouts (observers / performance) ===== */
.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
}
.metric {
  background: var(--bg-alt);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  text-align: center;
}
.metric-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 28px;
  color: var(--primary-deep);
  line-height: 1.1;
}
.metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 6px;
}

/* on/off pill state */
.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--ink-soft);
}
.state-pill.on { background: var(--leaf-soft); color: var(--leaf); }
.state-pill.off { background: var(--primary-soft); color: var(--primary-deep); }

/* ===== Log / console list ===== */
.log {
  list-style: none;
  font-family: var(--font-mono);
  font-size: 12.5px;
  max-height: 260px;
  overflow-y: auto;
}
.log li {
  padding: 8px 14px;
  border-bottom: 1px dashed var(--line);
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
  animation: demo-slide-in 0.25s ease-out;
}
.log li:last-child { border-bottom: none; }
.log .log-time { color: var(--primary-deep); flex-shrink: 0; }

/* ===== Code blocks ===== */
.code-card {
  background: var(--code-panel);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 50px -30px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.06);
}
.code-card .code-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.code-card .code-bar .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.code-card .code-bar .dr { background: #ff8497; }
.code-card .code-bar .dy { background: #ffd27d; }
.code-card .code-bar .dg { background: #8fd6a6; }
.code-card .code-name { margin-left: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--code-muted); }
.code-card pre { margin: 0; padding: 20px 22px; overflow-x: auto; font-size: 13px; line-height: 1.7; }
.code-card pre code { font-family: var(--font-mono); color: var(--code-text); }

/* inline keycap */
.kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-alt);
  border: 1.5px solid var(--line);
  border-bottom-width: 2.5px;
  border-radius: 7px;
  padding: 2px 7px;
  color: var(--ink);
}

/* ===== Footer ===== */
.demo-footer {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 40px 20px 36px;
  text-align: center;
}
.demo-footer .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  margin-bottom: 14px;
}
.demo-footer .brand .dot { color: #ffb3c4; }
.demo-footer .links {
  display: flex;
  gap: 22px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.demo-footer .links a {
  color: var(--code-text);
  text-decoration: none;
  opacity: 0.82;
  font-weight: 500;
  font-size: 14px;
  transition: opacity 0.2s, color 0.2s;
}
.demo-footer .links a:hover { opacity: 1; color: #ffb3c4; }
.demo-footer .credit { font-size: 13px; color: var(--code-muted); }
.demo-footer .credit a { color: #ffb3c4; text-decoration: none; }

/* ===== Utilities ===== */
.muted { color: var(--ink-soft); }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.divider { height: 1.5px; background: var(--line); border: none; margin: 4px 0; }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .demo-grid.side { grid-template-columns: 1fr; }
  .field-row { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .demo-logo { animation: none; }
  .row, .card { animation: none; }
  html { scroll-behavior: auto; }
}
