/* --- CSS reset rules start --- */

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
	display: block;
}

body {
	line-height: 1;
}

ol, ul {
	list-style: none;
}

blockquote, q {
	quotes: none;
}

blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}

table {
	border-collapse: collapse;
	border-spacing: 0;
}

/* Box sizing rules */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Prevent font size inflation */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

/* Remove default margin in favour of better control in authored CSS */
body, h1, h2, h3, h4, p,
figure, blockquote, dl, dd {
  margin-block-end: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role='list'],
ol[role='list'] {
  list-style: none;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  line-height: 1.5;
}

/* Set shorter line heights on headings and interactive elements */
h1, h2, h3, h4,
button, input, label {
  line-height: 1.1;
}

/* Balance text wrapping on headings */
h1, h2,
h3, h4 {
  text-wrap: balance;
}

/* Anchor elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
  color: currentColor;
}

/* Make images easier to work with */
img,
picture {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input, button,
textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
  min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: 5ex;
}

/* --- CSS reset rules end --- */

/* =============================================
   SITE STYLES
   ============================================= */

/* --- Tokens --- */

:root {
  --color-bg:         #fafaf8;
  --color-text:       #1a1a1a;
  --color-muted:      #666;
  --color-accent:     #4a6fa5;
  --color-border:     #ddd;
  --color-surface:    #fff;

  --font-body:   system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: Georgia, "Times New Roman", serif;

  --size-xs:  0.75rem;
  --size-sm:  0.875rem;
  --size-md:  1rem;
  --size-lg:  1.25rem;
  --size-xl:  1.5rem;
  --size-2xl: 2rem;
  --size-3xl: 2.75rem;

  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2.5rem;
  --space-2xl: 4rem;

  --radius: 4px;
  --max-width: 800px;
}

/* --- Base --- */

body {
  font-family: var(--font-body);
  font-size: var(--size-md);
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
}

/* --- Layout --- */

header,
main,
footer {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

section {
  margin-block: var(--space-2xl);
}

/* --- Typography --- */

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--color-text);
}

h1 { font-size: var(--size-3xl); margin-block-end: var(--space-xs); }
h2 { font-size: var(--size-2xl); margin-block-end: var(--space-lg); border-bottom: 1px solid var(--color-border); padding-block-end: var(--space-sm); }
h3 { font-size: var(--size-xl);  margin-block: var(--space-lg) var(--space-sm); }

p {
  margin-block-end: var(--space-md);
  max-width: 65ch;
}

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

a:hover {
  text-decoration: none;
}

strong { font-weight: 700; }
em     { font-style: italic; }
cite   { font-style: italic; color: var(--color-muted); }

blockquote {
  border-left: 3px solid var(--color-accent);
  padding-inline-start: var(--space-lg);
  margin-block: var(--space-lg);
  color: var(--color-muted);
  font-style: italic;
}

/* --- Header & Nav --- */

header {
  padding-block: var(--space-xl);
  text-align: center;
}

header p {
  color: var(--color-muted);
  font-size: var(--size-lg);
  max-width: none;
  margin-block-end: 0;
}

nav {
  margin-block-end: var(--space-lg);
  display: flex;
  gap: var(--space-lg);
  justify-content: center;
}

nav a {
  font-size: var(--size-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  text-decoration: none;
}

nav a:hover {
  color: var(--color-accent);
}

/* --- Images --- */

img {
  border-radius: var(--radius);
  height: auto;

  &.img-sm {
    max-width: 15rem;
  }

  &.img-md {
    max-width: 25rem;
  }
}

/* --- Figures --- */

figure {
  margin-block: var(--space-lg);
}

figcaption {
  margin-block-start: var(--space-sm);
  font-size: var(--size-sm);
  color: var(--color-muted);
}

/* --- Lists --- */

ul, ol {
  padding-inline-start: var(--space-lg);
  margin-block-end: var(--space-md);
}

ul { list-style: disc; }
ol { list-style: decimal; }

li {
  margin-block-end: var(--space-xs);
}

/* --- Table --- */

table {
  width: 100%;
  margin-block: var(--space-lg);
  font-size: var(--size-sm);
}

th, td {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: 700;
  background-color: var(--color-surface);
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--size-xs);
}

/* --- Details / Summary --- */

details {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-block-end: var(--space-sm);
  background-color: var(--color-surface);
}

summary {
  padding: var(--space-md);
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

summary::-webkit-details-marker { display: none; }

summary::before {
  content: "+ ";
  color: var(--color-accent);
}

details[open] summary::before {
  content: "− ";
}

details p {
  padding: 0 var(--space-md) var(--space-md);
  color: var(--color-muted);
  margin-block-end: 0;
}

/* --- Form --- */

form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 480px;
  margin-block-start: var(--space-lg);
}

label {
  font-size: var(--size-sm);
  font-weight: 700;
  display: block;
  margin-block-end: var(--space-xs);
}

input,
select,
textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background-color: var(--color-surface);
  color: var(--color-text);
  font-size: var(--size-md);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
  border-color: var(--color-accent);
}

button {
  align-self: flex-start;
  padding: var(--space-sm) var(--space-xl);
  background-color: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: var(--size-md);
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  opacity: 0.85;
}

/* --- Footer --- */

footer {
  margin-block: var(--space-2xl);
  padding-block: var(--space-lg);
  border-top: 1px solid var(--color-border);
  font-size: var(--size-sm);
  color: var(--color-muted);
  text-align: center;
}

footer address {
  font-style: normal;
  margin-block-start: var(--space-xs);
}

