/* style.css */
/* SPDX-License-Identifier: MIT */
/* Copyright (c) 2026 Wei-Hsu Lin */

:root {
  --margin: 60px;
  font-size: 14px; /* Can be changed by user from 10 to 18 */
}
html, body {
  margin: 0;
  height: 100%;
  /* Added to resolve problem of Chromium using Liberation Serif and Firefox using Noto Serif */
  /* on my laptop. I like Chromium's look more so this suggests all systems to use */
  font-family: "Times New Roman", Times, serif; 
}
select, button { 
  /* Added to resolve problem of Chromium using Liberation Sans and Firefox using Noto Sans */
  /* on my laptop. I like Chromium's look more so this suggests all systems to use */
  /* Arial or its lookalike */
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 0.8rem; /* Sans serif usually look a bit bigger than serif */
}
body {
  background-image: url("cairo-tiling.png");
  background-repeat: repeat;
  background-size: 3rem 3rem; /* same as source size */
}
#stage { /* Centered region on screen, with a constant left/right margin + 2 : 1 aspect ratio */
  position: fixed;
  left: var(--margin);
  right: var(--margin);        /* left + right set leads to width set */
  top: 50%;
  translate: 0 -50%;           /* top + translate centers vertically */
  aspect-ratio: 2 / 1;         
  min-height: 0;               /* don't let content stretch the ratio */

  display: grid;
  background: ivory;
  outline: 20px solid ivory; /* Add a visual-only margin */

  /* Adds a fuzz if preferred */
  /* box-shadow: 0 0 30px 15px #ffffff; */
  
  /* Creates a 12x12 grid for placement */
  grid-template-columns: repeat(12, minmax(0, 1fr)); 
  grid-template-rows: repeat(12, minmax(0, 1fr));
  gap: 0;
}
#stage > * { /* Basically the container divs */
  min-width: 0;
  min-height: 0;
  overflow: hidden; /* prevent content from pushing the cell */
}

/* Set position of each subwindow */

/* Top left banner, displayes title */
#banner {
  grid-column: 1 / 7;
  grid-row: 1 / 2;
  display: grid;
  place-items: center;
  font-family: sans-serif;
  font-size: 1.5rem;
}

/* left to bottom-left: columns 9-12, rows 1-7 */
#flat-view {
  grid-column: 1 / 7;
  grid-row: 2 / 12;
  background: #eee;
  padding: 20px;
  border: 2px solid #000;
  display: flex;
  justify-content: center;
}

/* 2D Canvas that the user interacts with */
#flat-view canvas {
  aspect-ratio: 1 / 1; /* keep the square canvas square, letterboxed in the cell */
  height: 100%;
}

#flat-description {
  grid-column: 7 / 9;
  grid-row: 2 / 12;
  padding-inline: 3px; /* Give a little space on left and right */
}

/* Input sliders for X and Z error density during random fill */
.density-range {
  width: 40%;
  /* Make it sit flush with text inline with it. Default is "baseline" with is too high */
  vertical-align: middle; 
}

/* top-right: columns 9-12, rows 1-7 */
#torus-view {
  grid-column: 9 / 13;
  grid-row: 1 / 8;
  background: #eee;
  border: 2px solid #000;
}

/* Canvas of Three.js, draws the torus */
#torus-view canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Description under the torus */
#torus-description {
  grid-column: 9 / 13;
  grid-row: 8 / 10;
  position: relative;
  padding-block: 3px; /* Give a little space on top and bottom */
}

/* Small flexbox that contains the console title, font size select and clear button */
#console-header {
  position: absolute;
  bottom: 0;
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

/* Small textarea "console" */
#console {
  grid-column: 9 / 13;
  grid-row: 10 / 12;
  border: 2px solid #000;
  box-sizing: border-box;
  font-family: monospace;
  overflow-y: auto;
  font-size: 0.8rem; /* Monospace fonts usually appear larger at same font size, so this evens things out */
  resize: none; /* Ban resizing */
}

/* Footer, displayed project info */
#footer {
  grid-column: 1 / 13;
  grid-row: 12 / 13;
  padding-top: 3px; /* Give a little space, otherwise the text are touching the border above */
}

