/* microwavewatt.com */

:root {
  --magenta: #fc00ff;
  --ink: #16121a;
  --page: #f6f2f7;
  --card: #ffffff;
  --text: #1d1820;
  --muted: #655c69;
  --line: #e2d9e4;
  --accent-text: #b000b3; /* magenta, darkened to stay readable on white */
  --display: #120d14;
  --radius: 18px;
  --title-font: Impact, Haettenschweiler, "Arial Narrow Bold", "Franklin Gothic Bold", sans-serif;
  --body-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --digit-font: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #120d14;
    --card: #1d1620;
    --text: #f1eaf2;
    --muted: #a99fad;
    --line: #362b3a;
    --accent-text: #ff6bff;
    --display: #000000;
  }
}

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

body {
  margin: 0;
  padding: clamp(1.5rem, 5vw, 3.5rem) 1rem 2.5rem;
  background: var(--page);
  color: var(--text);
  font: 1rem/1.6 var(--body-font);
  -webkit-text-size-adjust: 100%;
}

.masthead,
main,
footer {
  max-width: 34rem;
  margin-inline: auto;
}

/* Title: the black-and-magenta shout of the old logo, set in type. */

.masthead {
  text-align: center;
  margin-bottom: clamp(1.5rem, 4vw, 2.25rem);
}

h1 {
  margin: 0;
  font: 400 clamp(2.6rem, 11vw, 4.25rem) / 1 var(--title-font);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--magenta);
  text-shadow: 0.06em 0.06em 0 var(--ink);
  text-wrap: balance;
}

.masthead p {
  margin: 0.9rem 0 0;
  color: var(--muted);
  text-wrap: balance;
}

@media (prefers-color-scheme: dark) {
  h1 {
    text-shadow: 0.06em 0.06em 0 #5c005e;
  }
}

/* Converter */

.converter {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 4vw, 2rem);
  box-shadow: 0 1px 2px rgb(22 18 26 / 0.04), 0 12px 32px -16px rgb(22 18 26 / 0.18);
}

fieldset {
  border: 0;
  margin: 0 0 1.75rem;
  padding: 0;
  min-width: 0;
}

legend {
  padding: 0;
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--accent-text);
}

.fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.field {
  flex: 1 1 11rem;
  display: grid;
  gap: 0.3rem;
}

.field > span {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.joiner {
  padding-bottom: 0.75rem;
  color: var(--muted);
}

@media (max-width: 30rem) {
  .fields {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .field {
    flex-basis: auto;
  }

  .joiner {
    padding-bottom: 0;
  }
}

select {
  appearance: none;
  width: 100%;
  min-height: 3rem;
  padding: 0.6rem 2.5rem 0.6rem 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background-color: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%238a7f8e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 0.75rem;
  color: inherit;
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

select:hover {
  border-color: var(--accent-text);
}

select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--magenta);
  outline-offset: 2px;
}

/* Result: read like the display on the microwave door. */

.result {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 1.25rem 1rem 1.1rem;
  border-radius: 14px;
  background: var(--display);
  color: #cfc4d2;
  text-align: center;
}

.result output {
  font: 700 clamp(3.25rem, 16vw, 5rem) / 1 var(--digit-font);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--magenta);
  text-shadow: 0 0 0.35em rgb(252 0 255 / 0.55);
}

@media (prefers-color-scheme: dark) {
  .result {
    border: 1px solid var(--line);
  }
}

/* Explanation */

.info {
  margin-top: 2rem;
  padding-inline: 0.25rem;
  color: var(--muted);
}

.info p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

/* Footer */

footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  font-size: 0.925rem;
}

.languages {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.languages a {
  display: block;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
}

.languages a:hover {
  color: var(--accent-text);
  text-decoration: underline;
}

.languages a[aria-current="page"] {
  background: var(--ink);
  color: #fff;
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  .languages a[aria-current="page"] {
    background: var(--magenta);
    color: #120d14;
  }
}

.concept {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  text-decoration: none;
}

.concept:hover {
  color: var(--accent-text);
  text-decoration: underline;
}
