@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&display=swap');

:root {
  color-scheme: light dark;
  --background: #f5f5ff;
  --ink: #1f2528;
  --muted: #838C95;
  --grid-line: rgba(93, 73, 45, 0.08);
  --panel: #f9f9ff;
  --line: #d8d0c3;
  --accent: #315f72;
  --accent-ink: #ffffff;
  --swatch-line: rgba(31, 37, 40, 0.24);
  --comparison-line: rgba(31, 37, 40, 0.16);
  --input-bg: #ffffff;
  --shadow: 0 18px 46px rgba(48, 43, 35, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #14161f;
    --ink: #f3efe6;
    --muted: #BBBFD3;
    --grid-line: rgba(255, 246, 228, 0.055);
    --panel: #22263b;
    --line: #4a4640;
    --accent: #8fb8c7;
    --accent-ink: #142126;
    --swatch-line: rgba(255, 246, 228, 0.26);
    --comparison-line: rgba(255, 246, 228, 0.18);
    --input-bg: #26292b;
    --shadow: 0 18px 46px rgba(0, 0, 0, 0.36);
  }
}

html[data-theme="light"] {
  color-scheme: light;
  --background: #f5f5ff;
  --ink: #242628;
  --muted: #838C95;
  --grid-line: rgba(93, 73, 45, 0.08);
  --panel: #f9f9ff;
  --line: #d8d0c3;
  --accent: #315f72;
  --accent-ink: #ffffff;
  --swatch-line: rgba(31, 37, 40, 0.24);
  --comparison-line: rgba(31, 37, 40, 0.16);
  --input-bg: #ffffff;
  --shadow: 0 18px 46px rgba(48, 43, 35, 0.14);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --background: #14161f;
  --ink: #ffffff;
  --muted: #BBBFD3;
  --grid-line: rgba(255, 246, 228, 0.055);
  --panel: #22263b;
  --line: #4a4640;
  --accent: #8fb8c7;
  --accent-ink: #142126;
  --swatch-line: rgba(255, 246, 228, 0.26);
  --comparison-line: rgba(255, 246, 228, 0.18);
  --input-bg: #26292b;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Open Sans", -apple-system-ui-serif, ui-serif, 'Georgia', serif;
  color: var(--ink);
  background: var(--background);
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

/* Titles */

h1, h2, h3, h4 {
    font-family: "Montserrat", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 720px;
  font-size: clamp(2rem, 4vw, 4.5rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 24px;
}

.mode-picker {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.mode-label {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.mode-button {
  min-width: 72px;
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.mode-button[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
}

.intro {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 28px;
}

.intro p {
  max-width: 620px;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.55;
}

header {
  font-family: "Montserrat", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  gap: 1em;
  flex-wrap: wrap;
  justify-content: space-between;
  text-align: center;
  align-items: center;
  padding: 1em;
  background-image: linear-gradient(217deg, #2948c9, #c029c9);
  border-bottom: 1px solid #ffffff;
  margin-bottom: 1em;
  max-width: 100%;
}

.wrapper {
  padding: 20px;
  margin-left: auto;
  margin-right: auto;
  max-width: 800px;
}

header .wrapper {
  padding-top: 20px;
  padding-bottom: 10px;
  text-align: center;
}

header a {
    color: #ffffff;
    text-decoration: none;
}

header .site-name {
    font-size: 2em;
    font-weight: bold;
}

a {
    color: #007acc;
}

a:hover {
    color: #e29c03;
}

nav {
    margin-top: 10px;
}

nav li {
    display: inline-block;
    margin: 0 8px;
    line-height: 1.5em;
}

header a:hover {
    color: #ffcc00;
    text-decoration: none;
}

nav li a:hover {
    color: #ffcc00;
    text-decoration: underline;
}

ul {
    margin: 0 24px 24px 24px;

    padding-inline-start: 0px;
}

nav ul {
    margin: 0;
}

li {
    margin: 8px 0;
}

.mixer {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.workspace,
.model-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.workspace {
  padding: 24px;
}

.choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.colour-card {
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head h2 {
  font-size: 0.98rem;
}

.hex {
  color: var(--muted);
  font-family: "Source Code Pro", 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;
  font-size: 0.82rem;
  white-space: nowrap;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(34px, 1fr));
  gap: 8px;
}

.swatch {
  position: relative;
  min-height: 44px;
  border: 1px solid var(--swatch-line);
  border-radius: 6px;
  background: var(--swatch);
  cursor: pointer;
}

.swatch[aria-pressed="true"] {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

input[type="color"] {
  width: 56px;
  height: 42px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input-bg);
  cursor: pointer;
}

.picker-row label {
  color: var(--muted);
  font-size: 0.92rem;
}

.mix-controls {
  display: grid;
  gap: 10px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.mix-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
}

.ratio-text {
  color: var(--muted);
  font-family: "Source Code Pro", 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;
  font-size: 0.84rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.results {
  display: grid;
  grid-template-columns: minmax(280px, 420px);
  gap: 14px;
}

.model-card {
  overflow: hidden;
}

.model-preview {
  min-height: 230px;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.14), transparent 100%),
    var(--model-colour);
}

.model-data {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.model-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.model-line span:first-child {
  color: var(--muted);
  font-weight: 650;
}

.model-line strong {
  font-family: "Source Code Pro", 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;
  font-size: 0.86rem;
}

.comparison {
  display: grid;
  grid-template-columns: var(--first-share, 50%) 1fr;
  min-height: 24px;
  overflow: hidden;
  border: 1px solid var(--comparison-line);
  border-radius: 6px;
}

.comparison div:first-child {
  background: var(--first);
}

.comparison div:last-child {
  background: var(--second);
}

/* Widths for smaller screens */

@media (max-width: 820px) {
  main {
    width: min(100% - 24px, 680px);
    padding: 26px 0;
  }

  .wrapper {
    padding: 40px 20px;
  }

  .topbar {
    justify-content: stretch;
  }

  .mode-picker {
    width: 100%;
  }

  .intro {
    grid-template-columns: 1fr;
  }

  .mixer,
  .results {
    grid-template-columns: 1fr;
  }

  .model-preview {
    min-height: 220px;
  }
}
