/* =====================================================================
   CSC457 HW3 | styles.css
   One external stylesheet linked from all four pages.
   Section numbers in the comments match the homework requirements.
   Pixels are only used for hairline borders and shadows; sizes and
   spacing use rem, em, vw and vh (requirement 7).
   ===================================================================== */

/* ---------- Design tokens: one place to change the colour scheme ---------- */
:root {
  --paper: #f7f4ec;        /* page background (cream) */
  --paper-deep: #ece7da;   /* footer and quote background */
  --card: #fcfaf4;         /* cards and form fields */
  --ink: #173a30;          /* main text and header (dark green) */
  --muted: #53665c;        /* secondary text */
  --line: #c6cdc0;         /* borders */
  --accent: #375643;       /* links and list markers */
  --nav-bg: #0f2a22;       /* navigation bar */
  --on-dark: #f7f4ec;      /* text on dark backgrounds */
  --sun: #f2c98a;          /* highlight colour on dark backgrounds */
  --highlight: #f6e3ae;    /* .highlight background */
  --focus: #9b450e;        /* keyboard focus outline and link hover */
  --serif: Georgia, "Times New Roman", Times, serif;
  --sans: "Trebuchet MS", "Segoe UI", Verdana, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; scroll-behavior: smooth; }

/* ---------- 3 + 6a. Body background and inheritance ----------
   Colour, font-family and line-height are set once here. Every element
   inherits them, so paragraphs, lists and links need no font rules. */
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--sans);               /* 4: preferred font + fallbacks */
  font-size: 1.0625rem;
  line-height: 1.7;
}

/* Shared content width so every section lines up (3: consistent width) */
.wrap { width: min(70rem, calc(100% - 3rem)); margin-inline: auto; }

/* ---------- 2. Element selectors ---------- */
h1, h2, h3, p, figure, blockquote { margin: 0; }

h1, h2 {
  font-family: var(--serif);
  font-weight: normal;
  line-height: 1.1;
  letter-spacing: -0.04em;
  /* 8: subtle text-shadow; low opacity so contrast is unaffected */
  text-shadow: 0.03em 0.03em 0 rgba(55, 86, 67, 0.15);
}
h1 { font-size: clamp(2.5rem, 8vw, 5.875rem); overflow-wrap: break-word; }
h2 { font-size: clamp(1.875rem, 4vw, 2.625rem); }
h1 em, h2 em { font-style: italic; color: var(--accent); }   /* 4: font-style */

h3 { font-size: 1.25rem; line-height: 1.4; margin-bottom: 0.75rem; }
h3 span { display: block; font-size: 0.9375rem; font-weight: normal; margin-top: 0.3rem; color: var(--muted); }

p { max-width: 44rem; }
p + p { margin-top: 1.125rem; }

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.3em;
}
a:hover { color: var(--focus); }

/* 4: list-style-type and list-style-position */
ul {
  list-style-type: square;
  list-style-position: outside;
  padding-left: 1.5rem;
  margin: 0.75rem 0 1.375rem;
}
ol {
  list-style-type: decimal-leading-zero;
  list-style-position: inside;
  padding-left: 0;
  margin: 0.75rem 0 0;
}
li + li { margin-top: 0.5rem; }
li::marker { color: var(--accent); font-weight: bold; }

dl {
  margin: 0;
  padding-left: 1.25rem;
  border-left: 0.1875rem solid var(--line);   /* 3: border */
}
dt {
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: bold;
  text-transform: capitalize;                 /* 4: text-transform */
}
dd { margin: 0.25rem 0 1.5rem; }
dd:last-child { margin-bottom: 0; }

/* 5. Navigation: background colour, padding, distinct colour scheme */
nav {
  display: flex;
  gap: 0.25rem;
  padding: 0.375rem;
  background-color: var(--nav-bg);
  border-radius: 0.5rem;
}

img { display: block; max-width: 100%; height: auto; }
blockquote { font-family: var(--serif); font-style: italic; font-size: clamp(1.5rem, 4vw, 2.375rem); line-height: 1.3; margin-bottom: 1.25rem; }
figcaption { font-size: 0.75rem; font-style: italic; text-align: center; margin-top: 0.625rem; }

/* ---------- 6b. Descendant selectors ---------- */
/* nav a (specificity 0,0,2): links inside the menu only */
nav a {
  display: inline-block;
  padding: 0.625rem 1rem;
  border-radius: 0.375rem;
  color: var(--on-dark);
  text-decoration: none;                     /* 5: no underline */
  text-transform: uppercase;                 /* 4: text-transform */
  letter-spacing: 0.08em;
  font-size: 0.8125rem;
  font-weight: bold;
}
nav a:hover { background-color: rgba(247, 244, 236, 0.14); color: var(--sun); }
/* nav a[aria-current] (0,1,2) is more specific than nav a, so it wins */
nav a[aria-current="page"] { background-color: var(--sun); color: var(--nav-bg); }

/* Only paragraphs in the main content get the wider reading rhythm */
main p { line-height: 1.75; }
ol li { padding: 0.75rem 1rem; background-color: var(--card); border-left: 0.1875rem solid var(--accent); }
ol li strong { color: var(--accent); }
.skip-link:focus-visible, .site-header a:focus-visible, nav a:focus-visible { outline-color: var(--sun); }

/* ---------- 3. Header: background colour + gradient image ---------- */
.site-header {
  background-color: var(--ink);
  background-image: linear-gradient(135deg, #173a30 0%, #24503f 100%);
  color: var(--on-dark);
  border-bottom: 0.25rem solid var(--sun);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  min-height: 6.5rem;                         /* 3: consistent header height */
  padding-block: 1.25rem;
}
.brand {
  color: var(--on-dark);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: bold;
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.brand:hover { color: var(--sun); }
.brand span {
  display: block;
  margin-top: 0.375rem;
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: normal;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sun);
}

/* ---------- 2. Class selectors (reusable) ---------- */
.highlight {
  background-color: var(--highlight);
  color: var(--ink);
  padding: 0 0.25em;
  border-radius: 0.2em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.eyebrow {
  font-size: 0.6875rem;
  font-weight: bold;
  letter-spacing: 0.16em;
  text-transform: uppercase;                  /* 4: text-transform */
  margin-bottom: 1.375rem;
  color: var(--muted);
}
.lead { font-size: clamp(1.1875rem, 2.2vw, 1.5rem); line-height: 1.6; max-width: 42rem; }
.meta, .note { color: var(--muted); font-size: 0.875rem; }
.meta { margin-bottom: 0.625rem; }
.email-link { text-transform: lowercase; }    /* 4: lowercase keeps the address consistent */
.text-link { display: inline-block; margin-top: 1.125rem; }

.button, button {
  display: inline-block;
  padding: 0.9em 1.5em;                       /* em: scales with the button text */
  background-color: var(--ink);
  color: var(--on-dark);
  border: 1px solid var(--ink);
  border-radius: 0.375rem;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: bold;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.button:hover, button:hover { background-color: var(--accent); color: var(--on-dark); }

.skip-link { position: absolute; left: 1rem; top: -8rem; z-index: 10; padding: 0.75rem 1.25rem; background-color: var(--ink); color: var(--on-dark); }
.skip-link:focus { top: 0.625rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 0.3rem; }

/* ---------- 2. ID selectors (unique elements) ---------- */
#intro {
  min-height: min(60vh, 40rem);              /* 7: vh unit, capped for very tall screens */
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 4rem 3.5rem;
}
#intro h1 { font-size: clamp(2.5rem, 10vw, 7rem); line-height: 0.97; overflow-wrap: break-word; }
#main:focus:not(:focus-visible) { outline: none; }
#resume-title { font-family: var(--serif); font-size: 1.625rem; margin-bottom: 1.5rem; }
#contact-form { padding: 1.5rem; background-color: var(--card); border: 1px solid var(--line); border-radius: 0.5rem; }
#form-status { font-size: 0.875rem; margin-top: 1.125rem; }

/* ---------- 3. Layout and spacing (box model) ---------- */
.hero-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-top: 2.25rem; }
.page-intro { padding-block: 4rem 3rem; }
.page-intro .lead { margin-top: 1.625rem; }

.split {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 4rem;
  min-height: 14rem;                          /* 3: consistent section height */
  padding-block: 3rem;
  border-top: 1px solid var(--line);
}
.split .eyebrow { margin-bottom: 1rem; }

/* Experience and leadership entries become cards */
.entries > section {
  padding: 1.5rem;
  background-color: var(--card);
  border: 1px solid var(--line);
  border-left: 0.3rem solid var(--accent);
  border-radius: 0.5rem;
}
.entries > section + section { margin-top: 1.25rem; }
.entries ul { margin-bottom: 0; }

.quote {
  margin-top: 1rem;
  padding: 2.5rem;
  text-align: center;                         /* 4: text-align */
  background-color: var(--paper-deep);
  border-block: 1px solid var(--line);
}
.quote p { margin-inline: auto; }
.closing { margin-block: 2.25rem; }

.project {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3.25rem;
  align-items: center;
  min-height: 22rem;                          /* 3: consistent project height */
  padding-block: 3rem;
  border-top: 1px solid var(--line);
}
.project h2 { margin-bottom: 1.25rem; }
.project img {
  width: 100%;
  aspect-ratio: 8 / 5;                        /* every figure has the same shape */
  padding: 0.5rem;
  background-color: #ffffff;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.contact-layout { display: grid; grid-template-columns: 1fr 1.2fr; gap: 5rem; padding-block: 3rem; border-top: 1px solid var(--line); }
.contact-layout h2 { font-size: 1.875rem; margin-bottom: 1.375rem; }
.contact-layout a { overflow-wrap: anywhere; }
.contact-layout .note { margin-top: 1.5rem; }
#contact-form .note { margin-top: 0; }

label { display: block; margin-top: 1.25rem; font-size: 0.875rem; font-weight: bold; }
input, textarea {
  display: block;
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.75rem;
  background-color: #ffffff;
  color: var(--ink);
  border: 1px solid #748477;
  border-radius: 0.25rem;
  font: inherit;
}
textarea { resize: vertical; }
form button { margin-top: 1.5rem; }

/* Footer: full-width band, inherits body font */
.site-footer { margin-top: 3rem; background-color: var(--paper-deep); border-top: 1px solid var(--line); font-size: 0.8125rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; padding-block: 1.6rem; }
.site-footer span { display: block; color: var(--muted); }
.site-footer a { font-weight: bold; }

/* ---------- 6c. Rule order experiment ----------
   .meta was already given color: var(--muted) above. This rule has the
   same specificity (0,1,0) but comes later, so it wins: dates show in the
   accent colour and bold. Delete this block and the earlier rule applies. */
.meta { color: var(--accent); font-weight: bold; }

/* Specificity check: #main .text-link (1,1,0) beats .text-link (0,1,0)
   no matter where it appears in the file. */
#main .text-link { font-weight: bold; }

/* ---------- 7. Responsive design ---------- */
@media (max-width: 47.5em) {                  /* about 760px */
  .wrap { width: calc(100% - 2rem); }
  .header-inner { flex-direction: column; align-items: stretch; gap: 1rem; }
  nav { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; }
  nav a { padding: 0.55rem 0.6rem; letter-spacing: 0.04em; font-size: 0.75rem; text-align: center; }
  #intro { min-height: auto; padding-block: 2.75rem; }
  .hero-bottom { flex-direction: column; align-items: flex-start; }
  .page-intro { padding-block: 2.75rem; }
  .split, .project, .contact-layout { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; min-height: 0; padding-block: 2rem; }
  .button, button { white-space: normal; }
  .project figure { order: 1; }
  .quote { padding: 1.75rem; }
  .entries > section { padding: 1.25rem; }
  .footer-inner { flex-direction: column; text-align: center; }   /* 4: text-align */
}

/* Very narrow phones: the menu becomes a tidy 2 x 2 grid instead of wrapping */
@media (max-width: 22.5em) {                  /* about 360px */
  nav { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

@media print {
  .skip-link, nav, .site-footer, .button { display: none; }
  body { background: #ffffff; color: #000000; font-size: 11pt; }
  .site-header { background: none; color: #000000; border-bottom: 1pt solid #000000; }
  .brand, .brand span { color: #000000; text-shadow: none; }
  .wrap { width: 100%; }
  h1, h2 { text-shadow: none; }
}
