/* The AI page (views/ai.templ, ai.js): the title on clean paper, then the features in drops of paint. On a large screen
   nothing scrolls and each feature is a word on the sheet; on a phone the page scrolls and the features are the list,
   each on clean paper inside its drop. Where the paint can't run (no WebGL 2, no script), the list stays plain under
   the title. The page's script sets data-paint and data-wait on <html> before it first shows, so the layout below is
   right from the first frame. Kept close to demos/watercolor/ai.html in codefolly. */
body { background: var(--db-bg); }
.um-bar { position: relative; z-index: 4; }
main h1, main h2, main p { margin: 0; }
#ai-paint { display: none; }
[data-paint] #ai-paint { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }

/* the opening: the title, on paper the paint keeps clear of */
.hero { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; padding: 6vh 24px 48px; text-align: center; }
.hero-words { max-width: 1040px; display: grid; gap: 14px; transition: opacity .5s ease; }
.hero h1 { font: 500 clamp(42px, 7.4vw, 96px)/1.02 var(--font-db); letter-spacing: -.035em; text-wrap: balance; }
.hero p { font-size: clamp(18px, 2vw, 24px); line-height: 1.3; color: var(--db-fg-2); text-wrap: balance; }
.soon { font: 500 15px/1.3 var(--font-db); color: var(--db-fg-2); }
/* held until the typeface is in, so the words don't change shape as they show */
[data-wait] .hero-words, [data-wait] .ai-list { opacity: 0; }

/* the features as a list: the page itself on a phone, and wherever the paint can't run */
.ai-list { position: relative; z-index: 1; list-style: none; margin: 0 auto; padding: 0 24px 80px; max-width: 640px; display: grid; gap: 32px; transition: opacity .5s ease; }
.ai-list li { display: grid; gap: 8px; }
.ai-list h2 { display: flex; align-items: baseline; gap: 10px; font: 500 clamp(24px, 3vw, 32px)/1.1 var(--font-db); letter-spacing: -.025em; text-wrap: balance; }
.ai-list p { font-size: 18px; line-height: 1.35; color: var(--db-fg-2); }
.ai-swatch { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--db-f-src); transform: translateY(-2px); }
.sheet, .open-panel { display: none; }

/* a large screen with the paint: nothing scrolls, and each feature is a word on the sheet, with its drop behind it */
@media (min-width: 601px) {
  [data-paint], [data-paint] body { overflow: hidden; height: 100svh; overscroll-behavior: none; }
  [data-paint] .hero { min-height: 100svh; padding-bottom: 0; }
  [data-paint] .ai-list { display: none; }
  [data-paint] .sheet { display: block; }
  [data-paint] [data-open] .open-panel { display: flex; }
}
.sheet { --edge: 113px; position: fixed; inset: 0; z-index: 2; pointer-events: none; }
/* each feature is a word in a pale bloom inside its own drop, with a hand-drawn pencil arrow and underline: it's still a
   painting, but it asks to be pressed */
.drop-word {
  position: absolute; transform: translate(-50%, -50%); width: max-content; max-width: 210px; padding: 8px 6px 12px; border: 0; background: none;
  color: var(--db-fg); font: 500 clamp(18px, 1.7vw, 23px)/1.14 var(--font-db); letter-spacing: -.015em; text-align: center; text-wrap: balance; cursor: pointer;
  pointer-events: auto; opacity: 0; transition: opacity .6s ease; visibility: hidden;
}
.drop-word[data-shown] { opacity: 1; visibility: visible; }
.pencil-arrow { display: inline-block; width: 1.25em; height: .55em; margin-left: .28em; vertical-align: .02em; overflow: visible; color: var(--db-fg); opacity: .78; transition: transform .25s ease, opacity .25s ease; }
.pencil-line { position: absolute; left: 8px; right: 8px; bottom: 3px; width: calc(100% - 16px); height: 8px; overflow: visible; color: var(--db-fg); opacity: .62; transition: opacity .25s ease; }
.pencil-line path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1s ease .15s; }
.drop-word[data-shown] .pencil-line path { stroke-dashoffset: 0; }
.drop-word:hover .pencil-arrow, .drop-word:focus-visible .pencil-arrow { transform: translateX(5px); opacity: 1; }
.drop-word:hover .pencil-line, .drop-word:focus-visible .pencil-line { opacity: 1; }
.drop-word:focus-visible, .open-back:focus-visible { outline: 2px solid var(--db-focus); outline-offset: 2px; border-radius: 8px; }
[data-open] .drop-word[data-shown] { opacity: 0; pointer-events: none; }
[data-open] .hero-words { opacity: 0; }
.open-panel { position: fixed; inset: 0; z-index: 3; align-items: center; justify-content: center; padding: 24px; }
.open-words { max-width: 640px; display: grid; gap: 14px; justify-items: start; }
.open-words h2 { font: 500 clamp(34px, 5vw, 64px)/1.04 var(--font-db); letter-spacing: -.03em; text-wrap: balance; }
.open-words p { font-size: clamp(18px, 1.7vw, 22px); line-height: 1.35; color: var(--db-fg-2); }
.open-back { padding: 6px 0; border: 0; background: none; color: var(--db-fg); font: 500 16px/1 var(--font-db); cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }

@media (min-width: 601px) and (max-width: 900px) {
  .sheet { --edge: 94px; }
  .drop-word { max-width: 172px; font-size: 17px; }
}

/* a phone: the page scrolls, and each feature is on clean paper inside a drop of its colour, appearing as the paint
   reaches it. Nothing to tap */
@media (max-width: 600px) {
  .hero { padding: 20px 20px 12px; }
  .hero h1 { font-size: 44px; }
  .hero p { font-size: 18px; }
  [data-paint] .ai-list { gap: 44px; padding: 36px 28px 120px; }
  [data-paint] .ai-list li {
    padding: 6px 4px; border-radius: 28px; background: var(--db-bg); box-shadow: 0 0 18px 12px var(--db-bg);
    opacity: 0; transition: opacity .7s ease;
  }
  [data-paint] .ai-list li[data-shown] { opacity: 1; }
  .ai-list h2 { font-size: 26px; }
}
