/* ==========================================================================
   OMO Tools — tools.ooooomo.com. The OMO system (header, footer, type, icons,
   links, the ring transition) from ooooomo.com/studio/omo.css, on white paper
   in ink, like the product sites' reading pages. Loaded after omo.css.
   A tool is a work surface: one thing to do on the first screen, standard
   controls, few words.
   ========================================================================== */

.theme-tools {
  --page: #ffffff;
  --page-2: #f3f3f0;
  --card: #ffffff;
  --ink-tl: #111111;
  --bg: var(--page); --bg-2: var(--page-2); --fg: var(--ink-tl);
  --fg-mute: rgba(17, 17, 17, .58); --line: rgba(17, 17, 17, .12);
  --room: #9a9a9a; --lid: #111111; --dot: #4aa8ff;
  background: var(--page);
  color: var(--fg);
}
.theme-tools ::selection { background: #cfe6ff; color: var(--ink-tl); }

/* Header: ink on white, a white veil once you scroll (as on the product sites). */
.theme-tools .site-header { mix-blend-mode: normal; color: var(--ink-tl); }
.theme-tools .site-header::before {
  content: ''; position: absolute; inset: 0 0 -18px; z-index: -1; pointer-events: none;
  background: linear-gradient(var(--page) 45%, transparent);
  opacity: 0; transition: opacity .4s;
}
.is-scrolled .theme-tools .site-header::before { opacity: 1; }
.theme-tools[data-page] .brand-link { display: flex; align-items: center; gap: 10px; width: auto; height: 44px; padding: 0; opacity: 1; transform: none; pointer-events: auto; }
.theme-tools .brand-link .tl-mark { display: block; flex: none; width: 60px; }
.theme-tools .brand-link .tl-mark svg { display: block; width: 100%; height: auto; }
.tl-word { font: 600 19px/1 var(--display); letter-spacing: -0.02em; }
.theme-tools .mobile-menu {
  --fg: #f1efe9; --fg-mute: rgba(241, 239, 233, .56);
  background: var(--ink-tl); color: var(--fg);
}

/* Footer: the OMO contact block and three short columns, on the page's white. */
.theme-tools .site-footer {
  min-height: 0; display: block; background: var(--bg); color: var(--fg);
  margin-top: clamp(80px, 10vw, 150px); padding: clamp(72px, 8vw, 120px) 0 0; border-top: 1px solid var(--line);
}
.theme-tools .footer-top { grid-template-columns: minmax(0, 1fr) minmax(320px, max-content); align-items: start; gap: clamp(32px, 4vw, 64px); }
.theme-tools .footer-hello { min-width: 0; }
.pop-foot-cols { display: grid; grid-template-columns: repeat(3, minmax(min-content, 1fr)); gap: 24px; }
.pop-foot-cols h2 { margin-bottom: 14px; font: 600 12px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-mute); }
.pop-foot-cols a { display: block; width: fit-content; padding: 6px 0; font: 500 16px/1.2 var(--display); white-space: nowrap; }
.theme-tools .footer-base { margin-top: clamp(48px, 6vw, 88px); align-items: center; padding-top: 24px; }
.made-by { display: inline-flex; align-items: center; color: var(--ink-tl); }
.made-by svg { width: 64px; height: auto; }
@media (min-width: 1101px) { .theme-tools .footer-hello .footer-mail { font-size: clamp(36px, 4.7vw, 80px); } }

/* ---------------------------------------------------------------- pages */
.tl-page { padding-top: calc(var(--header-h) + clamp(28px, 4vw, 64px)); }
.tl-head { display: grid; gap: clamp(12px, 1.4vw, 20px); margin-bottom: clamp(24px, 3vw, 44px); }
.tl-head .lede { max-width: 40ch; color: var(--fg-mute); text-wrap: pretty; }

.not-found { min-height: 100svh; display: grid; place-items: center; text-align: center; padding: var(--header-h) var(--gutter); }
.not-found h1 { font: 600 clamp(44px, 7vw, 110px)/0.92 var(--display); letter-spacing: -0.05em; }
.not-found .arrow-link { margin-top: 32px; }

/* The buttons. Product-layer pills (DESIGN_SYSTEM.md §9: product sites may have them). */
.tl-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 22px;
  border: 0; border-radius: 999px; background: var(--ink-tl); color: #fff; font: 600 15px/1 var(--display); letter-spacing: -0.01em;
  white-space: nowrap; cursor: pointer; transition: transform .5s var(--spring), background-color .3s, box-shadow .3s;
}
.tl-button:hover { background: #333; }
.tl-button:active { transform: scale(.96); }
.tl-button:focus-visible { outline: 2px solid var(--dot); outline-offset: 3px; }
.tl-button--quiet { background: transparent; color: var(--ink-tl); box-shadow: inset 0 0 0 1px var(--line); }
.tl-button--quiet:hover { background: var(--page-2); }
.tl-button--quiet[aria-pressed="true"] { background: var(--ink-tl); color: #fff; box-shadow: none; }

/* ---------------------------------------------------------------- home: the list of tools */
.tl-list { display: grid; border-top: 1px solid var(--line); }
.tl-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(16px, 2.4vw, 36px);
  padding: clamp(18px, 2.2vw, 32px) 0; border-bottom: 1px solid var(--line);
}
.tl-row-art {
  display: grid; place-items: center; width: clamp(72px, 8vw, 120px); aspect-ratio: 1; border-radius: clamp(14px, 1.4vw, 22px);
  background: repeating-conic-gradient(#e9e9e5 0 25%, #fff 0 50%) 0 0 / 20px 20px;
}
.tl-cut { width: 46%; aspect-ratio: 1; border-radius: 46% 54% 50% 50% / 56% 52% 48% 44%; background: var(--dot); transition: transform .6s var(--spring); }
.tl-row:hover .tl-cut { transform: translateY(-6%) scale(1.06); }
.tl-row-copy { display: grid; gap: 8px; min-width: 0; }
.tl-row-line { font: 400 clamp(15px, 1.2vw, 18px)/1.4 var(--text); color: var(--fg-mute); }
.tl-row .round-arrow { position: static; background: var(--ink-tl); color: #fff; }
.tl-row:hover .round-arrow { transform: scale(1.08); }
.tl-row:hover .round-arrow svg { transform: rotate(45deg); }

/* ---------------------------------------------------------------- background remover */
.bg-tool { display: grid; gap: 16px; }
.bg-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* The stage: the drop target, then the photo. Tall enough to work in, never taller than the screen. */
.bg-stage {
  position: relative; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; overflow: hidden;
  height: clamp(320px, calc(100svh - var(--header-h) - 348px), 760px);
  border-radius: var(--radius); background: var(--page-2);
  transition: background-color .3s, box-shadow .3s;
}
.bg-stage > * { grid-area: 1 / 1; }
.bg-tool[data-state="empty"] .bg-stage { box-shadow: inset 0 0 0 1.5px var(--line); }
.bg-tool.is-over .bg-stage { background: #e8f2ff; box-shadow: inset 0 0 0 2px var(--dot); }

.bg-empty { display: grid; justify-items: center; gap: 18px; padding: 24px; text-align: center; }
.bg-empty-icon { width: 56px; height: 56px; opacity: .5; }

.bg-view { width: 100%; height: 100%; min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; padding: clamp(12px, 2vw, 28px); }
.bg-view canvas { display: block; max-width: 100%; max-height: 100%; min-width: 0; min-height: 0; width: auto; height: auto; object-fit: contain; border-radius: 10px; }
/* Transparency reads as the usual checkerboard, under the cutout only. */
.bg-tool[data-state="done"] .bg-view canvas { background: repeating-conic-gradient(#e4e4e0 0 25%, #fff 0 50%) 0 0 / 20px 20px; }

.bg-busy {
  align-self: end; justify-self: center; display: grid; justify-items: center; gap: 14px; margin: 0 16px clamp(16px, 2.4vw, 32px);
  padding: 20px 26px 22px; border-radius: 22px; background: rgba(17, 17, 17, .86); color: #fff; text-align: center;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.bg-busy-line { font: 600 17px/1.2 var(--display); letter-spacing: -0.01em; }
.bg-meter { display: block; width: min(240px, 56vw); height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.bg-meter i { display: block; width: 100%; height: 100%; border-radius: inherit; background: #fff; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform .3s linear; }
/* While the photo is being cut out there is no percentage to show: the bar breathes instead. */
.bg-tool[data-state="run"] .bg-meter i { transform: none; animation: bg-breathe 1.4s var(--ease-in-out) infinite alternate; }
@keyframes bg-breathe { from { opacity: .25; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .bg-tool[data-state="run"] .bg-meter i { animation: none; opacity: .6; } }

.bg-error { display: grid; justify-items: center; gap: 18px; padding: 24px; text-align: center; }
.bg-error p { max-width: 34ch; font: 500 17px/1.4 var(--text); }

/* One state at a time. */
.bg-tool .bg-empty, .bg-tool .bg-view, .bg-tool .bg-busy, .bg-tool .bg-error, .bg-tool .bg-bar { display: none; }
.bg-tool[data-state="empty"] .bg-empty { display: grid; }
.bg-tool:is([data-state="load"], [data-state="run"], [data-state="done"]) .bg-view { display: grid; }
.bg-tool:is([data-state="load"], [data-state="run"]) .bg-busy { display: grid; }
.bg-tool:is([data-state="load"], [data-state="run"]) .bg-view canvas { opacity: .55; }
.bg-tool[data-state="error"] .bg-error { display: grid; }
.bg-tool[data-state="done"] .bg-bar { display: flex; }
.bg-tool [data-status], .bg-tool [data-error] { display: none; }
.bg-tool[data-state="load"] [data-status="load"], .bg-tool[data-state="run"] [data-status="run"] { display: block; }
.bg-tool[data-error="image"] [data-error="image"], .bg-tool[data-error="model"] [data-error="model"], .bg-tool[data-error="run"] [data-error="run"] { display: block; }

.bg-bar { flex-wrap: wrap; align-items: center; gap: 10px; }
.bg-bar-gap { flex: 1 1 0; }
.bg-swatches { display: flex; align-items: center; gap: 8px; margin: 0 6px 0 0; padding: 0; border: 0; min-width: 0; }
.bg-swatch { position: relative; display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; }
.bg-swatch input[type="radio"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.bg-swatch > span:first-of-type {
  width: 32px; height: 32px; border-radius: 50%; background: var(--c, #fff);
  box-shadow: inset 0 0 0 1px rgba(17, 17, 17, .18); transition: transform .4s var(--spring), box-shadow .2s;
}
.bg-swatch--clear > span:first-of-type { background: repeating-conic-gradient(#d9d9d4 0 25%, #fff 0 50%) 0 0 / 12px 12px; }
.bg-swatch--pick > span:first-of-type { background: conic-gradient(#ff5d5d, #ffd24a, #7be06b, #4aa8ff, #b57bff, #ff5d5d); }
.bg-swatch--pick.is-set > span:first-of-type { background: var(--c); }
.bg-swatch:hover > span:first-of-type { transform: scale(1.08); }
.bg-swatch input[type="radio"]:checked ~ span:first-of-type { box-shadow: inset 0 0 0 1px rgba(17, 17, 17, .18), 0 0 0 2px var(--page), 0 0 0 4px var(--ink-tl); }
.bg-swatch input[type="radio"]:focus-visible ~ span:first-of-type { outline: 2px solid var(--dot); outline-offset: 5px; }
.bg-swatch input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }

@media (max-width: 720px) {
  .bg-stage { height: clamp(300px, calc(100svh - var(--header-h) - 360px), 620px); }
  .bg-bar-gap { flex-basis: 100%; height: 0; }
  .bg-bar .tl-button { flex: 1 1 auto; padding: 0 16px; }
}

/* ---------------------------------------------------------------- facts and questions */
.tl-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(24px, 4vw, 64px); margin-top: clamp(72px, 9vw, 140px); }
.tl-facts p { margin-top: 12px; max-width: 30ch; font: 400 17px/1.5 var(--text); color: var(--fg-mute); text-wrap: pretty; }
@media (max-width: 860px) { .tl-facts { grid-template-columns: 1fr; } }

.tl-faq {
  display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); column-gap: clamp(28px, 6vw, 110px); align-items: start;
  margin-top: clamp(72px, 9vw, 140px);
}
.tl-faq > h2 { grid-column: 1; grid-row: 1 / span 12; }
.tl-faq details { grid-column: 2; }
@media (max-width: 860px) {
  .tl-faq { grid-template-columns: 1fr; }
  .tl-faq > h2 { grid-row: auto; margin-bottom: clamp(24px, 3vw, 44px); }
  .tl-faq details { grid-column: 1; }
}
.tl-faq details { border-bottom: 1px solid var(--line); }
.tl-faq details:first-of-type { border-top: 1px solid var(--line); }
.tl-faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 2px; cursor: pointer;
  font: 600 clamp(18px, 1.6vw, 22px)/1.2 var(--display); letter-spacing: -0.02em; list-style: none;
}
.tl-faq summary::-webkit-details-marker { display: none; }
.tl-faq summary::after {
  content: ''; flex: none; width: 12px; height: 12px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-3px) rotate(45deg); transition: transform .4s var(--ease-out);
}
.tl-faq details[open] summary::after { transform: translateY(3px) rotate(225deg); }
.tl-faq details p { max-width: 62ch; padding: 0 2px 24px; font: 400 17px/1.55 var(--text); color: var(--fg-mute); }
