@charset "UTF-8";

/* ベーススタイル */

body {
  margin: 0;
  background: #f9fafb;
  font-family: Arial, sans-serif;
  color: #222;
} 

/* HEADER */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  --header-h: 120px;
  height: var(--header-h);
  align-items: center;
  justify-content: space-between; /* keep hamburger at top-right */
  background: #fff;
  border-bottom: 1px solid #eee;
  padding: 0 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  overflow: hidden;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;          /* default spacing on tablet/desktop */
  min-width: 0;       /* allow title to ellipsis */
  flex-shrink: 0;     /* keep left area stable on wider screens */
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;   /* push to far right */
  flex-shrink: 0;      /* prevent squashing */
}

/* Language toggle button (top-right) */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid #d7e3f7;
  border-radius: 10px;
  background: #f7fbff;
  color: #2767b3;
  font-weight: 700;
  cursor: pointer;
  font-size: 2.35rem;
  line-height: 1;
}
.lang-toggle:hover { background: #eaf4ff; }
.lang-toggle:focus-visible { outline: 2px solid #4aa3a3; outline-offset: 2px; }

.app-icon {
  aspect-ratio: 1 / 1;
  height: calc(var(--header-h) - 16px); /* keep some vertical padding */
  width: auto;                           /* derive width from height to preserve square shape */
  border-radius: 20%;
  box-shadow: 0 4px 18px rgba(110, 110, 210, 0.06);
  object-fit: contain;                   /* stay inside the header box */
}
.app-title {
  font-size: clamp(18px, 1.4vw + 16px, 28px);
  font-weight: bold;
  color: #4097ee;
  letter-spacing: 0.8px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* HAMBURGER MENU*/
.hamburger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(44px, 2.5vw + 36px, 56px);
  height: clamp(44px, 2.5vw + 36px, 56px);
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 0;
  cursor: pointer;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
  z-index: 1400;
}
.hamburger:focus-visible {
  outline: 2px solid #4aa3a3;
  outline-offset: 2px;
}
.hamburger span {
  position: absolute;
  display: block;
  width: 60%;
  height: 2.5px;
  background: #4097ee;
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.hamburger span:nth-child(1) { transform: translateY(-8px); }
.hamburger span:nth-child(2) { transform: translateY(0); }
.hamburger span:nth-child(3) { transform: translateY(8px); }

/* animate to "X" when open (JS toggles .is-open on the button) */
.hamburger.is-open span:nth-child(1) { transform: rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; }
.hamburger.is-open span:nth-child(3) { transform: rotate(-45deg); }

@media (max-width: 900px) {
  .header {
    --header-h: 88px;
    height: var(--header-h);
    padding: 0 18px;
  }
  .app-title { font-size: 1.5rem; }
  .hamburger { width: 44px; height: 44px; }
  .hamburger span { height: 6px; }
  .reset-row { flex-direction: column; align-items: flex-start; }
  :root { --anchor-offset: 88px; }
  #materials .materials-grid {
    grid-template-columns: repeat(2, 1fr);
  }
   #materials .materials-section > .acc-toggle,
  #materials .materials-section > .acc-content {
    width: 100%;
    margin: 0; /* headers butt together */
  }
  #materials .materials-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .header {
    --header-h: 72px;
    height: var(--header-h);
    padding: 0 8px;
    align-items: center;
  }
  .app-title { font-size: 1.13rem;}
  .hamburger { width: 32px; height: 32px;}
  .hamburger span { height: 3.5px;}
  .app-icon {
    height: calc(var(--header-h) - 12px); /* a bit tighter on very small screens */
  }
  :root {--anchor-offset: 72px; }
  
  main {
    padding: 8px;
  }
  .compare-slider {
    max-width: 98vw;
  }
  .gallery-item img {
    width: 60px;
    height: 40px;
  }
  .big-upload {
    width: 96vw;
    min-width: 120px;
    height: 92px;
    font-size: .93rem;
  }
  #materials .materials-grid { 
    grid-template-columns: 1fr;
  }
  #materials .acc-toggle {
    font-size: 1rem;
  }
  /* --- mobile fine-tune: prevent title overlap & nudge hamburger left --- */
  .header-left {
    flex: 1 1 auto;   /* allow the left area (icon + title) to shrink */
    min-width: 0;     /* enable ellipsis */
    gap: 8px;
  }
  .header-right {
    flex: 0 0 auto;   /* keep buttons at intrinsic width */
  }
  .app-title {
    font-size: 0.98rem;      /* a touch smaller to avoid overlap */
    text-align: left;        /* explicitly left align */
  }
  .lang-toggle {
    min-width: 40px;
    min-height: 32px;
    padding: 4px 8px;
    font-weight: 700;
  }
  /* extra-tight on small phones */
  .app-title { max-width: 62vw; }
}

/* SIDEMENU */
.side-menu {
  position: fixed;
  top: 0;
  right: -260px;
  width: 260px;
  height: 100vh;
  background: #fff;
  box-shadow: -3px 0 8px rgba(60, 80, 120, 0.09);
  transition: right 0.3s;
  z-index: 1300;
  padding-top: 90px;
}
.side-menu.open {
  right: 0;
}
.side-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.side-menu li {
  border-bottom: 1px solid #eee;
}
.side-menu a {
  display: block;
  padding: 22px 32px;
  color: #333;
  font-size: 1.12rem;
  text-decoration: none;
  transition: background 0.15s;
}
.side-menu a:hover {
  background: #f3f7ff;
}
.overlay {
  display: none;
  position: fixed;
  z-index: 1200;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(60, 80, 120, 0.10);
}

.overlay.active {
  display: block;
}

/* Main area */
main {
  max-width: 850px;
  margin: 40px auto 16px;
  padding: 24px;
  background: #fff;
  border-radius: 1.3rem;
  box-shadow: 0 6px 28px 0 rgba(60, 80, 120, 0.09);
}
/* Avoid sticky header overlap for in-page anchor jumps */
main, .page { scroll-margin-top: var(--anchor-offset); }

.page {  display: none; }
.page.active {  display: block; }

.upload-area {
  display: flex;
  gap: 40px;
  justify-content: center;
  margin: 30px 0 20px 0;
  flex-wrap: wrap;
}

/* Ensure consistent order: Before (left) → After (right) */
/* Modern :has() approach: place the block containing #img-before first, #img-after second */
.upload-area > *:has(input#img-before) { order: 0; }
.upload-area > *:has(input#img-after) { order: 1; }

/* Fallback ordering if both blocks exist but :has() is unsupported.
   Assumes markup has exactly two children in .upload-area */
.upload-area > *:first-child { order: 0; }
.upload-area > *:last-child  { order: 1; }

.big-upload {
  background: #eef5fd;
  border: 2.5px dashed #4097ee;
  border-radius: 14px;
  padding: 34px 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-direction: column;
  width: 230px;
  height: 160px;
  font-size: 1.12rem;
  font-weight: bold;
  color: #4097ee;
  box-shadow: 0 3px 14px rgba(90, 130, 210, 0.10);
  transition: border-color 0.2s, background 0.2s;
}
.big-upload:hover {
  border-color: #1869c3;
  background: #ddeefd;
}
.upload-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
}

.face-only-option {
  text-align: center;
  margin-bottom: 12px;
}
.face-only-option label {
  font-size: 1.05rem;
  color: #2767b3;
}

/* ===== Wizard (step-by-step guide) ===== */
.wizard-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f2f7ff;
  border: 1px solid #e0ecff;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0 6px;
}
.wizard-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-secondary {
  background: #eef5fd;
  color: #2767b3;
  border: 1px solid #cfe0fb;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}
.btn-secondary:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.btn-primary {
  background: #4097ee;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* reset button */
#reset-btn {
  display: block;
  margin: 16px auto 0 auto;
  background: #f35252;
  color: #fff;
  padding: 10px 28px;
  border: none;
  border-radius: 8px;
  font-size: 1.08rem;
  cursor: pointer;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(180, 0, 0, 0.07);
  transition: background 0.18s;
}
#reset-btn:hover {
  background: #c31212;
}

/* Reset row (button + hint) */
.reset-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.reset-hint {
  color: #2767b3;
  font-size: .95rem;
}

/* 画像比較スライダー */
.slider-container {
  margin: 38px auto 0;
  max-width: 700px;
  background: #e7eefd;
  border-radius: 16px;
  padding: 16px 0 26px 0;
  box-shadow: 0 2px 8px rgba(120, 160, 255, 0.04);
}

/* ハンドル内の矢印マーク */
.compare-slider {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: auto;
  overflow: hidden;
  border-radius: 12px;
  background: #f3f8fd;
  box-shadow: 0 6px 24px rgba(60, 120, 220, 0.11);
}

/* === Before/After labels (i18n-linked via :root[lang]) === */
:root {
  --before-label: "Before";
  --after-label: "After";
  --anchor-offset: 104px;
}
:root[lang="ja"] {
  --before-label: "ビフォー";
  --after-label: "アフター";
}
.compare-slider::before,
.compare-slider::after {
  position: absolute;
  bottom: 8px;
  padding: 2px 6px;
  font-size: 0.9rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  line-height: 1;
  z-index: 11;            /* above images and handle background */
  pointer-events: none;   /* allow dragging without interference */
  content: "";
}
.compare-slider::before {
  content: var(--before-label);
  left: 12px;
}
.compare-slider::after {
  content: var(--after-label);
  right: 12px;
}

/* ホバー時のスタイル変化 */
.compare-slider img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  object-position: left center;
  pointer-events: none;
}

.img-overlay {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  transition: width 0.15s;
}
.img-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
}

/* スライダーのハンドル */
.slider-handle {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 100%;
  background: rgba(255, 255, 255, 0.78);
  border: 2.5px solid #4097ee;
  border-radius: 12px;
  cursor: ew-resize;
  box-shadow: 0 0 10px rgba(120, 180, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.18s;
}
.slider-handle::after {
  content: '\21C6'; /* 矢印アイコン */
  color: #4097ee;
  font-size: 2.2rem;
}

/* input form */
form label {
  display: block;
  margin: 12px 0 8px 0;
}
input[type='file'] {
  margin-top: 6px;
}
button[type='submit'] {
  background: #4097ee;
  color: #fff;
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-size: 1.1rem;
  cursor: pointer;
  margin-top: 18px;
}
button[type='submit']:hover {
  background: #3376c6;
}

/* スライダーのマルチカラムレイアウト表示 */
/* materials sections: remove outer margins so headers touch without white gaps */
.materials-section { margin-top: 0; }
/* keep spacing only inside expanded content */
#materials .acc-content .materials-grid { padding-top: 12px; }
.materials-section h3 {
  margin-bottom: 16px;
  color: #2767b3;
}
.materials-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.material-set {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #eef7fe;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(180, 210, 250, 0.08);
}
.material-set h4 {
  margin: 0;
  font-size: 1.05rem;
  color: #1f3f6b;
}
.material-set figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.material-set figcaption {
  font-weight: 600;
  color: #2767b3;
}
.material-set img {
  width: 100%;
  border-radius: 8px;
  object-fit: cover;
}

/* 半顔合成の表示 */
  .half-face {
  margin: 28px auto 0;
  max-width: 600px;
  background: #f3f8fd;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(60,120,220,0.11);
  padding: 12px 12px 18px;
  text-align: center;
}
  .half-face img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}
  .half-face-caption {
  margin-top: 8px;
  color: #2767b3;
  font-size: 0.95rem;
  font-weight: 600;
}

/* Lock body scroll when side-menu is open */
body.menu-open {
  overflow: hidden;
}

/* ========== Footer ========== */
.site-footer {
  margin-top: 12px;
  background: #eceff3;     /* 薄いグレー */
  color: #444;             /* 読みやすい濃さの文字色 */
  border-top: 1px solid #e5e7eb;
  padding: 14px 20px;
  text-align: center;
}

.site-footer p {
  font-size: 0.9rem;
  line-height: 1.6;
}



#materials .acc-toggle {
  width: 100%;
  background: #f8fafc;
  border: none;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}
#materials .acc-toggle:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}
#materials .acc-toggle .icon-arrow {
  width: 20px; height: 20px;
  fill: currentColor;
  transition: transform .25s ease;
}
#materials .acc-toggle[aria-expanded="true"] .icon-arrow { transform: rotate(180deg); }

/* Vibrant category headers (inspired by CodePen) */
#materials .materials-section:nth-of-type(1) > .acc-toggle {
  background: #ab0f50;  /* magenta */
  color: #241b01;
}
#materials .materials-section:nth-of-type(2) > .acc-toggle {
  background: #f5a500;  /* orange */
  color: #3a7bca;       /* dark text for contrast */
}
#materials .materials-section:nth-of-type(3) > .acc-toggle {
  background: #adcc33;  /* lime */
  color: #1f2937;
}
#materials .materials-section:nth-of-type(4) > .acc-toggle {
  background: #97cdf3;  /* sky */
  color: #404058;
}
#materials .materials-section:nth-of-type(5) > .acc-toggle {
  background: #00489d;  /* blue */
  color: #eaf6fd;
}
/* Ensure the chevron inherits the text color */
#materials .materials-section > .acc-toggle .icon-arrow { fill: currentColor; }

/* アニメーション（計測式） */
#materials .acc-content {
  overflow: hidden;
  height: 0;
  transition: height .3s ease;
}


/* make headers butt up against each other with no white seams */
#materials .materials-section > .acc-toggle { margin: 0; border-bottom: 0; }
#materials .materials-section + .materials-section > .acc-toggle { margin-top: 0; }

/* optional: rounded corners only for first/last header in the group */
#materials .materials-section:first-of-type > .acc-toggle { border-top-left-radius: 10px; border-top-right-radius: 10px; }
#materials .materials-section:last-of-type  > .acc-toggle { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; }


#materials .materials-grid {
  /* Base grid box (column count is controlled by media queries) */
  display: grid;
  gap: 12px;
  padding: 12px;
}
@media (min-width: 901px) {
  /* Desktop: 3 columns */
  #materials .materials-grid { grid-template-columns: repeat(3, 1fr); }
}
#materials .material-set {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: .75rem;
}
#materials .material-set figure {
  margin: .4rem 0;
  display: grid;
  gap: .4rem;
}
#materials .material-set img {
  width: 100%;
  aspect-ratio: var(--thumb-ratio, 4 / 3);
  object-fit: contain;          /* 画像全体を表示（A案） */
  object-position: center;
  background: #f1f5f9;          /* レターボックスの色 */
  border-radius: 8px;
  display: block;
  cursor: zoom-in;              /* ライトボックスの示唆（C案） */
}
/* カテゴリごとに cover（トリミング重視）へ切替可能 */
#materials .materials-grid[data-fit="cover"] .material-set img {
  object-fit: cover;
  background: transparent;
}
/* カテゴリごとに比率切替（任意） */
#materials .materials-grid[data-ratio="3/4"] .material-set img { --thumb-ratio: 3 / 4; }
#materials .materials-grid[data-ratio="1/1"] .material-set img { --thumb-ratio: 1 / 1; }
#materials .material-set h4 {
  font-size: 1rem; margin: .25rem 0 .5rem;
}
#materials .material-set figcaption {
  font-size: .9rem; color: #475569;
}

/* モーション軽減 */
@media (prefers-reduced-motion: reduce) {
  #materials .acc-content {
    transition: none;
  }
  #materials .acc-toggle .icon-arrow {
    transition: none;
  }
}

/* === Lightbox (C案) === */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  display: none; /* 初期は非表示。JSで表示 */
  place-items: center;
  z-index: 10000;
  padding: 4vmin;
}
.lightbox-overlay.open { display: grid; }
.lightbox-inner { position: relative; max-width: 92vw; max-height: 92vh; }
.lightbox-img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 10px; background: #000; display: block;}
.lightbox-actions { position: absolute; right: 8px; top: 8px; display: flex; gap: 8px; }
.lightbox-btn { appearance: none; border: 1px solid #cbd5e1; background: #0f172a; color: #fff; font: inherit; border-radius: 999px; padding: .4rem .8rem; cursor: pointer; opacity: .9; }
.lightbox-btn:hover { opacity: 1; }
.lightbox-close { position: absolute; left: 8px; top: 8px; }
/* === Accordion header: bigger vertical tap target + narrower width on desktop === */
/* Base: keep current for mobile/tablet */
#materials .materials-section > .acc-toggle {
  /* ensure comfortable min tap height even on small screens */
  min-height: 72px;                 /* larger than before */
}

@media (min-width: 901px) {
  /* Desktop: narrow header AND content to the same width (2/3) */
  #materials .materials-section > .acc-toggle,
  #materials .materials-section > .acc-content { 
    width: 66.666%;
    margin-left: auto;
    margin-right: auto;
  }
  /* Taller tap target on desktop */
  #materials .materials-section > .acc-toggle {
    padding-block: 2.25rem;
    min-height: 96px;
  }
}
