/* ============================================================
   Main-site theme variables.
   Edit colors here to retune the palette — nothing else needed.
   ============================================================ */

:root,
[data-theme="light"] {
  --bg:          #ffffff;
  --text:        #000000;
  --muted:       #555555;
  --link:        #1772d0;
  --link-hover:  #f09228;
  --rule:        #e6e6e6;
  --highlight:   #ffffd0;
  --accent-red:  #c00000;
}

[data-theme="dark"] {
  --bg:          #1c1c1e;
  --text:        #e9e9ea;
  --muted:       #a0a0a5;
  --link:        #6cb6ff;
  --link-hover:  #ffb86b;
  --rule:        #2c2c2e;
  --highlight:   #4a4416;
  --accent-red:  #ff6b6b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:          #1c1c1e;
    --text:        #e9e9ea;
    --muted:       #a0a0a5;
    --link:        #6cb6ff;
    --link-hover:  #ffb86b;
    --rule:        #2c2c2e;
    --highlight:   #4a4416;
    --accent-red:  #ff6b6b;
  }
}

/* ------------------------------------------------------------
   Apply the variables (overrides hardcoded colors in
   the legacy stylesheet.css without touching its rules).
   ------------------------------------------------------------ */

html, body {
  background-color: var(--bg);
  color: var(--text);
}

body, td, th, tr, p, strong {
  color: var(--text);
}

a {
  color: var(--link);
}

a:focus,
a:hover {
  color: var(--link-hover);
}

span.highlight {
  background-color: var(--highlight);
  color: #000;
}

.text-red {
  color: var(--accent-red);
}

img {
  /* Soften photos a touch in dark mode so they don't glare. */
  transition: filter 0.2s ease-in-out;
}

[data-theme="dark"] img:not([src*="favicon"]) {
  filter: brightness(0.92);
}

/* Project thumbnails: framed cards.
   Outer .one is a small "passe-partout" — page-coloured padding ring
   so the artwork's corners don't get eaten by the rounded mask. */
.one {
  border-radius: 14%;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid var(--rule);
  padding: 4px;
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06),
              0 2px 6px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .one {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5),
              0 2px 6px rgba(0, 0, 0, 0.35);
}

.two {
  position: absolute;
  top: 4px; right: 4px; bottom: 4px; left: 4px;
  width: auto; height: auto;
  border-radius: 10%;
  overflow: hidden;
  box-sizing: border-box;
}

.one > img,
.one > video,
.two > img,
.two > video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10%;
}

/* ------------------------------------------------------------
   Theme toggle button — small, inline with the contact row.
   ------------------------------------------------------------ */

.theme-toggle {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  color: var(--link);
  line-height: 1;
}

.theme-toggle:hover,
.theme-toggle:focus {
  color: var(--link-hover);
  outline: none;
}

.theme-toggle:focus-visible {
  outline: 1px dashed var(--link-hover);
  outline-offset: 2px;
}

/* Fixed-corner variant for the main page. Small pill in the top-right
   of the viewport — discoverable, doesn't disturb the contact row. */
.theme-toggle-fixed {
  position: fixed;
  top:   max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 50;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.theme-toggle-fixed:hover {
  border-color: var(--text);
  color: var(--link);
}

[data-theme="dark"] .theme-toggle-fixed {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Show the right glyph for the current theme. */
.theme-toggle .glyph-dark  { display: none; }
.theme-toggle .glyph-light { display: inline; }

[data-theme="dark"] .theme-toggle .glyph-light { display: none; }
[data-theme="dark"] .theme-toggle .glyph-dark  { display: inline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
