/* Fundamentals of Electric DC Circuits — web edition */
:root {
  --accent: #0b5394;
  --accent-dark: #073763;
  --bg: #ffffff;
  --text: #1f2933;
  --muted: #5b6770;
  --border: #d9e2ec;
  --code-bg: #f4f6f8;
  --maxw: 880px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

/* ---------- Copy deterrents ---------- */
/* Disable text selection across the document (JS reinforces this). */
body {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none; /* iOS long-press */
}
/* Keep selection working in form fields for usability. */
input, textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}
/* Disable image dragging (JS also blocks dragstart). */
img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  pointer-events: none; /* blocks long-press save on mobile; JS restores left-click nav via wrapping links */
}
/* (Watermark hook reserved for future use — currently unused.) */
.watermark { display: none; }

/* ---------- Navigation bar ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--accent-dark);
  color: #fff;
  border-bottom: 3px solid var(--accent);
}
.site-nav .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.site-nav .brand {
  font-weight: 700;
  font-family: "Helvetica Neue", Arial, sans-serif;
  margin-right: 0.8rem;
  white-space: nowrap;
}
.site-nav a {
  color: #cfe2ff;
  text-decoration: none;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}
.site-nav a:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ---------- Layout ---------- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

h1, h2, h3, h4 {
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: var(--accent-dark);
  line-height: 1.3;
}
h1 { font-size: 1.9rem; border-bottom: 2px solid var(--border); padding-bottom: 0.4rem; margin-top: 1.5rem; }
h2 { font-size: 1.45rem; margin-top: 2.2rem; border-left: 5px solid var(--accent); padding-left: 0.6rem; }
h3 { font-size: 1.2rem; margin-top: 1.6rem; }

p { margin: 1rem 0; }
a { color: var(--accent); }

img { max-width: 100%; height: auto; display: block; margin: 1.2rem auto; border: 1px solid var(--border); border-radius: 4px; }

/* Cover image on home page */
.cover { max-width: 420px; margin: 1.5rem auto; border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(0,0,0,0.18); }

/* ---------- Code blocks (ASCII figures) ---------- */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.35;
}
pre code {
  font-family: "Consolas", "Menlo", "Courier New", monospace;
  color: #102a43;
}
code { font-family: "Consolas", "Menlo", "Courier New", monospace; }
p > code, li > code { background: var(--code-bg); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.9em; }

/* ---------- Tables ---------- */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.2rem 0;
  font-size: 0.92rem;
}
th, td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.7rem;
  text-align: left;
}
th { background: var(--code-bg); font-family: "Helvetica Neue", Arial, sans-serif; }

/* ---------- Math ---------- */
.MathJax { font-size: 1.02em !important; }

/* ---------- Blockquotes / callouts ---------- */
blockquote {
  margin: 1rem 0;
  padding: 0.6rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--code-bg);
  color: var(--muted);
}

/* ---------- Home page ---------- */
.home-hero { text-align: center; padding: 1rem 0 2rem; }
.home-hero h1 { border: none; }
.home-hero .author { font-size: 1.15rem; color: var(--muted); }
.home-hero .publisher { font-size: 0.95rem; color: var(--muted); margin-top: 0.3rem; }
.toc-list { list-style: none; padding: 0; max-width: 620px; margin: 2rem auto; }
.toc-list li { margin: 0.5rem 0; }
.toc-list a {
  display: block;
  padding: 0.7rem 1rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--accent-dark);
  font-family: "Helvetica Neue", Arial, sans-serif;
}
.toc-list a:hover { background: #eaf1fb; border-color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 2px solid var(--border);
  margin-top: 3rem;
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Print: deter printing ---------- */
@media print {
  .site-nav, .site-footer { display: none !important; }
  /* Hide all real content when printing; a JS beforeprint handler also
     swaps in a copyright notice. This is belt-and-suspenders. */
  main { display: none !important; }
  body::after {
    content: "Printing is disabled. \00a9 IRays Teknology Ltd. All rights reserved.";
    display: block;
    text-align: center;
    padding: 4rem 1rem;
    font-family: "Helvetica Neue", Arial, sans-serif;
    color: #333;
  }
}
/* Screen-only normal layout (the print rule above only fires on print). */
@media screen {
  main { display: block; }
}
