/* The workshop app: phones first (Android Chrome, iOS Safari), tablets
   and laptops too. One column, big targets, nothing to install. */
:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --card: #fcfcfb;
  --line: #dcdad3;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #77756f;
  --accent: #24554b;
  --accent-ink: #ffffff;
  --sand: #e6dcc4;
  --warn: #b3261e;
  --sea-wash: #cfe5ee;       /* the sea side of the pad, light */
  --beach-wash: #f0e6cd;     /* and the beach side */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thaana", sans-serif;
  color: var(--ink); background: var(--bg);
  display: flex; flex-direction: column; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
.bar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  background: var(--accent); color: var(--accent-ink);
}
/* EcoLogic Alliance's mark (its own site's logo.png), drawn in the bar's
   text colour through it, as their site does */
.bar .logo {
  width: 49px; height: 24px; flex: none; background: currentColor;
  -webkit-mask: url(ecologic-alliance.png) center / contain no-repeat;
  mask: url(ecologic-alliance.png) center / contain no-repeat;
}
.tagline { margin: 4px 0 0; font-size: 13px; color: var(--accent); font-weight: 600; letter-spacing: .02em; }
.brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand strong { font-size: 17px; }
.brand span { font-size: 12px; opacity: .85; }
/* the language buttons sit in a fixed place whatever the language */
.langs { margin-left: auto; display: flex; gap: 4px; }
.langs button { width: 64px; padding-inline: 0; background: transparent; color: inherit; border: 1px solid rgba(255,255,255,.5); padding: 4px 8px; min-height: 32px; font-size: 13px; }
.langs button[aria-pressed="true"] { background: rgba(255,255,255,.2); }

.steps {
  list-style: none; margin: 0; padding: 8px 10px; display: flex; gap: 4px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.steps li { flex: 1; text-align: center; font-size: 13px; color: var(--muted); padding: 4px 0; border-radius: 6px; }
.steps li span {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid currentColor; font-size: 12px; font-weight: 600; margin-inline-end: 2px;
}
.steps li b { font-weight: 500; }
.steps li[aria-current="step"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.steps li[aria-current="step"] span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.steps li.done { color: var(--ink-2); }

main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 10px 14px 90px; }
h1 { font-size: 22px; margin: 6px 0 4px; }
.intro { margin: 0 0 10px; color: var(--ink-2); }
.small { font-size: 13px; color: var(--muted); margin: 6px 0; }
.tip { font-size: 14px; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.problem { min-height: 1.4em; margin: 6px 0; color: var(--warn); font-weight: 500; }
.problem.ok { color: var(--accent); }
.problem.hint { color: var(--ink-2); font-weight: 400; }

button, .button {
  font: inherit; font-size: 15px; min-height: 44px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; touch-action: manipulation;
}
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.row > * { flex: 1 1 auto; }

.seg { display: flex; gap: 0; margin: 4px 0 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; border: 0; border-radius: 0; min-height: 40px; font-size: 14px; background: var(--card); }
.seg button + button { border-inline-start: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.pad {
  position: relative; width: 100%; aspect-ratio: 4 / 3;
  background: linear-gradient(to right, var(--sea-wash), var(--beach-wash));
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; touch-action: none;
}
.pad canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.pad[data-sea="right"] { background: linear-gradient(to left, var(--sea-wash), var(--beach-wash)); }
.pad[data-sea="top"] { background: linear-gradient(to bottom, var(--sea-wash), var(--beach-wash)); }
.pad[data-sea="bottom"] { background: linear-gradient(to top, var(--sea-wash), var(--beach-wash)); }
/* "Sea" and "Beach" at the edges they lie beyond, on the pad and the views */
.shore {
  position: absolute; z-index: 1; pointer-events: none; font-size: 12px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; line-height: 1;
}
.shore.sea { color: #2f6f8c; }
.shore.beach { color: #86693a; }
[data-sea="left"] > .sea, [data-sea="right"] > .beach { left: 6px; top: 50%; writing-mode: vertical-rl; transform: translateY(-50%) rotate(180deg); }
[data-sea="right"] > .sea, [data-sea="left"] > .beach { right: 6px; top: 50%; writing-mode: vertical-rl; transform: translateY(-50%); }
[data-sea="top"] > .sea, [data-sea="bottom"] > .beach { top: 6px; left: 50%; transform: translateX(-50%); }
[data-sea="bottom"] > .sea, [data-sea="top"] > .beach { bottom: 6px; left: 50%; transform: translateX(-50%); }
/* an empty pad shows how to start: a finger drawing a loop, or a camera */
.pad .hint { display: none; }
.pad.blank:not(.photo) .draw-hint { display: block; }
.pad.blank.photo .photo-hint { display: grid; }
.draw-hint { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.draw-hint .loop { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; opacity: .55; }
.draw-hint .hand { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.photo-hint {
  position: absolute; left: 50%; top: 50%; width: 88px; height: 88px; margin: -44px 0 0 -44px;
  place-items: center; border-radius: 50%; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.photo-hint:active { transform: scale(.96); }
.photo-hint svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.slider { margin: 12px 0 4px; }
.slider label { display: flex; justify-content: space-between; font-size: 15px; }
.slider output { font-weight: 600; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; height: 36px; accent-color: var(--accent); }

.view {
  position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 62dvh;
  border-radius: 12px; overflow: hidden; background: linear-gradient(#dfeef0, #f4f3ef);
  border: 1px solid var(--line); touch-action: none;
}
.view canvas { width: 100%; height: 100%; display: block; }
/* while the shell or the flow is being worked out */
.wait {
  position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; gap: 12px;
  align-items: center; justify-content: center; font-size: 15px; color: var(--ink-2);
  background: color-mix(in srgb, var(--bg) 55%, transparent); pointer-events: none;
}
.wait i {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid color-mix(in srgb, var(--accent) 20%, transparent); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .wait i { animation-duration: 2.5s; } }
.measures { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.measures div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.measures dt { font-size: 12px; color: var(--muted); }
.measures dd { margin: 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

.legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); margin: 8px 0 0; }
/* the speed shades the sand: lighter where slower, darker where faster (scene.js) */
.legend i { flex: 1; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #fbf8f1, #e6dcc4, #7d7262); }
[dir="rtl"] .legend i { background: linear-gradient(270deg, #fbf8f1, #e6dcc4, #7d7262); }

form { display: flex; flex-direction: column; gap: 6px; }
form label { font-size: 14px; color: var(--ink-2); margin-top: 6px; }
form input:not([type="checkbox"]) {
  font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); min-height: 44px;
}
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.35; }
.check input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--accent); }
form .primary { margin-top: 10px; }
#again { display: flex; width: 100%; margin-top: 14px; }

.actions {
  position: fixed; inset: auto 0 0 0; display: flex; gap: 10px; justify-content: space-between;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card) 92%, transparent);
  border-top: 1px solid var(--line); backdrop-filter: blur(6px);
}
.actions button { flex: 1; max-width: 340px; }

@media (min-width: 900px) {
  main { max-width: 860px; }
  /* the pad stays 4:3, the shape finger drawings are traced at (draw.js) */
  .view { aspect-ratio: 16 / 9; }
}

/* sending not switched on yet: the form shown, plainly not working */
.soon { margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; background: var(--card); border: 1px dashed var(--line); font-size: 14px; }
form.off { opacity: .45; filter: grayscale(1); pointer-events: none; }

/* arrows beside the words: pointing the way the page reads, so they turn
   round in a right-to-left language */
#back::before { content: "←"; }
#next::after { content: "→"; }
#undo::before { content: "↶"; }
#clear::before { content: "✕"; }
#turn::before, #turn2::before { content: "↻"; }   /* the plate turns clockwise against the sea */
[dir="rtl"] #back::before { content: "→"; }
[dir="rtl"] #next::after { content: "←"; }
[dir="rtl"] #undo::before { content: "↷"; }
#back::before, #next::after, #undo::before, #clear::before, #turn::before, #turn2::before {
  font-size: 1.15em; line-height: 1; font-family: system-ui, "Segoe UI Symbol", "Noto Sans Symbols 2", "Noto Sans Symbols", sans-serif;
}

/* and a picture beside every other button's words */
#modeDraw::before { content: "👆"; }          /* pointing up */
#modePhoto::before, #photoTools label.button::before { content: "📷"; }   /* camera */
#nextShape::before { content: "🔄"; }         /* arrows in a circle */
#flowUp::before { content: "↗"; }                /* up the slope, the sea at the view's left */
#flowDown::before { content: "↙"; }
#sendBtn::before { content: "✉️"; }         /* envelope */
#again::before { content: "✚"; }
.langs::before { content: "🌐"; align-self: center; margin-inline-end: 2px; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
#modeDraw::before, #modePhoto::before, #photoTools label.button::before, #nextShape::before, #sendBtn::before {
  font-size: 1.25em; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
#flowUp::before, #flowDown::before, #again::before {
  font-size: 1.15em; line-height: 1; font-family: system-ui, "Segoe UI Symbol", "Noto Sans Symbols 2", "Noto Sans Symbols", sans-serif;
}
#flowUp::before, #flowDown::before { font-size: 1.6em; font-weight: 700; }   /* thin glyphs: larger */
