/* heic.download - shared styles */
:root {
  --paper: #fbfaf7; --surface: #ffffff; --sunken: #f5f3ee; --ink: #161614; --ink-2: #3b3a36;
  --muted: #6c6a64; --faint: #9b988f; --rule: #e7e4dd; --rule-2: #d5d1c7;
  --ok: #2e6b3e; --err: #a3392a; --focus: #2f5fd0;
  --serif: "Iowan Old Style", Charter, "Bitstream Charter", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111110; --surface: #181816; --sunken: #1f1f1c; --ink: #f0eee8; --ink-2: #d4d1c9;
    --muted: #a09d94; --faint: #74716a; --rule: #2a2926; --rule-2: #3a3834;
    --ok: #86c296; --err: #e48b79; --focus: #8fb0ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15.5px/1.6 var(--sans);
       -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
svg { flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--rule); }
.bar { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand svg { display: block; }
.wm { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -.01em; line-height: 1; }
.wm span { color: var(--muted); font-weight: 400; }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; font-size: 14px; color: var(--muted); padding: 6px 10px; border-radius: 6px; }
.nav a:hover { color: var(--ink); background: var(--sunken); }
.nav a[aria-current="page"] { color: var(--ink); }
@media (max-width: 640px) { .nav { display: none; } }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 40px; max-width: 760px; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 22px; font-size: 12px; font-weight: 600;
           letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--ink); }
.hero h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(38px, 5.6vw, 64px); line-height: 1.04;
           letter-spacing: -.022em; margin: 0 0 20px; }
.hero h1 em { font-style: italic; }
.lead { font-size: 18px; line-height: 1.55; color: var(--ink-2); margin: 0; max-width: 620px; }

/* ---------- Tool ---------- */
.tool { display: grid; grid-template-columns: minmax(0, 1fr) 330px; background: var(--surface);
        border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; }
@media (max-width: 900px) { .tool { grid-template-columns: 1fr; } }
.tool-main { padding: 24px; min-width: 0; }
.tool-side { padding: 24px; border-left: 1px solid var(--rule); background: var(--surface); }
@media (max-width: 900px) { .tool-side { border-left: 0; border-top: 1px solid var(--rule); } }

#drop { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
        min-height: 340px; padding: 40px 24px; border: 1px dashed var(--rule-2); border-radius: 10px;
        background: var(--sunken); cursor: pointer; transition: border-color .15s, background-color .15s, min-height .25s; }
#drop:hover, #drop.over { border-color: var(--ink); }
#drop.over { background: var(--surface); }
.tool.has-files #drop { min-height: 150px; padding: 24px; }
.tool.has-files #drop .drop-icon, .tool.has-files #drop .hint { display: none; }
.drop-icon { color: var(--ink-2); margin-bottom: 18px; }
#drop h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; letter-spacing: -.01em; margin: 0 0 6px; }
.drop-sub { color: var(--muted); margin: 0 0 20px; }
.hint { margin-top: 18px; font-size: 13px; color: var(--faint); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px;
       border-radius: 8px; border: 1px solid var(--rule-2); background: var(--surface); color: var(--ink);
       font-size: 14px; font-weight: 550; cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s, opacity .15s; }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover:not(:disabled) { opacity: .88; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.quiet { border-color: transparent; color: var(--muted); }
.btn.quiet:hover:not(:disabled) { color: var(--ink); border-color: var(--rule-2); }

/* Settings */
.side-title { font-family: var(--serif); font-size: 19px; font-weight: 500; margin: 0 0 18px; }
.field + .field { margin-top: 22px; }
.flabel { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px;
          font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.flabel span { letter-spacing: 0; text-transform: none; font-weight: 400; color: var(--faint); font-size: 12.5px; }

.fmt-list { border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.fmt { position: relative; }
.fmt + .fmt label { border-top: 1px solid var(--rule); }
.fmt input { position: absolute; opacity: 0; pointer-events: none; }
.fmt label { display: grid; grid-template-columns: 52px 1fr 16px; align-items: center; gap: 10px; padding: 11px 14px;
             cursor: pointer; transition: background-color .12s; }
.fmt label:hover { background: var(--sunken); }
.fmt-name { font-family: var(--mono); font-size: 12.5px; font-weight: 600; letter-spacing: .03em; }
.fmt-desc { font-size: 13px; color: var(--muted); line-height: 1.35; }
.tick { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--rule-2); transition: all .12s; }
.fmt input:checked + label { background: var(--sunken); }
.fmt input:checked + label .tick { border-color: var(--ink); background: var(--ink); box-shadow: inset 0 0 0 3px var(--sunken); }
.fmt input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: -2px; }

.range { display: flex; align-items: center; gap: 12px; }
input[type=range] { flex: 1; accent-color: var(--ink); margin: 0; }
output { font: 600 13px var(--mono); min-width: 40px; text-align: right; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--rule); border-radius: 9px; padding: 3px; gap: 2px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { text-align: center; padding: 6px 0; border-radius: 6px; cursor: pointer; font-size: 12.5px; white-space: nowrap; color: var(--muted); }
.seg label:hover { color: var(--ink); }
.seg input:checked + label { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + label { outline: 2px solid var(--focus); }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; }
.toggle .t1 { font-size: 14px; font-weight: 550; display: block; }
.toggle .t2 { font-size: 12.5px; color: var(--muted); }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--rule-2); transition: background-color .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
                      background: var(--surface); transition: transform .15s; }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.side-note { margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--muted);
             display: flex; gap: 8px; align-items: flex-start; }
.side-note svg { margin-top: 2px; color: var(--ok); }

/* Results */
#results { margin-top: 20px; }
.res-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding-bottom: 12px; }
.res-head h3 { font-family: var(--serif); font-weight: 500; font-size: 19px; margin: 0 6px 0 0; }
.count { font: 12.5px var(--mono); color: var(--muted); }
.res-head .spacer { flex: 1; }
.progress { height: 2px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--ink); transition: width .3s; }
#list { list-style: none; margin: 0; padding: 0; }
#list li { display: flex; align-items: center; gap: 14px; padding: 12px 2px; border-bottom: 1px solid var(--rule); }
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--sunken); border: 1px solid var(--rule); flex: none; }
.info { flex: 1; min-width: 0; }
.fname { font-size: 14.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fmeta { font: 12px var(--mono); color: var(--muted); }
.fmeta .arrow { color: var(--faint); padding: 0 4px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); flex: none; min-width: 92px; justify-content: flex-end; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.spin { width: 11px; height: 11px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 32px; height: 32px; border-radius: 7px; display: grid; place-items: center; border: 1px solid transparent;
            background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover:not(:disabled) { color: var(--ink); border-color: var(--rule-2); }
.icon-btn.dl { color: var(--ink); }
.icon-btn:disabled { opacity: .25; cursor: default; }

/* ---------- Trust strip ---------- */
.trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 72px 0 0; border-top: 1px solid var(--ink); }
.trust > div { padding: 24px 28px 0 0; }
.trust > div + div { padding-left: 28px; border-left: 1px solid var(--rule); }
.num { font: 12px var(--mono); color: var(--faint); letter-spacing: .06em; }
.trust h3, .section h2, .more h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; }
.trust h3 { font-size: 21px; margin: 8px 0 8px; }
.trust p { margin: 0; color: var(--muted); font-size: 14.5px; }
@media (max-width: 760px) {
  .trust { grid-template-columns: 1fr; }
  .trust > div, .trust > div + div { padding: 20px 0; border-left: 0; border-bottom: 1px solid var(--rule); }
}

/* ---------- Content ---------- */
.section { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 48px; padding: 64px 0 0; }
@media (max-width: 860px) { .section { grid-template-columns: 1fr; gap: 16px; } }
.section h2 { font-size: 32px; line-height: 1.15; margin: 0; }
.prose { font-size: 16px; color: var(--ink-2); max-width: 680px; }
.prose p { margin: 0 0 16px; }
.prose strong { color: var(--ink); font-weight: 600; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 44px 1fr; padding: 16px 0; border-top: 1px solid var(--rule); }
.steps li:last-child { border-bottom: 1px solid var(--rule); }
.steps li::before { content: counter(s, decimal-leading-zero); font: 12px/1.9 var(--mono); color: var(--faint); }
.steps b { display: block; font-weight: 600; color: var(--ink); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 12px 11px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom-color: var(--ink); }
td:first-child { font-family: var(--mono); font-weight: 600; font-size: 13px; white-space: nowrap; }
tr.current td { background: var(--sunken); }
tr.current td:first-child { padding-left: 8px; }
.table-wrap { overflow-x: auto; }

.faq details { border-top: 1px solid var(--rule); }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 20px; padding: 18px 0;
               font-family: var(--serif); font-size: 19px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--sans); font-weight: 300; font-size: 22px; line-height: 1; color: var(--muted); }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: -4px 0 20px; color: var(--ink-2); max-width: 640px; }

.more { padding: 72px 0 0; }
.more h2 { font-size: 26px; margin: 0 0 18px; }
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.links a { display: block; padding: 16px 18px; border: 1px solid var(--rule); border-radius: 10px; text-decoration: none; background: var(--surface);
           transition: border-color .15s; }
.links a:hover { border-color: var(--ink); }
.links .l1 { font-family: var(--serif); font-size: 18px; display: block; }
.links .l2 { font-size: 13px; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { margin-top: 88px; border-top: 1px solid var(--rule); padding: 32px 0 48px; font-size: 13.5px; color: var(--muted); }
.foot { display: flex; flex-wrap: wrap; gap: 24px 48px; justify-content: space-between; align-items: flex-start; }
.foot .wm { font-size: 18px; color: var(--ink); }
.foot p { margin: 10px 0 0; max-width: 360px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot nav a { text-decoration: none; }
.foot nav a:hover { color: var(--ink); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .spin { animation-duration: 2s; } }

/* Logo mark colors follow the theme */
.mark .mark-bg { fill: var(--ink); }
.mark .mark-fg { stroke: var(--paper); }

/* Effect picker with previews */
.fx { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fx input { position: absolute; opacity: 0; pointer-events: none; }
.fx label { display: flex; flex-direction: column; gap: 6px; cursor: pointer; text-align: center; font-size: 12px; color: var(--muted); }
.fx img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--rule); background: var(--sunken);
          outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .12s; }
.fx label:hover img { border-color: var(--rule-2); }
.fx input:checked + label { color: var(--ink); font-weight: 600; }
.fx input:checked + label img { outline-color: var(--ink); }
.fx input:focus-visible + label img { outline-color: var(--focus); }

/* Row thumbnail opens a preview */
.thumb-btn { padding: 0; border: 0; background: none; border-radius: 6px; cursor: zoom-in; flex: none; }
.thumb-btn:disabled { cursor: default; }
.thumb-btn:hover:not(:disabled) .thumb { border-color: var(--ink); }

/* Preview dialog */
.viewer { border: 0; padding: 0; background: transparent; max-width: min(94vw, 1100px); max-height: 94vh; }
.viewer::backdrop { background: rgba(17, 17, 16, .72); }
.viewer figure { margin: 0; min-width: min(520px, 94vw); background: var(--surface); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.viewer img { display: block; max-width: min(94vw, 1100px); max-height: calc(94vh - 72px); object-fit: contain; background: var(--sunken); margin: 0 auto; }
.viewer figcaption { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--rule); }
.v-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.v-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-meta { font: 12px var(--mono); color: var(--muted); }
