/* -------------------- */
/* --- Custom Properties --- */
/* -------------------- */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --font-serif: "Iowan Old Style", "Apple Garamond", Baskerville, "Times New Roman", "Droid Serif", Times, "Source Serif Pro", serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  
  --color-text: #333;
  --color-bg: #fff;
  --color-accent: #007bff;
  --color-light-gray: #f0f0f0;

  --text-base-size: 1.125rem; /* 18px */
  --text-scale-ratio: 1.25;
  --line-height: 1.6;

  --container-width: 45rem; /* 720px */
  --spacing: 1.5rem;
}

/* -------------------- */
/* --- Modern Reset & Base --- */
/* -------------------- */

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

body {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--text-base-size);
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* -------------------- */
/* --- Layout --- */
/* -------------------- */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex-grow: 1;
}

.container {
  max-width: var(--container-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--spacing);
  padding-right: var(--spacing);
}

header, footer {
  padding: var(--spacing) 0;
}

footer {
  text-align: center;
  font-size: 0.9rem;
  color: #777;
}

/* -------------------- */
/* --- Typography --- */
/* -------------------- */

h1, h2, h3, h4, h5, h6 {
  margin: 3rem 0 1.38rem;
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.3;
}

h1 {
  margin-top: 0;
  font-size: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio));
}

h2 {
  font-size: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio));
}

h3 {
  font-size: calc(var(--text-base-size) * var(--text-scale-ratio));
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom 0.2s ease-in-out;
}

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

ul, ol {
  padding-left: 1.5rem;
}

/* -------------------- */
/* --- Other Elements --- */
/* -------------------- */

img, video {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

hr {
  border: none;
  border-top: 1px solid var(--color-light-gray);
  margin: 2rem 0;
}

blockquote {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 3px solid var(--color-accent);
  font-style: italic;
  color: #555;
}

pre, code {
  font-family: monospace, monospace;
  background-color: var(--color-light-gray);
  border-radius: 4px;
}

pre {
  padding: 1rem;
  overflow-x: auto;
}

code {
  padding: 0.2em 0.4em;
}