/* Moulin website: one screen in flat colors, like a poster. A pale sky above a green hill, also when the system uses
   the dark appearance. Keep the colors of the scene equal to PAINT in mill.js. */

@font-face { font-family: "Spectral"; src: url("fonts/Spectral-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Spectral"; src: url("fonts/Spectral-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Spectral"; src: url("fonts/Spectral-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
/* Only the letters of the pronunciation, in the notation of French dictionaries. */
@font-face { font-family: "EB Garamond IPA"; src: url("fonts/EBGaramond-IPA.woff2") format("woff2"); font-display: swap; }

:root {
  color-scheme: light;
  /* The scene. */
  --sky: #DCE5EA;
  --far: #C3D2CD;
  --land: #23493B;
  --tower: #F3EAD6;
  --roof: #D9C9A8;
  --sails: #23493B;
  --holes: #23493B;
  --ring: #F3EAD6;
  --signal: #FF3B30;
  /* The words, on the sky. */
  --text: #23493B;
  --text-2: #355448;
  --text-3: #4E685E;
  --well: rgb(35 73 59 / 0.08);
  --tab-on: rgb(255 255 255 / 0.72);
  --button: #23493B;
  --button-text: #F3EAD6;
  --button-hover: #2D5949;
  --code: rgb(255 255 255 / 0.5);
  --copy: rgb(35 73 59 / 0.09);
  --copy-hover: rgb(35 73 59 / 0.15);
  --selection: rgb(35 73 59 / 0.18);
  /* The credits, on the land. */
  --credits: rgb(243 234 214 / 0.86);
  --credits-link: #F3EAD6;
  --gutter: clamp(20px, 6vw, 96px);
  --control: 44px; /* The height of the tabs and of the download button. */
  --serif: "Spectral", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* The stacked page: the words sit on the land, in cream. Keep this query equal to "stacked" in site.js. */
@media (max-width: 979px), (max-aspect-ratio: 5/4) {
  :root {
    --text: #F3EAD6;
    --text-2: rgb(243 234 214 / 0.88);
    --text-3: rgb(243 234 214 / 0.72);
    --well: rgb(0 0 0 / 0.18);
    --tab-on: rgb(243 234 214 / 0.16);
    --button: #F3EAD6;
    --button-text: #23493B;
    --button-hover: #E6DCC5;
    --code: rgb(0 0 0 / 0.18);
    --copy: rgb(243 234 214 / 0.14);
    --copy-hover: rgb(243 234 214 / 0.22);
    --selection: rgb(243 234 214 / 0.28);
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* The sky above and the land below, also when the page bounces past its top or its bottom. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: linear-gradient(var(--sky) 50%, var(--land) 50%);
}

body {
  margin: 0;
  color: var(--text);
  font: 400 18px/1.55 var(--serif);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--selection); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 6px; }
.footer :focus-visible { outline-color: var(--credits-link); }

p { margin: 0; text-wrap: pretty; }

code { font-family: var(--mono); font-size: 0.86em; }

/* ---------- The poster: the mill behind, the words in front. ---------- */

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  overflow: hidden;
}

.scene, .ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.scene { z-index: 0; touch-action: pan-y; }
.scene.can-grab { cursor: grab; }
.scene.grabbing { cursor: grabbing; }
.ink { z-index: 2; pointer-events: none; }

.hero { background: var(--sky); }
.scene .hill { fill: var(--land); }
.scene .far { fill: var(--far); }
.scene .tower { fill: var(--tower); }
.scene .cap { fill: var(--roof); }
.scene .ring { fill: var(--ring); }
.scene .sails-face { fill: var(--sails); }
.scene .hole { fill: var(--holes); }
.scene .hub { fill: var(--signal); }
/* site.js sets --gust: the wind streaks get stronger with each gust. */
.scene .winds { opacity: var(--gust, 1); }
.scene .wind { fill: none; stroke: #fff; stroke-width: 1.5; stroke-linecap: round; animation: blow linear infinite; }
.ink .word-inv { fill: var(--sky); }
.ink .word-dot { fill: var(--signal); }

@keyframes blow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: var(--run); } }

.words {
  position: relative;
  z-index: 1;
  width: min(100%, calc(620px + 2 * var(--gutter)));
  margin-block: auto;
  padding: clamp(48px, 9vh, 96px) var(--gutter) 40px;
}

.wordmark { margin: 0; line-height: 0; }
.wordmark svg { display: block; width: clamp(240px, 33vw, 500px); height: auto; overflow: visible; }
.word-face { fill: var(--text); }
.word-dot { fill: var(--signal); }

.definition { margin-top: 14px; font-size: 17px; color: var(--text-2); }
.definition .ipa { font-family: "EB Garamond IPA", var(--serif); font-size: 1.05em; color: var(--text-3); }

.tagline {
  max-width: 21em;
  margin-top: clamp(26px, 4vh, 40px);
  font-size: clamp(23px, 2vw, 28px);
  line-height: 1.3;
}

.caution { max-width: 34em; margin-top: clamp(18px, 3vh, 26px); font-size: 15.5px; line-height: 1.5; text-align: justify; color: var(--text-3); }
.caution strong { font-weight: 500; color: var(--text-2); }

/* ---------- Install: one tab for each system. ---------- */

.install { max-width: 620px; margin-top: clamp(30px, 5vh, 48px); }

.tabs {
  display: inline-flex;
  gap: 2px;
  height: var(--control);
  padding: 4px;
  border-radius: 999px;
  background: var(--well);
}

.tab {
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font: 500 15px/1 var(--serif);
  cursor: pointer;
}

.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--tab-on); color: var(--text); }

.panel { margin-top: 16px; }

html:not(.js) .tabs { display: none; }
html:not(.js) .panel[hidden] { display: block; }
html:not(.js) .panel::before { content: attr(data-name); display: block; margin: 18px 0 8px; font-weight: 500; }

/* All panels share one grid cell, and a hidden panel keeps its space. The block keeps the height of the tallest panel,
   so the page does not move when the visitor changes the tab: the words are centered on the screen. */
html.js .install { display: grid; grid-template-columns: minmax(0, 1fr); }
html.js .tabs { justify-self: start; }
html.js .panel { grid-area: 2 / 1; }
html.js .panel[hidden] { display: block; visibility: hidden; }

/* From 640 px, the words have room for the tabs and the widest button (about 545 px) in one row: the download button
   goes at the right of the tabs, and the command below them. Each panel is a subgrid of the install grid, so the
   download link stays in its panel. */
@media (min-width: 640px) {
  @supports (grid-template-rows: subgrid) {
    html.js .install { grid-template-columns: max-content minmax(0, 1fr); align-items: center; column-gap: 12px; }
    html.js .tabs { grid-area: 1 / 1; position: relative; z-index: 1; } /* Above the panels, which also cover this cell. */
    html.js .panel, html.js .panel[hidden] { display: grid; grid-template-columns: subgrid; grid-template-rows: subgrid; grid-area: 1 / 1 / span 3 / -1; margin-top: 0; }
    html.js .panel .download { grid-area: 1 / 2; justify-self: start; }
    html.js .panel .alt { grid-area: 2 / 1 / 3 / -1; }
    html.js .panel .command { grid-area: 3 / 1 / 4 / -1; }
  }
}

.download {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: var(--control);
  padding: 0 24px;
  white-space: nowrap;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-text);
  font-weight: 500;
  text-decoration: none;
}

.download svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.download:hover { background: var(--button-hover); text-decoration: none; }

.alt { margin-top: 16px; font-size: 14px; color: var(--text-3); }

.command {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 6px 6px 14px;
  border-radius: 14px;
  background: var(--code);
}

.command .prompt { font: 13.5px/2 var(--mono); color: var(--text-3); }

.command code {
  flex: 1;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 13.5px;
  line-height: 2;
  scrollbar-width: thin;
}

.command .copy {
  flex: none;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--copy);
  color: var(--text);
  font: 500 14px/1 var(--serif);
  cursor: pointer;
}

.command .copy:hover { background: var(--copy-hover); }


/* The credits, alone at the bottom of the page. */
.footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  padding: 56px var(--gutter) 28px;
  font-size: 16px;
  color: var(--credits);
}

.footer a { color: var(--credits-link); font-weight: 500; text-decoration: none; }
/* The repository: a GitHub mark at the right of the credits. */
.footer .repo { display: inline-flex; padding: 2px; border-radius: 50%; }
.footer .repo svg { width: 20px; height: 20px; fill: currentColor; }
.footer .repo:hover { opacity: 0.8; }
.footer a:hover { text-decoration: underline; }

/* ---------- The stacked page: the mill above, the words below. Keep this query equal to "stacked" in site.js. ---------- */

@media (max-width: 979px), (max-aspect-ratio: 5/4) {
  .hero { padding-top: clamp(250px, 44svh, 420px); } /* The room of the mill. */
  .words { margin-bottom: 0; }
  .words { width: 100%; max-width: calc(640px + 2 * var(--gutter)); padding-top: 0; }
  .wordmark svg { width: min(100%, 460px); }
}

@media (max-width: 560px) {
  body { font-size: 17px; }
  .tab { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .scene .wind { animation: none; }
}
