/* owl.gen.nz. One liquid page. The brand tokens come from owlqr/packages/marketing. */

@font-face {
  font-family: 'Google Sans Flex';
  font-style: normal;
  font-weight: 100 1000;
  font-stretch: 100%;
  font-display: swap;
  src: url('assets/fonts/google-sans-flex-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Google Sans Flex';
  font-style: normal;
  font-weight: 100 1000;
  font-stretch: 100%;
  font-display: swap;
  src: url('assets/fonts/google-sans-flex-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --charcoal: #131214;
  --lime: #C3FF00;
  --purple: #7321FF;
  --purple-hover: #8440FF;
  --ink: #1D1D1B;
  --muted: #595959;
  --on-panel: #FFFFFF;
  --on-panel-soft: #B4B4B9;
  --quiet: #3A393D;
  --quiet-hover: #4B4A4F;
  --warn: #FFB224;

  --gutter: clamp(0.5rem, 1.6vw, 1.5rem);
  --pad: clamp(0.75rem, 2.6cqmin, 2.75rem);
  --gap: clamp(0.6rem, 2.2cqmin, 2rem);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  height: 100%;
  font-size: clamp(14px, calc(4px + 0.5vw + 0.6vh), 17px);
}

body {
  margin: 0;
  height: 100%;
  background: #FFFFFF;
  color: var(--ink);
  font-family: 'Google Sans Flex', system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The page. The minimum height applies only at heavy browser zoom. WCAG 1.4.10
   needs the content to stay available there, so the page can scroll at that point. */
.page {
  width: min(100%, 92rem);
  height: 100dvh;
  min-height: 19rem;
  margin-inline: auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) env(safe-area-inset-bottom) max(var(--gutter), env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: clamp(0.5rem, 1.7vh, 1.15rem);
}
.mark { display: block; height: clamp(1.2rem, 3.4vh, 2rem); width: auto; flex: none; }
.promise { margin: 0; font-size: 0.875rem; color: var(--muted); text-align: right; }

.bottom {
  display: flex;
  justify-content: center;
  padding-block: clamp(0.35rem, 1.3vh, 0.9rem);
  font-size: 0.875rem;
}
.bottom a { color: var(--ink); text-underline-offset: 0.2em; padding: 0.15rem 0.35rem; border-radius: 0.3rem; }
.bottom a:hover { color: var(--purple); }
.bottom a:focus-visible { outline: 2px solid var(--purple); outline-offset: 1px; }

/* The dark panel, from the owlqr.com hero. */
.panel {
  container-type: size;
  min-height: 0;
  align-self: center;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: var(--charcoal);
  color: var(--on-panel);
  border-radius: clamp(1.1rem, 2.5vmin, 2.1rem);
}

.grid {
  height: 100%;
  padding: var(--pad);
  display: grid;
  column-gap: clamp(1rem, 3cqw, 3rem);
  row-gap: var(--gap);
  grid-template-columns: minmax(0, 1fr) min(calc(100cqh - 2 * var(--pad)), 50cqw);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "field stage"
    "tools stage";
}

/* The link field is the headline. */
.field { grid-area: field; --link-size: clamp(1.3rem, 3.5cqw, 3.5rem); }
#link {
  display: block;
  width: 100%;
  height: calc(var(--link-size) * 1.2);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: var(--lime);
  caret-color: var(--lime);
  font: inherit;
  font-size: var(--link-size);
  font-weight: 400;
  line-height: 1.13;
  letter-spacing: -0.02em;
  word-break: break-all;
}
#link::placeholder { color: var(--on-panel); opacity: 1; }
#link:focus-visible { box-shadow: 0 0.18rem 0 -0.06rem var(--lime); }
#link.nudge { animation: nudge 0.5s ease; }
@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-0.4rem); }
  75% { transform: translateX(0.4rem); }
}

/* The code. */
.stage {
  grid-area: stage;
  container-type: size;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
}
.tile {
  position: relative;
  width: min(100cqw, 100cqh);
  aspect-ratio: 1;
  border-radius: clamp(0.5rem, 2.4cqmin, 1.15rem);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
  transition: box-shadow 0.15s ease;
}
.code, .code svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

/* The lime dot on the code is the logo target. It is the dot in the OWL mark. */
.target {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--lime);
  color: var(--charcoal);
  box-shadow: 0 0 0 clamp(0.15rem, 1cqmin, 0.35rem) var(--charcoal);
  cursor: pointer;
  transition: width 0.18s ease, opacity 0.12s ease;
}
.target::before, .target::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36%;
  height: 5%;
  min-height: 2px;
  border-radius: 1px;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.target::after { transform: translate(-50%, -50%) rotate(90deg); }
.target:hover { width: 17%; }
.target-label { display: none; font: inherit; font-weight: 500; font-size: clamp(0.8rem, 3.6cqmin, 1.4rem); }

.tile.has-link:not(:hover) .target,
.tile.has-logo .target { opacity: 0; box-shadow: none; }
.tile.has-logo .target:hover { width: 15%; }
@media (hover: none) {
  .tile.has-link .target { opacity: 0; box-shadow: none; pointer-events: none; }
}

body.dropping .tile { box-shadow: 0 0 0 clamp(0.15rem, 0.8cqmin, 0.3rem) var(--lime); }
body.dropping .target { opacity: 1 !important; width: 34%; box-shadow: 0 0 0 clamp(0.15rem, 1cqmin, 0.35rem) var(--charcoal) !important; }
body.dropping .target::before, body.dropping .target::after { display: none; }
body.dropping .target-label { display: inline; }

/* The controls sit at the bottom left, where the hero has its buttons. */
.tools {
  grid-area: tools;
  align-self: end;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(0.55rem, 2.3cqmin, 1.35rem);
  container-type: inline-size;
}
.tool { min-width: 0; }

.cap {
  margin: 0 0 clamp(0.25rem, 0.8cqmin, 0.5rem);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--on-panel-soft);
}
.cap-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.readout { font-size: 0.8rem; color: var(--on-panel); font-variant-numeric: tabular-nums; white-space: nowrap; }

.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.25rem;
}

.btn {
  font: inherit;
  font-weight: 500;
  color: var(--on-panel);
  border: 0;
  border-radius: 999px;
  padding: 0.72rem 1.3rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease;
}
.btn-small { padding: 0.5rem 0.95rem; font-size: 0.875rem; }
.btn-primary { background: var(--purple); }
.btn-primary:hover { background: var(--purple-hover); }
.btn-quiet { background: var(--quiet); }
.btn-quiet:hover { background: var(--quiet-hover); }
.btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }

:is(.btn, .icon-btn, .thumb, .swatch):focus-visible,
input[type="range"]:focus-visible,
input[type="color"]:focus-visible,
.hex:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

/* Logo */
.logo-row { display: flex; align-items: center; gap: 0.6rem; min-height: 2.25rem; min-width: 0; }
.hint { font-size: 0.8rem; color: var(--on-panel-soft); white-space: nowrap; }
@media (hover: none) { .hint { display: none; } }
.thumb {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.2rem;
  border: 0;
  border-radius: 0.5rem;
  background: #FFFFFF;
  cursor: pointer;
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.logo-size { flex: 1 1 auto; min-width: 3rem; max-width: 9rem; display: flex; }
.logo-size input { width: 100%; margin: 0; accent-color: var(--lime); cursor: pointer; }
.icon-btn {
  flex: none;
  width: 2rem;
  height: 2rem;
  padding: 0.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--quiet);
  color: var(--on-panel);
  cursor: pointer;
}
.icon-btn:hover { background: var(--quiet-hover); }
.icon-btn svg { display: block; width: 100%; height: 100%; }

/* Shape */
.shapes { display: flex; gap: 0.3rem; }
.shape {
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 0.6rem;
  background: var(--quiet);
  color: var(--on-panel);
  cursor: pointer;
}
.shape:hover { background: var(--quiet-hover); }
.shape svg { width: 1.15rem; height: 1.15rem; fill: currentColor; }
.shape input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.shape:has(input:checked) { background: var(--lime); color: var(--charcoal); }
.shape:has(input:focus-visible) { outline: 2px solid var(--lime); outline-offset: 2px; }

/* Colour */
.colours { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.chips { display: flex; gap: 0.4rem; flex: 0 1 auto; min-width: 0; }
.chip {
  flex: 0 1 7.7rem;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.45rem 0.28rem 0.3rem;
  border-radius: 999px;
  background: var(--quiet);
}
input[type="color"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }
.chip-text { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.chip-name { font-size: 0.68rem; line-height: 1.15; color: var(--on-panel-soft); white-space: nowrap; }
.hex {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0.15rem;
  background: transparent;
  color: var(--on-panel);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
}
.hex[aria-invalid="true"] { color: var(--warn); }

.presets { display: flex; gap: 0.35rem; flex: none; }
.swatch {
  position: relative;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 0;
  border-radius: 0.42rem;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
  cursor: pointer;
}
.swatch::after {
  content: '';
  position: absolute;
  inset: 26%;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--code) 50%, var(--eye) 50%);
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--charcoal), 0 0 0 4px var(--lime); }

/* The preview keeps its colour. Only the downloaded file loses the background. */
.check {
  margin-left: auto;
  margin-bottom: clamp(0.25rem, 0.8cqmin, 0.5rem);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--on-panel);
  white-space: nowrap;
  cursor: pointer;
}
.check input {
  flex: none;
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--lime);
  cursor: pointer;
}
.check input:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

/* Print size. Each square grows with the print size. */
.sizes {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: end;
  gap: 0.2rem;
}
.size {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.28rem;
  min-height: 2rem;
  border-radius: 0.3rem;
  cursor: pointer;
}
.size input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.size-square {
  display: block;
  width: calc(var(--k) * var(--square-max));
  aspect-ratio: 1;
  border-radius: 0.14rem;
  background: #5E5D62;
  transition: background-color 0.12s ease;
}
.sizes { --square-max: clamp(1.4rem, 7.5cqmin, 2.9rem); }
.size:hover .size-square { background: #8A8990; }
.size:has(input:checked) .size-square { background: var(--lime); }
.size:has(input:focus-visible) { outline: 2px solid var(--lime); outline-offset: 2px; }
.size-name { font-size: 0.72rem; line-height: 1; color: var(--on-panel-soft); }
.size:has(input:checked) .size-name { color: var(--on-panel); }

/* Download and status */
.actions { display: flex; flex-direction: column; gap: clamp(0.35rem, 1.2cqmin, 0.7rem); }
.status {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0;
  min-height: 1.3em;
  font-size: 0.875rem;
  color: var(--on-panel);
}
.status::before {
  content: '';
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--on-panel-soft);
  transform: translateY(-0.05em);
}
.status[data-tone="ok"]::before { background: var(--lime); }
.status[data-tone="warn"]::before { background: var(--warn); }
.status[data-tone="warn"] { color: var(--warn); }
.downloads { display: flex; gap: 0.4rem; flex-wrap: nowrap; }

@media (min-aspect-ratio: 1/1) {
  .panel { max-height: min(100%, 60rem); }
}

/* Portrait: link, then code, then controls. */
@media (max-aspect-ratio: 1/1) {
  .grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "field"
      "stage"
      "tools";
  }
  .field { --link-size: clamp(1.25rem, 5.4cqw, 2.75rem); }
  .sizes { --square-max: clamp(1.5rem, 8cqw, 3rem); }
}

/* Narrow controls: colour sets go under the chips. */
@container (max-width: 30rem) {
  .chips { flex: 1 1 100%; }
  .chip { flex: 1 1 0; }
  .presets { flex: 1 1 100%; }
  .downloads .btn { flex: 1 1 auto; }
  .downloads .btn-primary { flex-grow: 3; }
}

/* Small phones. */
@media (max-width: 400px) {
  .promise { font-size: 0.75rem; }
  .chip { padding: 0.2rem 0.3rem 0.2rem 0.22rem; gap: 0.28rem; }
  input[type="color"] { width: 1.25rem; height: 1.25rem; }
  .hex { font-size: 0.72rem; }
  .btn { padding-inline: 0.8rem; }
  .pair { gap: 0.75rem; }
}
@media (max-width: 340px) {
  .promise { display: none; }
  .hint { display: none; }
}

/* Short windows: drop the words that repeat what the control shows. */
@media (max-height: 760px) and (max-aspect-ratio: 1/1) {
  .size-name { display: none; }
  .tools { gap: 0.5rem; }
}
@media (max-height: 640px) and (max-aspect-ratio: 1/1) {
  .presets { display: none; }
  .sizes { --square-max: 1.5rem; }
}
@media (max-height: 560px) and (min-aspect-ratio: 1/1) {
  .size-name, .presets { display: none; }
  .tools { gap: 0.35rem; }
  .cap { margin-bottom: 0.1rem; }
  .field { --link-size: clamp(1.1rem, 3cqw, 1.5rem); }
  .btn { padding: 0.42rem 0.9rem; font-size: 0.875rem; }
  .btn-small { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
  .logo-row { min-height: 1.9rem; }
  .shape { width: 1.9rem; height: 1.9rem; }
  .thumb { width: 1.9rem; height: 1.9rem; }
  .sizes { --square-max: 1.35rem; }
  .size { min-height: 1.75rem; }
}
@media (max-height: 420px) and (min-aspect-ratio: 1/1) {
  .top { padding-block: 0.25rem; }
  .mark { height: 1rem; }
  .bottom { padding-block: 0.1rem; font-size: 0.75rem; }
  .promise { font-size: 0.75rem; }
  .cap:not(#cap-size) { display: none; }
  .chip-name { display: none; }
  .status { font-size: 0.75rem; }
}

/* The 404 page. */
.notfound {
  height: 100%;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1.5rem;
}
.notfound h1 {
  margin: 0;
  font-size: clamp(1.6rem, 5cqw, 3.5rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.13;
}
a.btn { display: inline-block; text-decoration: none; }
a.btn:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
