/* =====================================================================
   Free Image Splitter — design system (Apple-inspired)
   Clean, airy, light-first. Single stylesheet, no build step.
   SF system font · near-black text · Apple blue · pill buttons ·
   alternating white / #f5f5f7 bands · minimal shadows.
   ===================================================================== */

:root {
  /* brand */
  --accent: #0071e3;          /* Apple blue */
  --accent-600: #0077ed;
  --accent-press: #006edb;
  --accent-050: #e8f2fd;
  --link: #06c;
  --accent-contrast: #ffffff;

  /* neutrals (light) */
  --bg: #ffffff;
  --bg-soft: #f5f5f7;         /* Apple light gray band */
  --bg-inset: #f5f5f7;
  --surface: #ffffff;
  --border: #d2d2d7;
  --text: #1d1d1f;            /* Apple near-black */
  --text-soft: #6e6e73;
  --text-mute: #86868b;

  --ok: #1d9d54;
  --danger: #e30000;

  /* type — the system stack IS SF Pro on Apple devices */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --h1: clamp(2.4rem, 5.5vw, 3.75rem);
  --h2: clamp(1.75rem, 3.6vw, 2.75rem);

  /* shape */
  --r-sm: 10px; --r: 16px; --r-lg: 22px; --r-pill: 980px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .05);
  --shadow: 0 4px 16px rgba(0, 0, 0, .07);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, .12);

  --maxw: 1080px;
  --gap: clamp(1rem, 2.4vw, 2rem);
}

[data-theme="dark"] {
  --accent: #2997ff;
  --accent-600: #3aa0ff;
  --accent-press: #1a86f0;
  --accent-050: #16233a;
  --link: #2997ff;
  --accent-contrast: #ffffff;
  --bg: #000000;
  --bg-soft: #101012;
  --bg-inset: #1d1d1f;
  --surface: #1d1d1f;
  --border: #424245;
  --text: #f5f5f7;
  --text-soft: #a1a1a6;
  --text-mute: #86868b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --shadow: 0 6px 20px rgba(0,0,0,.55);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--text);
  background: var(--bg); line-height: 1.47;
  font-size: 17px; letter-spacing: -0.01em; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.08; letter-spacing: -0.022em; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: var(--h1); font-weight: 600; }
h2 { font-size: var(--h2); font-weight: 600; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; color: var(--text-soft); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 2rem); }
.section { padding-block: clamp(3.5rem, 9vw, 6.5rem); }
.section--soft { background: var(--bg-soft); }
.center { text-align: center; }
.lede { font-size: clamp(1.2rem, 2.4vw, 1.6rem); font-weight: 500; color: var(--text); max-width: 34ch; margin-inline: auto; line-height: 1.3; letter-spacing: -0.015em; }
.eyebrow { color: var(--text-mute); font-weight: 600; letter-spacing: -0.01em; font-size: .95rem; margin: 0 0 .6rem; }

/* ---------- header (frosted, Apple-style) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}
.nav { display: flex; align-items: center; gap: 1rem; height: 52px; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--text); font-size: 1.05rem; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #a2d1ff); display: grid; place-items: center; color: #fff; font-size: .95rem; }
.nav-links { margin-left: auto; display: flex; align-items: center; gap: 1.5rem; }
.nav-links a { color: var(--text); opacity: .82; font-weight: 400; font-size: .95rem; letter-spacing: -0.01em; }
.nav-links a:hover { opacity: 1; text-decoration: none; }
.theme-toggle {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: transparent; color: var(--text-soft); cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { width: 17px; height: 17px; }
[data-theme="light"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (max-width: 640px) { .nav-links .nav-guides { display: none; } }

/* ---------- hero ---------- */
.hero { padding-block: clamp(3rem, 8vw, 5rem) clamp(1.5rem, 4vw, 2.5rem); text-align: center; }
.hero .badge {
  display: inline-flex; gap: .45rem; align-items: center; background: var(--bg-soft);
  color: var(--text-soft); font-weight: 500; font-size: .85rem; padding: .35rem .85rem; border-radius: var(--r-pill); margin-bottom: 1.2rem;
}
.hero h1 { max-width: 16ch; margin-inline: auto; }
.hero p.lede { margin-top: .5rem; }

/* ---------- buttons (Apple pill) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 400; font-size: 1.0rem; cursor: pointer; border: 1px solid transparent;
  padding: .75rem 1.35rem; border-radius: var(--r-pill); transition: background .2s ease, color .2s ease, border-color .2s ease; white-space: nowrap; letter-spacing: -0.01em;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-600); }
.btn-primary:active { background: var(--accent-press); }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-ghost:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

/* ---------- the tool ---------- */
.tool-shell { max-width: 1000px; margin-inline: auto; }

.dropzone {
  border: 1.5px dashed var(--border); border-radius: var(--r-lg); background: var(--bg-soft);
  padding: clamp(2.25rem, 6vw, 3.75rem); text-align: center; cursor: pointer; transition: .18s ease;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: var(--accent-050); }
.dropzone .icon { width: 54px; height: 54px; margin: 0 auto 1rem; color: var(--accent); }
.dropzone h2 { font-size: 1.4rem; }
.dropzone .hint { color: var(--text-mute); font-size: .92rem; }

/* workspace */
.workspace { margin-top: 1.75rem; display: grid; grid-template-columns: 320px 1fr; gap: var(--gap); align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.panel--controls { padding: 1.25rem; position: sticky; top: 72px; background: var(--bg-soft); border: none; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.file-row .fname { font-weight: 500; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .btn { padding: .4rem .9rem; font-size: .85rem; }

.field { margin-bottom: 1rem; }
.field > label { display: block; font-weight: 500; font-size: .85rem; margin-bottom: .35rem; color: var(--text); }
.control, select, input[type="number"] {
  width: 100%; font: inherit; padding: .6rem .75rem; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); letter-spacing: -0.01em;
}
.control:focus, select:focus, input:focus { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 0; border-color: var(--accent); }
.size-row { display: grid; grid-template-columns: 1fr 1.1fr; gap: .5rem; align-items: end; }
.size-row .unit { font-size: .82rem; color: var(--text-mute); padding-bottom: .65rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--text-soft); font-weight: 500; }
.check input { width: auto; }

.readout { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: .85rem 1rem; margin: .25rem 0 1rem; }
.readout .big { font-weight: 600; font-size: 1.1rem; color: var(--text); letter-spacing: -0.02em; }
.readout .sub { font-size: .82rem; color: var(--text-mute); }

.export-row { display: grid; gap: .6rem; }

/* preview */
.panel--preview { padding: 1.25rem; }
.preview-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1rem; }
.preview-head h2 { font-size: 1.15rem; margin: 0; }
.preview-head .muted { color: var(--text-mute); font-size: .85rem; }
.sheets {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  max-width: 100%;
}
@media (max-width: 900px) { .workspace { grid-template-columns: 1fr; } .panel--controls { position: static; } }
@media (max-width: 560px) { .sheets { grid-template-columns: repeat(min(var(--cols,1), 2), 1fr); } }
.sheet-wrap { margin: 0; text-align: center; }
.sheet { width: 100%; height: auto; border-radius: 6px; box-shadow: var(--shadow); background: #fff; }
.sheet-wrap figcaption { font-size: .78rem; color: var(--text-mute); margin-top: .4rem; }

/* ---------- content sections ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.25rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.6rem; }
.section--soft .card { background: var(--bg); }
.card h3 { font-size: 1.1rem; }
.card p { margin: 0; font-size: .95rem; }
.card .ico { font-size: 1.7rem; display: block; margin-bottom: .5rem; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.6rem; }
.step { position: relative; padding-left: 3.3rem; }
.step .n { position: absolute; left: 0; top: 0; width: 2.3rem; height: 2.3rem; border-radius: var(--r-pill); background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; }
.step h3 { font-size: 1.15rem; margin-bottom: .3rem; }
.step p { font-size: .95rem; margin: 0; }

.faq-grid { display: grid; gap: .75rem; max-width: 760px; margin-inline: auto; }
details.faq { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: .3rem 1.15rem; }
.section--soft details.faq { background: var(--bg); }
details.faq summary { cursor: pointer; font-weight: 500; padding: .85rem 0; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; color: var(--accent); font-weight: 400; font-size: 1.3rem; line-height: 1; }
details.faq[open] summary::after { content: "–"; }
details.faq p { padding-bottom: .9rem; margin: 0; }

/* guide link list */
.guide-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .75rem; }
.guide-links a { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: .95rem 1.1rem; color: var(--text); font-weight: 500; display: flex; gap: .6rem; transition: .15s ease; }
.section--soft .guide-links a { background: var(--bg); }
.guide-links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- ad slots ---------- */
.ad-slot { max-width: var(--maxw); margin: 2.5rem auto; padding-inline: 1rem; }
.ad-slot > div {
  min-height: 90px; border: 1px dashed var(--border); border-radius: var(--r);
  display: grid; place-items: center; color: var(--text-mute); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase;
  background: var(--bg-soft);
}

/* ---------- share + footer ---------- */
.share { display: flex; gap: .7rem; justify-content: center; margin: 1rem 0; }
.share a { width: 42px; height: 42px; border-radius: var(--r-pill); display: grid; place-items: center; color: #fff; }
.share svg { width: 19px; height: 19px; }
.share .wa { background: #25d366; } .share .sms { background: #0b93f6; } .share .em { background: #86868b; }

.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); padding-block: 2.75rem; margin-top: 2rem; }
.site-footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
.site-footer h4 { font-size: .8rem; text-transform: none; letter-spacing: -0.01em; color: var(--text); font-weight: 600; margin: 0 0 .8rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.site-footer a { color: var(--text-soft); font-size: .9rem; }
.site-footer a:hover { color: var(--text); }
.site-footer .fine { margin-top: 1.8rem; padding-top: 1.4rem; border-top: 1px solid var(--border); color: var(--text-mute); font-size: .82rem; text-align: center; }
@media (max-width: 720px) { .site-footer .cols { grid-template-columns: 1fr; gap: 1.4rem; } }

/* ---------- loading ---------- */
.loading { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 60; }
.loading .box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1.6rem 2rem; box-shadow: var(--shadow-lg); text-align: center; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto .8rem; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* article pages */
.article { max-width: 720px; margin-inline: auto; }
.article h2 { margin-top: 2.4rem; }
.article h3 { margin-top: 1.7rem; }
.article p, .article li { color: var(--text-soft); }
.article a { color: var(--link); }
.breadcrumb { font-size: .85rem; color: var(--text-mute); margin-bottom: 1.2rem; }
.breadcrumb a { color: var(--text-mute); }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 var(--r-sm) 0; z-index: 100; }
.skip-link:focus { left: 0; }
