/* OmniRose: shared styles. No build step, no external fonts. */

:root {
  --bg: #f7f3ea;
  --card: #ffffff;
  --ink: #1d2733;
  --muted: #5b6b7a;
  --line: #e2dccf;
  --navy: #12355b;
  --sea: #1f7a8c;
  --sea-soft: #e3f1f3;
  --coral: #d9512c;
  --coral-soft: #fbe8e1;
  --ok: #2d7a46;
  --shadow: 0 1px 2px rgb(18 53 91 / 6%), 0 4px 16px rgb(18 53 91 / 6%);
  --radius: 12px;
  --magnetic: #fff2f2;
  --true: #f2fff2;
  --compass: #f2f2ff;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1b26;
    --card: #172634;
    --ink: #e8eef3;
    --muted: #9fb0bf;
    --line: #2a3d4f;
    --navy: #9ccbeb;
    --sea: #5fbfcf;
    --sea-soft: #1b3a45;
    --coral: #ff8a63;
    --coral-soft: #44261d;
    --ok: #7fd39a;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1b26;
  --card: #172634;
  --ink: #e8eef3;
  --muted: #9fb0bf;
  --line: #2a3d4f;
  --navy: #9ccbeb;
  --sea: #5fbfcf;
  --sea-soft: #1b3a45;
  --coral: #ff8a63;
  --coral-soft: #44261d;
  --ok: #7fd39a;
  --shadow: none;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a {
  color: var(--sea);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--coral);
}

img,
svg {
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3 {
  color: var(--navy);
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 0.4em;
}

h2 {
  font-size: 1.45rem;
  margin: 1.6em 0 0.5em;
}

h3 {
  font-size: 1.15rem;
  margin: 1.4em 0 0.4em;
}

p,
li {
  text-wrap: pretty;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px;
}

.prose {
  max-width: 44rem;
}

/* ---- Header and footer */

.site-header {
  background: var(--navy);
  color: #fff;
}

:root[data-theme="dark"] .site-header {
  background: #0b2238;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-header {
    background: #0b2238;
  }
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
}

.brand:hover {
  color: #fff;
}

.brand img {
  width: 34px;
  height: 34px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 0.95rem;
}

.site-nav a {
  color: #d6e6f2;
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: #ffb199;
}

main {
  padding: 32px 0 56px;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 24px 0 40px;
}

.site-footer p {
  margin: 0.3em 0;
}

/* ---- Building blocks */

.lede {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 40rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 0 0 20px;
}

.card > h2:first-child {
  margin-top: 0;
}

.step {
  display: inline-grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  margin-right: 0.4em;
  border-radius: 50%;
  background: var(--sea);
  color: var(--card);
  font-size: 0.85em;
  vertical-align: 0.1em;
}

.button,
button {
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: 8px 14px;
  line-height: 1.3;
}

button:hover,
.button:hover {
  border-color: var(--sea);
}

.button.primary,
button.primary {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}

.button.primary:hover,
button.primary:hover {
  filter: brightness(1.08);
  color: #fff;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--sea);
  outline-offset: 2px;
}

input,
select {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
}

input[type="number"] {
  width: 6em;
}

select {
  max-width: 100%;
}

#example {
  flex: 1 1 100%;
}

label {
  font-weight: 600;
  font-size: 0.95rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.callout {
  background: var(--sea-soft);
  border-left: 4px solid var(--sea);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 1.2em 0;
}

.callout.warm {
  background: var(--coral-soft);
  border-left-color: var(--coral);
}

/* A small label after a heading, such as "Experimental". */
.tag {
  display: inline-block;
  vertical-align: middle;
  font-size: 0.4em;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--coral);
  border: 1.5px solid var(--coral);
  border-radius: 999px;
  padding: 0.2em 0.7em;
}

.figure {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 1.4em 0;
}

.figure figcaption {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

/* ---- Home page */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
}

.hero img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #fff;
}

@media (max-width: 720px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.features .card h3 {
  margin-top: 0;
}

/* ---- The tool */

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-row label {
  display: block;
  margin-bottom: 4px;
}

.form-row input {
  width: 100%;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0 16px;
}

.toolbar .spacer {
  flex: 1;
}

.readings {
  border-collapse: collapse;
  width: 100%;
  max-width: 520px;
}

.readings th {
  text-align: left;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 6px;
}

.readings td {
  padding: 4px 6px;
  white-space: nowrap;
}

.readings tr.has-error input {
  border-color: var(--coral);
}

.readings .remove {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.2rem;
  padding: 2px 8px;
}

.readings .remove:hover {
  color: var(--coral);
}

.readings .unit {
  color: var(--muted);
  margin-left: 2px;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.messages li {
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.messages .error {
  background: var(--coral-soft);
}

.messages .warning {
  background: var(--sea-soft);
}

.messages .good {
  color: var(--ok);
  padding-left: 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tabs button[aria-selected="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--card);
}

.preview {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 560px;
  margin: 0 auto;
  aspect-ratio: 590 / 790;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.preview svg {
  width: 100%;
  height: 100%;
  display: block;
}

.preview .empty {
  color: #5b6b7a;
  padding: 24px;
  text-align: center;
  max-width: 22rem;
}

.downloads {
  display: grid;
  gap: 16px;
}

.download-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.download-group h3 {
  margin-top: 0;
}

.downloads + .download-group {
  margin-top: 16px;
}

.range {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
}

.range input[type="number"] {
  width: 5em;
}

.where-toolbar {
  margin: 4px 0 0;
}

.where-toolbar select {
  flex: 1 1 200px;
}

.custom-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 16px;
  margin-top: 8px;
}

.custom-area label {
  font-weight: 400;
}

.custom-area .edge {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.custom-area input[type="number"] {
  width: 5em;
}

.custom-area p {
  grid-column: 1 / -1;
  margin: 0;
}

.share {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.share input {
  flex: 1 1 260px;
  min-width: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.observations {
  display: grid;
  gap: 10px;
}

.obs {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.obs-inputs {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px 14px;
}

.obs-inputs label {
  display: grid;
  gap: 2px;
  font-size: 0.85rem;
}

.obs-inputs span {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
}

.obs-inputs .time {
  width: 7.5em;
}

.obs-inputs .shadow {
  width: 8em;
}

.obs-inputs .remove {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.2rem;
  margin-left: auto;
}

.obs-inputs .now {
  padding: 7px 10px;
}

.obs-result p {
  margin: 8px 0 0;
  font-size: 0.9rem;
}

.obs-working b {
  font-variant-numeric: tabular-nums;
}

.obs-working .dev {
  color: var(--coral);
}

.obs-warning {
  background: var(--sea-soft);
  border-radius: 6px;
  padding: 4px 8px;
}

button.link {
  border: none;
  background: none;
  padding: 0;
  color: var(--sea);
  text-decoration: underline;
  font-size: inherit;
}

a.button[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

details.advanced {
  margin-top: 16px;
}

details.advanced summary {
  cursor: pointer;
  color: var(--sea);
  font-weight: 600;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.tool-layout > * {
  min-width: 0;
}

.tool-layout .sticky {
  position: sticky;
  top: 16px;
}

@media (max-width: 860px) {
  .tool-layout {
    grid-template-columns: 1fr;
  }

  .tool-layout .sticky {
    position: static;
  }
}

/* ---- Content pages */

.worked {
  border-collapse: collapse;
  margin: 1em 0;
  font-variant-numeric: tabular-nums;
}

.worked th,
.worked td {
  border-bottom: 1px solid var(--line);
  padding: 6px 12px;
  text-align: left;
}

.mnemonic {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 8px;
  padding: 0;
  list-style: none;
}

.toc a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  background: var(--card);
  font-size: 0.92rem;
}

/* ---- Print: just the content */

@media print {
  .site-header,
  .site-footer,
  .toolbar,
  .tabs,
  button,
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card {
    box-shadow: none;
    border: none;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 16px 12px;
  }

  .readings td {
    padding: 3px 2px;
  }

  .readings input[type="number"] {
    width: 4.6em;
  }

  .readings select {
    padding: 7px 4px;
  }
}

/* Home page: the rose explained, then smaller sections with an image beside them. */
.rose-feature {
  border-top: 4px solid var(--coral);
}

.image-feature {
  display: grid;
  grid-template-columns: minmax(0, 160px) 1fr;
  gap: 20px;
  align-items: center;
}

.image-feature img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (max-width: 560px) {
  .image-feature {
    grid-template-columns: 1fr;
  }

  .image-feature img {
    width: min(100%, 200px);
    margin: 0 auto;
  }
}

/* A button that looks like a link, such as "show email address". */
.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--sea);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  box-shadow: none;
}

.link-button:hover {
  background: none;
  color: var(--coral);
}
