/* =========================================================
   ToolDock Common Styles
   ========================================================= */

:root {
  /* Base */
  --color-bg: #f6f8fc;
  --color-surface: #ffffff;
  --color-surface-soft: #f8fafc;

  /* Text */
  --color-text: #172033;
  --color-text-sub: #64748b;
  --color-text-light: #94a3b8;

  /* Border */
  --color-border: #e2e8f0;
  --color-border-soft: #e8edf4;

  /* Brand */
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-primary-soft: #eef2ff;

  --color-secondary: #2563eb;
  --color-secondary-soft: #eff6ff;

  /* Status */
  --color-success: #16a34a;
  --color-success-soft: #f0fdf4;

  --color-warning: #ea580c;
  --color-warning-soft: #fff7ed;

  --color-danger: #dc2626;
  --color-danger-soft: #fef2f2;

  /* Tool accents */
  --tool-resize: #2563eb;
  --tool-compress: #16a34a;
  --tool-convert: #7c3aed;
  --tool-rotate: #0891b2;
  --tool-crop: #e11d48;
  --tool-info: #475569;
  --tool-aspect: #ea580c;
  --tool-combine: #0f766e;
  --tool-blur: #4f46e5;
  --tool-color-picker: #c026d3;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Shadow */
  --shadow-sm:
    0 4px 16px rgba(15, 23, 42, .05);

  --shadow-md:
    0 10px 30px rgba(15, 23, 42, .08);

  /* Layout */
  --content-width: 1100px;
  --text-width: 900px;
}

/* =========================================================
   Reset
   ========================================================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;

  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Noto Sans JP",
    sans-serif;

  background:
    linear-gradient(
      180deg,
      #f8faff 0%,
      var(--color-bg) 260px
    );

  color: var(--color-text);

  line-height: 1.7;
}

img {
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  max-width: 100%;
  min-width: 0;

  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

/* =========================================================
   Header
   ========================================================= */

.site-header {
  position: relative;
  z-index: 20;

  background:
    rgba(255, 255, 255, .94);

  border-bottom:
    1px solid rgba(226, 232, 240, .9);

  box-shadow:
    0 1px 10px rgba(15, 23, 42, .025);

  backdrop-filter: blur(10px);
}

.site-header-inner {
  max-width: var(--content-width);

  margin: 0 auto;
  padding: 17px 20px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 24px;
}

.site-brand {
  display: flex;
  align-items: center;

  gap: 10px;

  color: var(--color-primary);

  text-decoration: none;

  flex-shrink: 0;
}

.site-brand-mark {
  width: 32px;
  height: 32px;

  border-radius: 9px;

  object-fit: cover;

  box-shadow:
    0 4px 12px rgba(79, 70, 229, .14);
}

.site-brand-name {
  font-size: 23px;
  font-weight: 850;
  letter-spacing: -.025em;

  white-space: nowrap;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;

  gap: 18px;
}

.site-nav a {
  position: relative;

  color: var(--color-text-sub);

  font-size: 14px;
  font-weight: 650;

  text-decoration: none;

  transition:
    color .15s ease;
}

.site-nav a:hover {
  color: var(--color-primary);
}

/* =========================================================
   Main layout
   ========================================================= */

.site-main {
  max-width: var(--content-width);

  margin: 0 auto;

  padding:
    42px
    20px
    80px;
}

.site-main-narrow {
  max-width: var(--text-width);

  margin: 0 auto;

  padding:
    42px
    20px
    80px;
}

/* =========================================================
   Breadcrumb
   ========================================================= */

.breadcrumb {
  margin-bottom: 24px;

  color: var(--color-text-sub);

  font-size: 14px;
}

.breadcrumb a {
  color: var(--color-text-sub);

  text-decoration: none;

  transition:
    color .15s ease;
}

.breadcrumb a:hover {
  color: var(--color-primary);
}

/* =========================================================
   Page header
   ========================================================= */

.page-header {
  margin-bottom: 30px;
}

.page-title {
  margin: 0 0 12px;

  color: #111827;

  font-size: 36px;
  font-weight: 850;

  line-height: 1.35;

  letter-spacing: -.025em;
}

.page-lead {
  max-width: 760px;

  margin: 0;

  color: var(--color-text-sub);

  font-size: 16px;
  line-height: 1.9;
}

/* =========================================================
   Cards
   ========================================================= */

.card {
  padding: 30px;

  border:
    1px solid var(--color-border-soft);

  border-radius:
    var(--radius-lg);

  background:
    rgba(255, 255, 255, .96);

  box-shadow:
    var(--shadow-sm);
}

.card + .card {
  margin-top: 24px;
}

/* =========================================================
   Buttons
   ========================================================= */

.button {
  display: inline-flex;

  justify-content: center;
  align-items: center;

  min-height: 44px;

  padding:
    11px
    17px;

  border: 0;

  border-radius: 10px;

  font-weight: 750;

  text-decoration: none;

  cursor: pointer;

  transition:
    background-color .15s ease,
    border-color .15s ease,
    color .15s ease,
    transform .15s ease,
    box-shadow .15s ease;
}

.button:hover {
  transform:
    translateY(-1px);
}

.button:disabled {
  opacity: .5;

  cursor: default;

  transform: none;

  box-shadow: none;
}

.button-primary {
  background:
    linear-gradient(
      135deg,
      #4f46e5,
      #4338ca
    );

  color: #fff;

  box-shadow:
    0 6px 16px rgba(79, 70, 229, .20);
}

.button-primary:hover {
  background:
    linear-gradient(
      135deg,
      #4338ca,
      #3730a3
    );

  box-shadow:
    0 8px 20px rgba(79, 70, 229, .25);
}

.button-secondary {
  border:
    1px solid #dbe2f0;

  background:
    #f1f5ff;

  color:
    var(--color-primary);
}

.button-secondary:hover {
  border-color:
    #c7d2fe;

  background:
    #e9edff;
}

.button-soft {
  border:
    1px solid var(--color-border);

  background:
    var(--color-surface);

  color:
    #475569;
}

.button-soft:hover {
  border-color:
    #c7d2fe;

  color:
    var(--color-primary);

  background:
    #f8f9ff;
}

/* =========================================================
   Form
   ========================================================= */

.form-field {
  margin-top: 22px;
}

.form-label {
  display: block;

  margin-bottom: 8px;

  color:
    var(--color-text);

  font-weight: 700;
}

.form-control {
  width: 100%;

  min-height: 46px;

  padding:
    11px
    12px;

  border:
    1px solid #d1d5db;

  border-radius:
    var(--radius-sm);

  background: #fff;

  color:
    var(--color-text);

  transition:
    border-color .15s ease,
    box-shadow .15s ease,
    background-color .15s ease;
}

.form-control:hover {
  border-color:
    #c7d2fe;
}

.form-control:focus {
  outline: none;

  border-color:
    #818cf8;

  box-shadow:
    0 0 0 3px rgba(99, 102, 241, .13);

  background:
    #fff;
}

textarea.form-control {
  min-height: 180px;

  resize: vertical;

  line-height: 1.7;
}

.form-help {
  margin-top: 7px;

  color:
    var(--color-text-sub);

  font-size: 13px;

  line-height: 1.7;
}

/* =========================================================
   Notice
   ========================================================= */

.notice {
  padding:
    18px
    20px;

  border:
    1px solid #dbeafe;

  border-radius:
    var(--radius-md);

  background:
    linear-gradient(
      135deg,
      #eff6ff,
      #eef2ff
    );

  color:
    #475569;

  line-height: 1.8;
}

.notice strong {
  color:
    var(--color-text);
}

/* =========================================================
   Tool cards
   ========================================================= */

.tool-grid {
  display: grid;

  grid-template-columns:
    repeat(3, 1fr);

  gap: 20px;
}

.tool-card {
  position: relative;

  display: block;

  padding: 24px;

  border:
    1px solid var(--color-border-soft);

  border-radius:
    var(--radius-lg);

  background:
    linear-gradient(
      180deg,
      #ffffff 0%,
      #fbfcff 100%
    );

  color: inherit;

  text-decoration: none;

  box-shadow:
    var(--shadow-sm);

  overflow: hidden;

  transition:
    transform .18s ease,
    box-shadow .18s ease,
    border-color .18s ease;
}

.tool-card::before {
  content: "";

  position: absolute;

  top: 0;
  left: 0;
  right: 0;

  height: 3px;

  background:
    linear-gradient(
      90deg,
      #6366f1,
      #8b5cf6
    );

  opacity: 0;

  transition:
    opacity .18s ease;
}

.tool-card:hover {
  transform:
    translateY(-3px);

  border-color:
    #c7d2fe;

  box-shadow:
    var(--shadow-md);
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card-icon {
  display: flex;

  justify-content: center;
  align-items: center;

  width: 48px;
  height: 48px;

  margin-bottom: 14px;

  border-radius: 12px;

  background:
    linear-gradient(
      135deg,
      #eef2ff,
      #f5f3ff
    );

  font-size: 27px;
}

.tool-card-title {
  margin:
    0
    0
    9px;

  color:
    #111827;

  font-size: 20px;

  font-weight: 800;
}

.tool-card-description {
  margin: 0;

  color:
    var(--color-text-sub);

  font-size: 14px;

  line-height: 1.7;
}

.tool-badge {
  display: inline-block;

  margin-top: 14px;

  padding:
    5px
    9px;

  border:
    1px solid #e0e7ff;

  border-radius: 999px;

  background:
    #eef2ff;

  color:
    #4f46e5;

  font-size: 12px;

  font-weight: 700;
}

/* =========================================================
   Tool accent helpers
   ========================================================= */

.tool-accent-resize {
  --tool-accent: var(--tool-resize);
}

.tool-accent-compress {
  --tool-accent: var(--tool-compress);
}

.tool-accent-convert {
  --tool-accent: var(--tool-convert);
}

.tool-accent-rotate {
  --tool-accent: var(--tool-rotate);
}

.tool-accent-crop {
  --tool-accent: var(--tool-crop);
}

.tool-accent-info {
  --tool-accent: var(--tool-info);
}

.tool-accent-aspect {
  --tool-accent: var(--tool-aspect);
}

.tool-accent-combine {
  --tool-accent: var(--tool-combine);
}

.tool-accent-blur {
  --tool-accent: var(--tool-blur);
}

.tool-accent-color-picker {
  --tool-accent:
    var(--tool-color-picker);
}

/* =========================================================
   Content sections
   ========================================================= */

.content-section {
  margin-top: 38px;
}

.content-section h2 {
  margin:
    0
    0
    14px;

  color:
    #111827;

  font-size: 22px;

  font-weight: 800;
}

.content-section h3 {
  margin:
    28px
    0
    10px;

  color:
    #1f2937;

  font-size: 18px;
}

.content-section p {
  line-height: 1.9;
}

.content-section ul,
.content-section ol {
  padding-left: 1.4em;

  line-height: 1.9;
}

/* =========================================================
   Related links
   ========================================================= */

.related-links {
  display: flex;

  flex-wrap: wrap;

  gap: 10px;
}

.related-links a {
  display: inline-block;

  padding:
    9px
    13px;

  border:
    1px solid var(--color-border);

  border-radius:
    var(--radius-sm);

  background:
    var(--color-surface);

  color:
    #475569;

  font-weight: 650;

  text-decoration: none;

  transition:
    color .15s ease,
    border-color .15s ease,
    background-color .15s ease;
}

.related-links a:hover {
  border-color:
    #c7d2fe;

  background:
    #f5f7ff;

  color:
    var(--color-primary);
}

/* =========================================================
   Footer
   ========================================================= */

.site-footer {
  padding:
    34px
    20px;

  border-top:
    1px solid var(--color-border);

  background:
    linear-gradient(
      180deg,
      #ffffff,
      #f8f9fd
    );
}

.site-footer-inner {
  max-width:
    var(--content-width);

  margin:
    0 auto;
}

.site-footer-top {
  display: flex;

  justify-content:
    space-between;

  gap: 40px;

  margin-bottom: 24px;
}

.site-footer-brand {
  max-width: 420px;
}

.site-footer-title {
  margin-bottom: 8px;

  color:
    var(--color-primary);

  font-size: 20px;

  font-weight: 850;
}

.site-footer-description {
  margin: 0;

  color:
    var(--color-text-sub);

  font-size: 14px;

  line-height: 1.7;
}

.site-footer-links {
  display: flex;

  flex-wrap: wrap;

  align-content:
    flex-start;

  gap:
    10px
    18px;

  max-width: 470px;
}

.site-footer-links a {
  color:
    #475569;

  font-size: 13px;

  font-weight: 600;

  text-decoration: none;

  transition:
    color .15s ease;
}

.site-footer-links a:hover {
  color:
    var(--color-primary);
}

.site-footer-bottom {
  padding-top: 20px;

  border-top:
    1px solid #eef2f7;

  color:
    var(--color-text-light);

  font-size: 12px;
}

/* =========================================================
   Utility
   ========================================================= */

.text-muted {
  color:
    var(--color-text-sub);
}

.text-center {
  text-align: center;
}

.hidden {
  display: none !important;
}

/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 850px) {
  .tool-grid {
    grid-template-columns:
      repeat(2, 1fr);
  }

  .site-footer-top {
    flex-direction: column;
  }
}

/* =========================================================
   Smartphone
   ========================================================= */

@media (max-width: 650px) {
  body {
    overflow-x: hidden;
  }

  .site-header-inner {
    padding:
      10px
      14px
      9px;

    flex-direction: column;
    align-items: stretch;

    gap: 8px;
  }

  .site-brand {
    align-self: flex-start;

    min-height: 36px;

    gap: 8px;
  }

  .site-brand-mark {
    width: 30px;
    height: 30px;

    border-radius: 7px;
  }

  .site-brand-name {
    font-size: 20px;
  }

  .site-nav {
    display: grid;

    grid-template-columns:
      repeat(
        3,
        minmax(0, 1fr)
      );

    width: 100%;

    gap: 6px;
  }

  .site-nav a {
    display: flex;

    justify-content: center;
    align-items: center;

    min-width: 0;
    min-height: 44px;

    padding:
      7px
      5px;

    border:
      1px solid #eef2f7;

    border-radius: 8px;

    background: #f8fafc;

    font-size: 11.5px;
    line-height: 1.3;

    text-align: center;
    white-space: normal;
  }

  .site-nav a:hover {
    border-color: #dbe2f0;

    background: #f5f7ff;
  }

  .site-main,
  .site-main-narrow {
    width: 100%;
    min-width: 0;

    padding:
      24px
      14px
      52px;
  }

  .breadcrumb {
    margin-bottom: 18px;

    font-size: 12px;
    line-height: 1.6;

    overflow-wrap: anywhere;
  }

  .page-header {
    margin-bottom: 24px;
  }

  .page-title {
    font-size: 27px;

    line-height: 1.4;
  }

  .page-lead {
    font-size: 15px;

    line-height: 1.8;
  }

  .card {
    min-width: 0;

    padding:
      20px
      18px;

    border-radius: 14px;
  }

  .tool-grid {
    grid-template-columns: 1fr;

    gap: 16px;
  }

  .tool-card {
    min-width: 0;

    padding:
      20px
      18px;

    border-radius: 14px;
  }

  .tool-card-icon {
    width: 44px;
    height: 44px;

    margin-bottom: 10px;

    font-size: 24px;
  }

  .tool-card-title {
    font-size: 19px;
  }

  .tool-card-description {
    font-size: 14px;

    line-height: 1.65;
  }

  .tool-badge {
    margin-top: 12px;

    font-size: 11px;
  }

  .content-section {
    margin-top: 30px;
  }

  .content-section h2 {
    font-size: 20px;
  }

  .content-section p,
  .content-section li {
    overflow-wrap: anywhere;
  }

  .related-links {
    display: grid;

    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      );

    gap: 8px;
  }

  .related-links a {
    display: flex;

    justify-content: center;
    align-items: center;

    min-width: 0;
    min-height: 44px;

    padding:
      9px
      10px;

    font-size: 13px;
    line-height: 1.45;

    text-align: center;

    overflow-wrap: anywhere;
  }

  /*
   * 個別ツール側の小ボタンを、
   * スマホで押しやすい44px前後へ統一。
   */
  body .small-button,
  body .history-button,
  body .clear-button,
  body .reset-button,
  body .copy-button,
  body .image-button,
  body .ratio-button,
  body .preset-button,
  body .variant-button,
  body .color-swatch-button,
  body .base-option span {
    min-height: 44px;
  }

  body .icon-button {
    min-width: 44px;
    height: 44px;

    padding:
      0
      10px;
  }

  input[type="range"] {
    min-height: 44px;
  }

  input[type="color"] {
    min-width: 44px;
    min-height: 44px;
  }

  /*
   * Cropの四隅ハンドルは見た目を変えず、
   * タッチ判定だけ広げる。
   */
  .handle::before {
    content: "";

    position: absolute;

    inset: -12px;
  }

  /*
   * Canvasや結果画像が親幅を超えないよう補強。
   */
  .canvas-shell,
  .picker-canvas,
  .editor-canvas,
  .result-preview,
  .image-preview {
    max-width: 100%;
  }

  body .result-preview-wrap {
    max-width: 100%;

    overflow: auto;
  }

  .color-value-text,
  .image-meta-text,
  .image-item-info {
    min-width: 0;
  }

  .site-footer {
    padding:
      28px
      16px;
  }

  .site-footer-top {
    gap: 22px;

    margin-bottom: 20px;
  }

  .site-footer-title {
    font-size: 19px;
  }

  .site-footer-description {
    max-width: 100%;

    font-size: 13px;

    line-height: 1.7;
  }

  .site-footer-links {
    display: grid;

    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      );

    width: 100%;

    max-width: none;

    gap: 8px;
  }

  .site-footer-links a {
    display: flex;

    align-items: center;

    min-width: 0;
    min-height: 44px;

    padding:
      6px
      0;

    font-size: 12px;

    line-height: 1.5;

    overflow-wrap: anywhere;
  }

  .site-footer-bottom {
    font-size: 11px;
  }
}

/* =========================================================
   Very small smartphone
   ========================================================= */

@media (max-width: 390px) {
  .site-header-inner {
    padding-left: 12px;
    padding-right: 12px;
  }

  .site-nav {
    gap: 5px;
  }

  .site-nav a {
    padding-left: 3px;
    padding-right: 3px;

    font-size: 11px;
  }

  .site-main,
  .site-main-narrow {
    padding-left: 12px;
    padding-right: 12px;
  }

  .related-links {
    grid-template-columns: 1fr;
  }

  .site-footer-links {
    grid-template-columns: 1fr;
  }
}
