/* iPhone Photo Converter — calm, plain, fast. No frameworks, no outside requests. */

* { box-sizing: border-box; }

:root {
  --ink: #2b2a28;
  --muted: #6f6a63;
  --paper: #faf8f5;
  --card: #ffffff;
  --line: #e6e1d8;
  --accent: #b4552d;      /* warm Terracotta */
  --accent-dark: #8f4223;
  --good: #2e6b46;
  --bad: #a03325;
}

html, body { margin: 0; padding: 0; }

body {
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top { text-align: center; padding: 40px 20px 8px; }
.top h1 {
  font-size: 34px; margin: 0 0 6px; letter-spacing: -0.5px;
}
.tag { color: var(--muted); margin: 0 auto; max-width: 34em; }

main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 24px 20px 40px; }

/* --- the drop area --- */
.drop {
  border: 2px dashed var(--line);
  border-radius: 18px;
  background: var(--card);
  text-align: center;
  padding: 44px 24px 36px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:focus-visible, .drop:hover { border-color: var(--accent); }
.drop.over { border-color: var(--accent); background: #fdf3ec; }

.drop-big { font-size: 22px; font-weight: 600; margin: 0 0 2px; }
.drop-small { color: var(--muted); margin: 6px 0 10px; }
.drop-note { color: var(--muted); font-size: 14px; margin: 14px 0 0; }

/* --- buttons --- */
button {
  font: inherit;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 11px 22px;
  cursor: pointer;
}
button:hover { background: var(--accent-dark); }
button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
button.ghost:hover { color: var(--ink); border-color: var(--muted); }

/* --- results --- */
#results { margin-top: 22px; display: grid; gap: 12px; }

.card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
}
.thumb {
  width: 64px; height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: #f0ece4;
}
.meta { min-width: 0; }
.name {
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sizes { color: var(--muted); font-size: 14px; }
.state-working { color: var(--accent-dark); font-size: 14px; }
.state-done { color: var(--good); font-size: 14px; }
.state-failed { color: var(--bad); font-size: 14px; }

#actions {
  margin-top: 18px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
#actions[hidden] { display: none; }

footer {
  text-align: center;
  padding: 18px 20px 30px;
  color: var(--muted);
  font-size: 14px;
}
.privacy { margin: 0 0 6px; }
.credit a { color: inherit; }

/* --- the one tidy "More tools" menu across the top --- */
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.toolspicker {
  display: flex; justify-content: center; margin: 14px auto 0; padding: 0 20px;
}
.toolspicker select {
  font: inherit; font-size: 15px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; background: var(--card); cursor: pointer;
}
.toolspicker select:hover { border-color: var(--muted); }

/* --- settings above the drop area --- */
.options {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 16px; margin-bottom: 16px;
}
.options label { font-weight: 600; }
.options .group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.options[hidden], .options .group[hidden] { display: none; }
.options input[type="number"] {
  font: inherit; width: 6.5em; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.options select {
  font: inherit; padding: 8px 10px; margin-left: 6px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.options input[type="range"] { width: 200px; accent-color: var(--accent); }
.options .quick { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 14px; }
button.small { padding: 5px 12px; font-size: 14px; border-radius: 8px; }

/* --- a plain line under the drop area when files were skipped --- */
.notice {
  margin: 14px 0 0; padding: 10px 14px; border-radius: 10px;
  background: #fbeee9; color: var(--bad); font-size: 15px;
}
.notice[hidden] { display: none; }

/* --- the short explanation at the foot of each page --- */
.about { margin-top: 40px; color: var(--muted); }
.about h2 { font-size: 18px; color: var(--ink); margin: 0 0 6px; }
.about p { margin: 0; max-width: 38em; }

/* --- plain text pages (privacy, about, not found) --- */
main.text { padding-top: 28px; }
main.text h2 { font-size: 19px; margin: 26px 0 6px; }
main.text p, main.text li { max-width: 38em; }
main.text a { color: var(--accent-dark); }
.updated { color: var(--muted); font-size: 14px; margin: 0; }
.links { margin: 0 0 6px; }
.links a { color: inherit; }

/* --- images to PDF: the ordered list and the finished-PDF box --- */
.pdf-list { display: grid; gap: 12px; }
.row-buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-buttons button:disabled { opacity: .35; cursor: default; }
#actions button:disabled { opacity: .5; cursor: default; }
.pdf-out {
  margin-top: 18px; padding: 14px 16px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--good);
}
.pdf-out p { margin: 0 0 10px; color: var(--good); }
.pdf-out[hidden] { display: none; }
.options label:has(select:disabled) { opacity: .5; }


/* --- crop & rotate --- */
.editor { margin-top: 18px; }
.view-wrap { display: flex; justify-content: center; margin: 12px 0 4px; }
#view { max-width: 100%; touch-action: none; background: #ddd; cursor: crosshair; }   /* no rounded corners: they make the corner handles hard to hit */
.editor .options { margin-bottom: 0; }
.editor .options + .view-wrap { margin-top: 12px; }
#crop-info { text-align: center; margin: 4px 0 12px; }

/* --- progress bar on a card (slow tools) --- */
.bar { height: 8px; margin-top: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar[hidden] { display: none; }
.bar .fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .25s linear; }
.bar.indeterminate .fill { width: 40%; animation: slide 1.1s ease-in-out infinite alternate; transition: none; }
@keyframes slide { from { margin-left: 0; } to { margin-left: 60%; } }

/* --- the remove-background page: show results on a checkerboard --- */
body.cutout .thumb {
  object-fit: contain;
  background: conic-gradient(#e2ddd3 25%, #f6f3ee 0 50%, #e2ddd3 0 75%, #f6f3ee 0) 0 0 / 16px 16px;
}

/* keep the picture's column reserved while a card is still working, so long status words have room */
.card .thumb[hidden] { display: block; visibility: hidden; }

/* --- how-to steps and questions at the foot of each tool page --- */
.about h2 { margin-top: 26px; }
.about h2:first-child { margin-top: 0; }
.about h3 { font-size: 16px; color: var(--ink); margin: 18px 0 4px; }
.about ol { max-width: 38em; margin: 6px 0 0; padding-left: 22px; }
.about li { margin-bottom: 4px; }

/* --- the one-line promise right under the title: a selling point, not fine print --- */
.promise {
  margin: 18px auto 0; max-width: 720px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px;
}
.promise span {
  font-size: 16px; font-weight: 600; color: var(--good);
}
@media (max-width: 560px) { .promise { flex-direction: column; align-items: center; gap: 6px; } }

/* --- the gap for a banner advert, under the drop box --- */
.ad-gap {
  margin: 28px auto; max-width: 728px; min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: 8px;
}
.ad-gap span { font-size: 13px; color: var(--muted); }

/* --- video pages: no thumbnail column --- */
body.video .card { grid-template-columns: 1fr auto; }
body.video .card .thumb, body.video .card .thumb[hidden] { display: none; }

/* --- the small quiet footer: About Us - Privacy - Terms --- */
footer .links, footer .credit { font-size: 12px; color: #9a948b; margin: 0 0 4px; }
footer .links a { color: #9a948b; text-decoration: none; }
footer .links a:hover { text-decoration: underline; color: var(--muted); }
ul.credits { max-width: 38em; padding-left: 20px; }
ul.credits li { margin-bottom: 8px; }

/* long option words must never push a phone screen wider than itself */
.options label { max-width: 100%; }
.options select { max-width: 100%; min-width: 0; }

/* --- image to text: the words appear under the picture, ready to copy --- */
.textcard { grid-template-columns: 64px 1fr auto; }
.textcard .ocr-out {
  grid-column: 1 / -1; width: 100%; box-sizing: border-box;
  font: inherit; font-size: 15px; line-height: 1.5; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; resize: vertical; min-height: 120px;
}
.textcard .ocr-out[hidden] { display: none; }
.textcard .row-buttons[hidden] { display: none; }
@media (max-width: 560px) { .textcard { grid-template-columns: 64px 1fr; } .textcard .row-buttons { grid-column: 1 / -1; } }
body.text .thumb { object-fit: contain; }

/* --- adverts: three in-page banners and two side boxes on wide screens.
   They sit in their own space; nothing overlaps text and there are no pop-ups. --- */
.ad-gap { min-height: 100px; display: flex; align-items: center; justify-content: center; }
.layout { width: 100%; flex: 1; display: block; }
.rail { display: none; }
@media (min-width: 1240px) {
  .layout { display: grid; grid-template-columns: 160px minmax(0, 720px) 160px; gap: 28px; justify-content: center; align-items: start; }
  .layout > main { max-width: none; margin: 0; }
  .rail { display: block; position: sticky; top: 20px; margin-top: 24px; }
  .rail .ad-gap { min-height: 600px; margin: 0; }
}

/* --- pick-a-tool menu: keep the arrow clear of the edge --- */
.toolspicker select, .options select {
  -webkit-appearance: none; appearance: none;
  padding-right: 42px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232b2a28' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 18px center;
}

/* headline sub-lines: wrap evenly, never leave one word alone on the second line */
.tag, .top h1 { text-wrap: balance; }

/* --- contact form --- */
.contact-form { background: var(--card, #fff); border: 1px solid var(--line, #ddd); border-radius: 14px; padding: 18px 20px; max-width: 560px; }
.contact-form label { display: block; font-weight: 600; margin: 12px 0 4px; }
.contact-form label:first-of-type { margin-top: 0; }
.contact-form input, .contact-form textarea { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line, #ddd); border-radius: 10px; background: #fff; box-sizing: border-box; }

/* ADS-OFF-START  (hides every advert box while applying to Google; delete this whole block to show them again) */
.ad-gap, .rail { display: none !important; }
@media (min-width: 1240px) { .layout { display: block !important; } .layout > main { max-width: 720px !important; margin: 0 auto !important; } }
/* ADS-OFF-END */
