/* Last-Minute Optics — static rebuild */

@import url('https://fonts.googleapis.com/css2?family=Inconsolata:wght@400;600;700&family=Merriweather:wght@400;700&display=swap');

:root {
  --bg: #f2f2f2;
  --text: #4c4c4c;
  --heading: #000000;
  --heading-soft: #414141;
  --accent: #008165;
  --brand-green: #008165;
  --header-bg: #add9cf;
  --grid-line: rgba(0, 0, 0, 0.07);
  --grid-size: 24px;
  --font-body: 'Inconsolata', monospace;
  --font-heading: 'Merriweather', serif;
}

:root[data-theme="dark"] {
  --bg: #14191a;
  --text: #cbd2d0;
  --heading: #f4f4f4;
  --heading-soft: #f5f5f5;
  --accent: #3ecfa6;
  --header-bg: #1e3733;
  --grid-line: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mint-band {
  background: var(--header-bg);
  text-align: center;
  padding: 40px 0;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

/* Diagram-style focus-bracket hover on any linked image */
a:has(> img) {
  position: relative;
  display: inline-block;
}

a:has(> img) img {
  transition: transform 0.25s ease;
}

a:has(> img)::before,
a:has(> img)::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

a:has(> img)::before {
  top: -6px;
  left: -6px;
  border-right: none;
  border-bottom: none;
}

a:has(> img)::after {
  bottom: -6px;
  right: -6px;
  border-left: none;
  border-top: none;
}

a:has(> img):hover::before,
a:has(> img):hover::after {
  opacity: 1;
  transform: scale(1);
}

a:has(> img):hover img {
  transform: scale(1.03);
}

@media (prefers-reduced-motion: reduce) {
  a:has(> img) img,
  a:has(> img)::before,
  a:has(> img)::after {
    transition: none;
  }
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 400;
  margin: 0 0 20px;
  color: var(--heading);
}

article p {
  font-size: 20px;
  line-height: 1.5;
  margin: 0 0 20px;
  color: var(--text);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 25px;
}

/* Header */
.site-header {
  background: var(--header-bg);
  padding: 20px 40px;
}

.site-header .header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.site-title {
  font-family: var(--font-heading);
  font-size: 38px;
  font-weight: 400;
  color: var(--heading);
}

.site-title a { color: var(--heading); }

.main-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 32px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.main-nav a {
  position: relative;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--heading);
  padding-bottom: 6px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.main-nav a::after {
  content: '';
  position: absolute;
  right: -3px;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.main-nav a:hover,
.main-nav a.active {
  border-bottom-color: var(--accent);
}

.main-nav a:hover::after,
.main-nav a.active::after {
  opacity: 1;
  transform: scale(1);
}

.theme-toggle {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid var(--heading);
  border-radius: 50%;
  background: none;
  color: var(--heading);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  transform: rotate(20deg);
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.theme-toggle .icon-moon { display: none; }

:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Hero */
.hero {
  position: relative;
  background-size: cover;
  background-position: center;
  min-height: 480px;
  display: flex;
  align-items: center;
}

.hero.hero-home {
  background-size: 175%;
  min-height: 560px;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  transition: background-color 0.2s ease;
}

:root[data-theme="dark"] .hero::before {
  background: rgba(8, 12, 11, 0.6);
}

.hero.hero-small::before,
.hero.hero-plain::before {
  background: rgba(255, 255, 255, 0.8);
}

.hero-inner {
  position: relative;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 60px;
}

.hero-inner .eyebrow {
  font-family: var(--font-heading);
  text-transform: uppercase;
  color: var(--accent);
  font-size: 45px;
  margin: 0 0 6px;
  letter-spacing: 1px;
}

.hero-inner .subtitle {
  font-family: var(--font-heading);
  text-transform: uppercase;
  color: var(--heading-soft);
  font-size: 24px;
  margin: 0 0 20px;
}

:root[data-theme="dark"] .hero-inner .eyebrow,
:root[data-theme="dark"] .hero-inner .subtitle {
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.hero-inner hr {
  border: none;
  border-top: 1px solid #b7c2bf;
  max-width: 400px;
  margin: 0 0 24px;
}

.hero-inner p {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--text);
  max-width: 620px;
  margin: 0;
}

:root[data-theme="dark"] .hero-inner p {
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.hero.hero-small {
  min-height: 260px;
}

.hero.hero-small h1 {
  position: relative;
  font-size: 34px;
  text-transform: uppercase;
  color: var(--heading);
}

.hero.hero-plain h1 {
  position: relative;
  font-size: 32px;
  font-weight: 400;
  color: var(--heading-soft);
  text-align: center;
  width: 100%;
}

.hero.hero-plain .hero-inner {
  display: flex;
  justify-content: center;
}

/* Textured section */
.texture-section {
  padding: 60px 0;
  text-align: center;
}

.texture-section-tight {
  padding-bottom: 15px;
}

.texture-section h2 {
  font-size: 30px;
}

.texture-section h2.accent {
  color: var(--accent);
  font-size: 34px;
}

/* Animated ray-diagram accent */
.ray-diagram {
  width: 140px;
  margin: 0 auto 20px;
}

.ray-diagram svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.ray-diagram .ray-lens {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0.6;
}

.ray-diagram .ray-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 4 5;
  opacity: 0.55;
  animation: ray-flow 1.2s linear infinite;
}

.ray-diagram .ray-focus-dot {
  fill: var(--accent);
  transform-origin: center;
  transform-box: fill-box;
  animation: ray-pulse 2s ease-in-out infinite;
}

@keyframes ray-flow {
  to { stroke-dashoffset: -18; }
}

@keyframes ray-pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.35); }
}

@media (prefers-reduced-motion: reduce) {
  .ray-diagram .ray-line,
  .ray-diagram .ray-focus-dot {
    animation: none;
  }
}

/* Main content */
main {
  padding: 60px 0;
}

main.main-tight {
  padding-top: 15px;
}

main .container > h2 {
  text-align: center;
  font-size: 30px;
  margin-bottom: 30px;
}

/* Video */
.video-wrap {
  max-width: 700px;
  margin: 0 auto 40px;
}

.video-wrap video {
  width: 100%;
  border-radius: 4px;
}

/* Books — home page (single, stacked & centered) */
.book-solo {
  max-width: 400px;
  margin: 0 auto;
  text-align: center;
}

.book-solo .book-caption {
  font-size: 18px;
  margin-bottom: 20px;
}

.book-solo img {
  margin: 0 auto;
}

.disclosure {
  font-size: 14px;
  color: #888;
  text-align: center;
  margin-top: 20px;
}

/* Books — lectures page (two cards, side by side) */
.book-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 20px;
}

.book-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.book-card > a {
  width: 140px;
  flex-shrink: 0;
}

.book-card img {
  width: 100%;
}

.book-card p {
  font-size: 16px;
}

/* Lecture grid — 3 across */
.lecture-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  text-align: center;
  margin-top: 30px;
}

.lecture-grid h3 {
  font-size: 18px;
  margin-bottom: 14px;
}

.video-channel {
  text-align: center;
  margin-bottom: 20px;
}

.video-channel h3 {
  font-weight: 400;
  font-size: 20px;
  margin-bottom: 20px;
}

.video-channel img {
  max-width: 400px;
  margin: 0 auto;
}

/* Lecture Circuit box */
.circuit-box {
  display: inline-block;
  border: 2px solid var(--text);
  padding: 16px 30px;
  margin-top: 16px;
  font-size: 16px;
}

/* About */
.bio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 50px;
}

.bio {
  text-align: center;
}

.bio img,
.bio .avatar-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 4px;
  margin: 0 auto 16px;
  object-fit: cover;
  object-position: center 12%;
}

.bio .avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 30px;
}

.bio p {
  text-align: left;
}

.bio h2 {
  font-size: 22px;
  margin-bottom: 16px;
}

/* Contact */
.contact-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  margin-bottom: 20px;
}

.contact-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.contact-item .icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  fill: var(--accent);
  margin-top: 4px;
  transition: transform 0.2s ease;
}

.contact-item:hover .icon {
  transform: scale(1.2);
}

.contact-item h4 {
  font-size: 18px;
  margin-bottom: 4px;
}

.contact-item p,
.contact-item a {
  font-size: 17px;
}

.acknowledgments ul {
  padding-left: 20px;
}

.helpful-links {
  background: var(--header-bg);
  padding: 50px 0;
}

.helpful-links h2 {
  text-align: center;
  margin-bottom: 30px;
  text-transform: uppercase;
}

.link-list {
  list-style: decimal;
  padding-left: 24px;
  max-width: 500px;
  margin: 0 auto;
}

.link-list li {
  margin-bottom: 20px;
  font-size: 16px;
}

.link-list img {
  width: 140px;
  margin-top: 8px;
  border-radius: 4px;
}

.plain-links {
  list-style: decimal;
  padding-left: 24px;
  max-width: 500px;
  margin: 0 auto;
}

.plain-links li {
  margin-bottom: 12px;
  font-size: 16px;
}

/* Footer */
.site-footer {
  background: var(--brand-green);
  color: #fff;
  padding: 50px 0 20px;
}

.site-footer .container {
  max-width: 1400px;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
}

.footer-title {
  font-family: var(--font-heading);
  font-size: 30px;
  color: #fff;
}

.footer-nav ul {
  list-style: none;
  display: flex;
  gap: 24px;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.footer-nav a {
  color: #fff;
  font-size: 14px;
  text-transform: uppercase;
  font-weight: 600;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  padding-top: 20px;
  font-size: 14px;
}

.cc-license {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cc-license img {
  flex-shrink: 0;
}

.donate-btn {
  display: inline-block;
  border: 2px solid #fff;
  padding: 10px 24px;
  border-radius: 3px;
  color: #fff;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 14px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.donate-btn:hover {
  background: #fff;
  color: var(--accent);
}

@media (max-width: 700px) {
  .site-header { padding: 16px 20px; }
  .hero-inner { padding: 30px 24px; }
  .hero-inner .eyebrow { font-size: 32px; }
  .hero-inner .subtitle { font-size: 18px; }
  .bio-grid,
  .contact-columns,
  .book-grid,
  .lecture-grid {
    grid-template-columns: 1fr;
  }
}
