@import url("../fonts/web/margazhi.css");

:root {
  --bg: #3b2a20;
  --text: #f3ead8;
  --muted: #c9b9a0;
  --accent: #c2541f;
  --rule: #5a4434;
  --link-rule: #a43e0f;
  --link-hover: #4d3828;
  --panel: #45332a;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Catamaran", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.55;
  margin: 0;
  padding: 0 16px;
}

#content {
  max-width: 40rem;
  margin: 0 auto;
  padding: 40px 0 48px;
}

/* Header */

header {
  text-align: center;
  margin-bottom: 28px;
}
.logo,
.logo:hover {
  border: none;
  background: none;
}
.logo {
  display: block;
  margin: 0 0 18px;
}
.logo img {
  display: block;
  width: 100%;
  height: auto;
}
header h1 {
  font-size: 1.35em;
  font-weight: normal;
  letter-spacing: 0.02em;
  line-height: 1.3;
  margin: 0;
}
.tagline {
  color: var(--muted);
  margin: 8px 0 0;
}
nav {
  margin-top: 14px;
  font-size: 0.95em;
}
nav a {
  margin: 0 10px;
  color: var(--muted);
}
nav a[aria-current="page"] {
  color: var(--text);
  border-bottom: 2px solid var(--accent);
}

/* Body */

figure {
  margin: 0 0 18px;
}
figure img {
  display: block;
  width: 100%;
  height: auto;
}
figcaption {
  margin-top: 6px;
  font-size: 0.85em;
  color: var(--muted);
  text-align: center;
}

h2 {
  font-size: 1.1em;
  font-weight: 600;
  margin: 36px 0 12px;
  padding-bottom: 12px;
  /* a row of kolam dots */
  background: radial-gradient(circle, var(--muted) 1.5px, transparent 2px) left bottom / 14px 6px repeat-x;
}

p {
  margin: 0 0 14px;
}
main p {
  text-align: justify;
  hyphens: auto;
}

a {
  color: var(--text);
  text-decoration: none;
}
main a {
  border-bottom: 1px solid var(--link-rule);
}
main a:hover {
  background: var(--link-hover);
}
nav a {
  border-bottom: none;
}

/* Key facts */

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 20px;
  margin: 0 0 14px;
}
.facts dt {
  font-weight: bold;
}
.facts dd {
  margin: 0;
}

/* Text set in Margazhi */

.kolam {
  font-family: "Margazhi";
  font-weight: 400;
  line-height: 1.3;
  overflow-wrap: anywhere;
  text-align: left;
  hyphens: none;
}
.kolam.bold {
  font-weight: 700;
}

/* Controls under the Try it box */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  align-items: center;
  margin-top: 8px;
  font-size: 0.9em;
  color: var(--muted);
}
.controls label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  cursor: pointer;
}
.controls input[type="range"] {
  accent-color: var(--accent);
}
.controls input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Try it box */

.maker {
  margin: 0 0 14px;
}
.maker input[type="text"] {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 1.2em;
}
.maker input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.maker-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 170px;
  margin-top: 10px;
  border: 1px solid var(--rule);
}
.maker-preview.transparent {
  /* a checkerboard shows where the image is transparent */
  background: repeating-conic-gradient(#d8cdb8 0% 25%, #f3ead8 0% 50%) 0 0 / 16px 16px;
}
.maker-preview[hidden] {
  display: none;
}
.maker-preview svg {
  display: block;
}
.maker-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 170px;
  margin: 10px 0 0;
  border: 1px solid var(--rule);
  color: var(--muted);
}
.maker-empty[hidden] {
  display: none;
}
.maker .controls .button {
  margin: 0;
  font: inherit;
  color: var(--text);
  background: none;
  cursor: pointer;
}
.maker .controls .button.primary {
  background: var(--accent);
  color: #fff;
}
.maker .controls .button:hover {
  background: var(--link-rule);
}
.maker .controls .button:disabled {
  opacity: 0.5;
  cursor: default;
}
.note {
  color: var(--muted);
  font-size: 0.9em;
  margin-top: 8px;
}

/* Download button */

.button {
  display: inline-block;
  margin: 4px 12px 14px 0;
  padding: 6px 16px;
  border: 1px solid var(--accent);
  border-radius: 3px;
}
main a.button {
  border-bottom: 1px solid var(--accent);
}
main a.button.primary {
  background: var(--accent);
  color: #fff;
}
main a.button.primary:hover {
  background: var(--link-rule);
}

/* Designs table */

.designs {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px;
}
.designs th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9em;
  padding: 0 8px 6px 0;
}
.designs td {
  padding: 6px 8px 6px 0;
  border-top: 1px solid var(--rule);
  vertical-align: middle;
}
.designs .kolam {
  font-size: 3.2em;
  line-height: 1;
}
kbd {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.85em;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--panel);
}

/* Code */

pre {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 0.8em;
  line-height: 1.5;
  margin: 0 0 14px;
}
code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

/* Glyph grid */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr));
  gap: 6px;
  margin: 0 0 14px;
}
.cell {
  border: 1px solid var(--rule);
  padding: 8px 4px 4px;
  text-align: center;
}
.cell .kolam {
  display: block;
  text-align: center;
  font-size: 2.6em;
  line-height: 1;
}
.cell .key {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8em;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

footer {
  margin-top: 36px;
  color: var(--muted);
  font-size: 0.85em;
  text-align: center;
}
footer a {
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}
.grid.bold .kolam {
  font-weight: 700;
}
