/*
 * styles.css -- layout for Triangle Maths.
 *
 * Two columns on a wide screen, one on a phone, with the board always square so
 * the circle stays a circle. The 2015 app was locked to landscape at 480x320;
 * this one has to work in a hand, held upright.
 */

/*
 * Three themes. The canvas is not styled by CSS, so every colour the drawing
 * uses is declared here as a custom property and read back by board.js: one
 * place to change a theme, and the figure can never drift from the page around
 * it. Switching themes only swaps these values.
 */
:root,
[data-theme="paper"] {
  --ink: #111827;
  --ink-soft: #4b5563;
  --line: #d9dee7;
  --paper: #ffffff;
  --page: #eef1f6;
  --accent: #2f6df6;
  --radius: 14px;
  --surface: #f8fafc;
  --surface-active: #e8edf6;
  --field: #ffffff;

  --board-back: #fbfbfd;
  --c-grid: rgba(15, 33, 12, .16);
  --c-axis: #d6453c;
  --c-ink: #111827;
  --c-circle-fill: rgba(255, 255, 153, .35);
  --c-incircle: rgba(255, 220, 45, .38);
  --c-vertex: rgba(17, 24, 39, .55);
  --c-vertex-active: #2f6df6;
  --c-centre: #3aa655;
  --c-incentre: #1e26ff;
  --c-bisector: #d08a6e;
  --c-perpendicular: #2422de;
  --c-label-back: rgba(255, 255, 255, .93);
}

/* Dark: the same figure on a near-black ground, with the fills dimmed so the
   yellow does not glare at night and the lines lifted so they still read. */
[data-theme="dark"] {
  --ink: #e5e7eb;
  --ink-soft: #9ca3af;
  --line: #273244;
  --paper: #111827;
  --page: #0b1220;
  --accent: #60a5fa;
  --surface: #172033;
  --surface-active: #1f2a41;
  --field: #0f172a;

  --board-back: #0f172a;
  --c-grid: rgba(148, 163, 184, .16);
  --c-axis: #f87171;
  --c-ink: #e5e7eb;
  --c-circle-fill: rgba(148, 163, 184, .10);
  --c-incircle: rgba(56, 189, 248, .16);
  --c-vertex: rgba(226, 232, 240, .75);
  --c-vertex-active: #60a5fa;
  --c-centre: #4ade80;
  --c-incentre: #7dd3fc;
  --c-bisector: #fbbf24;
  --c-perpendicular: #93c5fd;
  --c-label-back: rgba(15, 23, 42, .88);
}

/* Blueprint: white lines on drafting blue, which is how this figure is drawn on
   paper in a geometry class. */
[data-theme="blueprint"] {
  --ink: #e8f1ff;
  --ink-soft: #a9c4e8;
  --line: #2b4d80;
  --paper: #12386a;
  --page: #0b2545;
  --accent: #7dd3fc;
  --surface: #164277;
  --surface-active: #1b4f8c;
  --field: #0f3363;

  --board-back: #123a6b;
  --c-grid: rgba(255, 255, 255, .18);
  --c-axis: #ffd166;
  --c-ink: #f8fbff;
  --c-circle-fill: rgba(255, 255, 255, .08);
  --c-incircle: rgba(125, 211, 252, .18);
  --c-vertex: rgba(255, 255, 255, .85);
  --c-vertex-active: #ffd166;
  --c-centre: #a7f3d0;
  --c-incentre: #ffd166;
  --c-bisector: rgba(255, 255, 255, .55);
  --c-perpendicular: #7dd3fc;
  --c-label-back: rgba(11, 37, 69, .85);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.app-header {
  padding: max(14px, env(safe-area-inset-top)) 18px 10px;
  text-align: center;
}

.app-header h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -.01em;
}

.tagline {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: .9rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 0 14px 20px;
  max-width: 1180px;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .9fr);
    align-items: start;
  }
}

/* --------------------------------------------------------------- board */

.board-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.board-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 70vh;
  margin: 0 auto;
}

/* Squared off by the aspect ratio above; touch-action none so a drag on the
   figure moves a vertex instead of scrolling the page. */
#board {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  border-radius: 10px;
  background: var(--board-back);
  border: 1px solid var(--line);
}

.scale-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.scale-button {
  min-width: 44px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.05rem;
  cursor: pointer;
}

.scale-button:active { background: var(--surface-active); }

.scale-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: var(--ink-soft);
}

.scale-value input {
  width: 84px;
  min-height: 40px;
  padding: 6px 8px;
  font-size: 1rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  color: var(--ink);
}

.text-button {
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  color: var(--accent);
  font-size: .9rem;
  cursor: pointer;
}

.help {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: .9rem;
  color: var(--ink-soft);
}

.help p { margin: 0 0 8px; }
.help p:last-child { margin-bottom: 0; }
.help strong { color: var(--ink); }

/* ------------------------------------------------------------ readouts */

.readout-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

@media (min-width: 900px) {
  .readout-panel { grid-template-columns: minmax(0, 1fr); }
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.card h2 {
  margin: 0 0 8px;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
}

dl { margin: 0; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  text-align: center;
}

.rows > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
}

dt {
  font-size: .8rem;
  color: var(--ink-soft);
}

dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  font-weight: 600;
}

.grid-3 dd { font-size: 1.05rem; }

.toggles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.toggles label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  cursor: pointer;
}

.toggles input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.app-footer {
  padding: 4px 18px max(18px, env(safe-area-inset-bottom));
  text-align: center;
  color: var(--ink-soft);
  font-size: .8rem;
}



/* Dot outline, so a light dot on a dark board still has an edge. */
:root,
[data-theme="paper"] { --c-dot-edge: rgba(17, 24, 39, .8); }
[data-theme="dark"] { --c-dot-edge: rgba(15, 23, 42, .9); }
[data-theme="blueprint"] { --c-dot-edge: rgba(11, 37, 69, .9); }

/* Theme picker: three buttons, the current one pressed. */
.theme-row {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.theme-button {
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  color: var(--ink-soft);
  font-size: .85rem;
  cursor: pointer;
}

.theme-button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}



/* ---------------------------------------------- site chrome
   Only on the copy hosted at inquiry.hirenkumar.com.au: the header that ties
   this page to the rest of the site. Taken from the MathGraphs copy so the two
   match. The app and iOS builds do not have it. */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid #e3e9e7;
}

.site-header-in {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #0c2622;
  text-decoration: none;
  font-family: "Poppins", "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.92rem;
  background: linear-gradient(135deg, #0b3d36 0%, #1a1a1a 48%, #d9a441 100%);
  color: rgba(255, 255, 255, 0.94);
  letter-spacing: 0.03em;
  text-shadow:
    -1px -1px 1px rgba(0, 0, 0, 0.55),
    1px 1px 1px rgba(255, 255, 255, 0.4);
}

.brand small {
  display: block;
  font-family: "Segoe UI", sans-serif;
  font-weight: 500;
  font-size: 0.64rem;
  color: #5b6b67;
  letter-spacing: 0.04em;
}

.home-link {
  flex: none;
  background: #121212;
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.home-link:hover { background: #000; }

