/* jpgtoicon.com – warm & friendly. Flat colour, ink outlines, no gradients. */
:root {
  --bg: #faf6ee;          /* cream paper */
  --surface: #fffdf8;     /* card paper */
  --soft: #f2ebdd;        /* tinted panels */
  --ink: #2b2722;         /* warm charcoal */
  --muted: #6b6358;
  --line: #e4dccd;
  --accent: #3f7a5a;      /* muted green */
  --accent-hover: #336a4c;
  --accent-soft: #e2ede4;
  --on-accent: #fffdf8;
  --mark: #f2c14e;        /* mustard highlight, used sparingly */
  --outline: #2b2722;     /* crisp outlines & offset shadows */
  --chk-a: #fffdf8;
  --chk-b: #efe8da;
  --radius: 16px;
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1a17; --surface: #24211d; --soft: #2c2823; --ink: #efe8dc; --muted: #a89f91; --line: #3a342d;
    --accent: #7fb894; --accent-hover: #93c6a6; --accent-soft: #2b3a30; --on-accent: #1c1a17; --mark: #d9a93a;
    --outline: #0e0d0b; --chk-a: #2a2621; --chk-b: #221f1b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1a17; --surface: #24211d; --soft: #2c2823; --ink: #efe8dc; --muted: #a89f91; --line: #3a342d;
  --accent: #7fb894; --accent-hover: #93c6a6; --accent-soft: #2b3a30; --on-accent: #1c1a17; --mark: #d9a93a;
  --outline: #0e0d0b; --chk-a: #2a2621; --chk-b: #221f1b;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font: 17px/1.65 var(--font); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; padding-bottom: env(safe-area-inset-bottom, 0px);
}
img, svg, canvas { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.015em; margin: 0 0 .5em; font-weight: 800; }
h2 { font-size: clamp(1.55rem, 1.2rem + 1.2vw, 2rem); }
h3 { font-size: 1.12rem; }
code, kbd, pre { font-family: var(--mono); font-size: .88em; }
code { background: var(--soft); padding: .1em .4em; border-radius: 6px; }
kbd { border: 1.5px solid var(--ink); border-bottom-width: 3px; border-radius: 6px; padding: 0 .4em; background: var(--surface); font-size: .78em; color: var(--ink); }
pre { background: var(--soft); border: 1.5px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; overflow-x: auto; }
pre code { background: none; padding: 0; }
:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--mark); color: #2b2722; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding-inline: max(20px, env(safe-area-inset-left, 0px)); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: .5rem 1rem; border-radius: 10px; z-index: 99; }
.skip:focus { left: 8px; }

/* Header */
.site-header { background: var(--bg); border-bottom: 1.5px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-weight: 900; font-size: 1.2rem; letter-spacing: -.02em; }
.brand:hover { color: var(--ink); }
.brand img { border-radius: 9px; }
.brand b { color: var(--accent); font-weight: 900; }
.nav nav { display: flex; align-items: center; gap: .15rem; }
.nav nav a { white-space: nowrap; color: var(--ink); text-decoration: none; font-weight: 700; font-size: .98rem; padding: .4rem .7rem; border-radius: 10px; }
.nav nav a:hover { background: var(--soft); color: var(--ink); }
.nav nav a[aria-current] { text-decoration: underline; text-decoration-color: var(--mark); text-decoration-thickness: 4px; text-underline-offset: 6px; }
.theme-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; margin-left: .35rem; }
.theme-btn:hover { border-color: var(--ink); }
.theme-btn .i-moon { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: block; }
}

/* Hero (left-aligned) */
.hero { padding-block: clamp(2.5rem, 6vw, 4.25rem) clamp(1.5rem, 3vw, 2.25rem); }
.hero h1 { font-size: clamp(2.3rem, 1.4rem + 3.6vw, 3.9rem); font-weight: 900; letter-spacing: -.03em; line-height: 1.05; max-width: 15ch; margin-bottom: .4em; }
.mark { position: relative; white-space: nowrap; color: var(--accent); }
.mark::after {
  content: ""; position: absolute; left: -2%; right: -2%; bottom: -.16em; height: .3em; background: var(--mark);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M3 14 C 40 5, 80 4, 120 9 S 180 13, 197 6' fill='none' stroke='black' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M3 14 C 40 5, 80 4, 120 9 S 180 13, 197 6' fill='none' stroke='black' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  z-index: -1;
}
.mark { isolation: isolate; }
.lead { font-size: clamp(1.08rem, 1rem + .4vw, 1.25rem); color: var(--muted); max-width: 36rem; margin: 0; }
.hero-note { margin: 1.1rem 0 0; color: var(--muted); font-size: .95rem; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; padding: 0; list-style: none; }
.hero-note li { display: inline-flex; align-items: center; gap: .4rem; }
.hero-note svg { color: var(--accent); flex: none; }

/* Converter */
.tool { position: relative; background: var(--surface); border: 2px solid var(--outline); border-radius: 22px; box-shadow: 6px 6px 0 var(--outline); padding: clamp(.75rem, 2vw, 1.1rem); }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .3rem;
  min-height: 300px; border: 2px dashed color-mix(in srgb, var(--ink) 30%, transparent); border-radius: 16px; background: var(--soft);
  cursor: pointer; transition: border-color .2s, background .2s; padding: 2rem 1rem;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { display: block; width: 150px; margin-bottom: .6rem; color: var(--ink); transition: transform .25s; }
.drop-icon svg { display: block; width: 100%; height: auto; overflow: visible; }
.drop:hover .drop-icon { transform: rotate(-2deg) translateY(-2px); }
.drop-title { font-size: 1.45rem; font-weight: 900; letter-spacing: -.02em; }
.drop-sub { color: var(--muted); }
.drop-sub u { color: var(--accent); text-decoration-thickness: 2px; font-weight: 700; }
.drop-types { margin-top: .6rem; font-size: .8rem; color: var(--muted); font-weight: 600; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1rem, 3vw, 2rem); padding: .5rem; }
@media (max-width: 760px) { .editor { grid-template-columns: 1fr; } }
.preview { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.checker { background-color: var(--chk-a); background-image: conic-gradient(var(--chk-b) 25%, transparent 0 50%, var(--chk-b) 0 75%, transparent 0); background-size: 16px 16px; }
.stage { width: 100%; max-width: 340px; aspect-ratio: 1; border-radius: 16px; border: 1.5px solid var(--line); display: grid; place-items: center; padding: 1.5rem; }
.stage canvas { width: 100%; height: auto; }
.minis { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: .9rem; }
.mini { display: flex; flex-direction: column; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.mini canvas { display: block; border-radius: 3px; }
.mini .box { padding: 6px; border-radius: 8px; border: 1.5px solid var(--line); }
.filemeta { margin: 0; font-size: .86rem; color: var(--muted); text-align: center; word-break: break-all; }

.opts { display: flex; flex-direction: column; gap: 1.15rem; min-width: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 800; font-size: .92rem; margin-bottom: .45rem; padding: 0; }
legend small { color: var(--muted); font-weight: 600; margin-left: .3rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.seg { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.seg label, .chips label { position: relative; cursor: pointer; }
.seg input, .chips input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span, .chips span {
  display: block; padding: .38rem .85rem; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface);
  font-size: .9rem; font-weight: 700; color: var(--ink); transition: background .15s, border-color .15s, color .15s; user-select: none;
}
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chips span { min-width: 3.1rem; text-align: center; font-variant-numeric: tabular-nums; }
.seg label:hover span, .chips label:hover span { border-color: var(--ink); }
.seg input:checked + span, .chips input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seg input:focus-visible + span, .chips input:focus-visible + span { outline: 3px solid var(--mark); outline-offset: 2px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.bgrow { display: flex; align-items: center; gap: .6rem; }
input[type="color"] { width: 42px; height: 36px; padding: 2px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .3rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font: inherit; font-weight: 800; font-size: .98rem;
  padding: .7rem 1.15rem; border-radius: 12px; border: 2px solid var(--outline); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; box-shadow: 3px 3px 0 var(--outline); transition: transform .12s, box-shadow .12s, background .12s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--outline); color: var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--outline); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.btn.ghost:hover { transform: none; color: var(--ink); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.actions .btn.primary { flex: 1 1 100%; padding-block: .9rem; font-size: 1.06rem; }

.toast { position: absolute; left: 50%; bottom: 1rem; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 12px; font-size: .9rem; font-weight: 700; transition: all .25s; max-width: calc(100% - 2rem); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Content sections */
.section { padding-block: clamp(3.25rem, 7vw, 5rem) 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 2rem; margin-bottom: 1.6rem; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); max-width: 30rem; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem 2rem; }
.steps li { border-top: 2px dashed color-mix(in srgb, var(--ink) 25%, transparent); padding-top: 1rem; }
.steps li > span { display: block; font-size: 2.6rem; font-weight: 900; line-height: 1; color: var(--accent); margin-bottom: .5rem; }
.steps p, .features p { margin: 0; color: var(--muted); }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.75rem 2.5rem; }
.features article { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto 1fr; gap: .2rem 1rem; align-items: start; }
.features .f-icon { grid-row: 1 / span 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.features h3 { margin: .15rem 0 .2rem; }

.table-wrap { overflow-x: auto; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .97rem; }
th, td { text-align: left; padding: .85rem 1.1rem; border-bottom: 1.5px solid var(--line); }
th { font-weight: 800; background: var(--soft); }
tr:last-child td { border-bottom: 0; }

.faq { max-width: 780px; display: flex; flex-direction: column; border-top: 1.5px solid var(--line); }
.faq details { border-bottom: 1.5px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 800; font-size: 1.05rem; padding: 1.05rem 0; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex: none; width: 10px; height: 10px; border-right: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent); transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.faq details p { margin: 0 0 1.15rem; color: var(--muted); max-width: 680px; }
.related { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.related a { font-weight: 800; color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.related a:hover { color: var(--accent); }

/* Article pages */
.prose { max-width: 740px; padding-block: 2.5rem 1rem; }
.prose h1 { font-size: clamp(2.1rem, 1.5rem + 2.6vw, 3.1rem); font-weight: 900; letter-spacing: -.03em; }
.prose .lead { margin: 0 0 2rem; }
.prose h2 { margin-top: 2.4rem; font-size: 1.6rem; }
.prose h3 { margin-top: 1.6rem; }
.prose li { margin-bottom: .4rem; }
.prose li::marker { color: var(--accent); font-weight: 800; }
.prose .table-wrap { margin: 1rem 0; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 1.2rem; }
.crumbs a { color: var(--muted); }
.callout { background: var(--accent-soft); border-left: 5px solid var(--accent); border-radius: 4px 14px 14px 4px; padding: 1rem 1.25rem; }
.cta { margin-top: 2.5rem; }
.center { text-align: center; }

/* Footer */
.site-footer { margin-top: clamp(4.5rem, 9vw, 7rem); border-top: 1.5px solid var(--line); background: var(--soft); padding-block: 2.75rem 1.5rem; }
.foot { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
@media (max-width: 680px) { .foot { grid-template-columns: 1fr 1fr; } .foot > div { grid-column: 1 / -1; } }
.foot p { color: var(--muted); font-size: .95rem; max-width: 30ch; }
.foot nav { display: flex; flex-direction: column; gap: .35rem; }
.foot nav h2 { font-size: .95rem; font-weight: 900; margin: 0 0 .3rem; letter-spacing: 0; }
.foot nav a { color: var(--ink); text-decoration: none; font-size: .96rem; }
.foot nav a:hover { color: var(--accent); text-decoration: underline; }
.copy { margin-top: 2rem; font-size: .85rem; color: var(--muted); }

@media (max-width: 560px) {
  .hide-sm { display: none; }
  .nav { gap: .5rem; }
  .nav nav a { padding: .4rem .5rem; font-size: .93rem; }
  .row2 { grid-template-columns: 1fr; }
  .tool { box-shadow: 4px 4px 0 var(--outline); }
}
@media (max-width: 430px) { .hide-xs { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
