/* ==========================================================================
   essay-body.css — Long-Form Essay Styling
   --------------------------------------------------------------------------
   Scope:
   - Intended for individual essay/article pages.
   - Handles typography, media, forms, and content links.
   - Navigation, header, footer, and layout live elsewhere.
   Notes:
   - Variables duplicated here by design for portability.
   - Avoid adding component/layout rules to this file.
   ========================================================================== */


/*------------------------------------*\
  DESIGN TOKENS (LOCAL FALLBACKS)
  - Mirrors global tokens to keep essays portable.
\*------------------------------------*/
:root {
  /* Typography */
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", "Liberation Sans", "DejaVu Sans", sans-serif;
  --font-serif: Georgia, "Times New Roman", "Liberation Serif", "DejaVu Serif",
    serif;
  --font-mono: "Courier New", "Liberation Mono", "DejaVu Mono", monospace;

  /* Base colors + layout */
  --text-color: #222;
  --background-color: #fff;
  --line-height: 1.6;
  --max-width: 800px;

  /* Brand accent */
  /* --accent-color: #4a4ad4; */ /* indigo (archived) */
  --accent-color: #4A4A4A;       /* neutral editorial grey */
}


/*------------------------------------*\
  BASE RESET (SCOPED)
  - Light reset to ensure predictable rendering.
  - Full reset lives in reset.css.
\*------------------------------------*/
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Prevent horizontal overflow from full-bleed sections */
html {
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line-height);
  color: var(--text-color);
  background-color: var(--background-color);

  /* NOTE:
     max-width is also applied via .page-container elsewhere.
     Left intact for backward compatibility with older essays. */
  max-width: var(--max-width);
  margin: auto;
}


/*------------------------------------*\
  NAVIGATION (LEGACY SUPPORT)
  - Applies to semantic <nav> only.
  - If additional navs are introduced, scope via class.
\*------------------------------------*/
nav {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
}

nav[aria-label="breadcrumb"] ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

nav a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
}


/*------------------------------------*\
  TYPOGRAPHY
  - Serif for headings, system UI for body.
  - Consistent vertical rhythm for reading comfort.
\*------------------------------------*/
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  color: #111;
}

h2 {
  font-size: 2rem;
  color: #222;
}

h3 {
  font-size: 1.5rem;
  color: #333;
}

p {
  margin-bottom: 1.2rem;
}

a {
  color: var(--accent-color);
  text-decoration: none;
}

a:hover {
  color: #111;
}

blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 4px solid #ccc;
  font-style: italic;
  color: #444;
}


/*------------------------------------*\
  CODE BLOCKS
\*------------------------------------*/
code {
  font-family: var(--font-mono);
  background: #f4f4f4;
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

pre {
  font-family: var(--font-mono);
  background: #f4f4f4;
  padding: 1em;
  overflow-x: auto;
  border-radius: 5px;
  margin-bottom: 1.5rem;
}


/*------------------------------------*\
  MEDIA & FIGURES
\*------------------------------------*/
figure {
  margin: 2rem 0;
  text-align: center;
}

img {
  max-width: 100%;
  height: auto;
}

figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #444;
}

video {
  max-width: 100%;
  margin: 2rem 0;
}


/*------------------------------------*\
  TABLES
\*------------------------------------*/
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

th,
td {
  border: 1px solid #ddd;
  padding: 0.75rem;
  text-align: left;
}

th {
  background: #f9f9f9;
}


/*------------------------------------*\
  DETAILS / DISCLOSURES
\*------------------------------------*/
details {
  margin-bottom: 1rem;
  padding: 1rem 0;
}


/*------------------------------------*\
  FORMS (INLINE / EMBEDDED)
\*------------------------------------*/
form {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ccc;
}

input,
textarea {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;

  font-family: var(--font-body);
  font-size: 1rem;
}


/*------------------------------------*\
  BUTTONS (BASE)
  - Component buttons may override these.
  - Kept for backward compatibility.
\*------------------------------------*/
button {
  background: var(--accent-color);
  color: #fff;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

button:hover {
  background: #004999;
}


/*------------------------------------*\
  ESSAY BODY LINKS
  - Scoped to .essay-content to avoid nav/footer bleed.
  - Editorial underline with subtle hover feedback.
\*------------------------------------*/
.essay-content a {
  color: var(--accent-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(74, 74, 212, 0.35);
  border-radius: 4px;
  padding: 0 0.15em;

  transition:
    color 0.18s ease,
    text-decoration-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.essay-content a:hover,
.essay-content a:focus-visible {
  color: #111;
  background-color: rgba(0, 0, 0, 0.06);
  box-shadow: inset 0 -0.03em 0 rgba(0, 0, 0, 0.06);
  outline: none;
}

.essay-content a:focus-visible {
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.05),
    inset 0 -0.03em 0 rgba(0, 0, 0, 0.06);
}
