/* Site-wide base styles - loaded on every page */

/* Ubuntu Font - Self-hosted */
@font-face {
  font-family: 'Ubuntu';
  src: url('/fonts/Ubuntu-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Ubuntu';
  src: url('/fonts/Ubuntu-Italic.woff2') format('woff2');
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Ubuntu';
  src: url('/fonts/Ubuntu-Bold.woff2') format('woff2');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Ubuntu';
  src: url('/fonts/Ubuntu-BoldItalic.woff2') format('woff2');
  font-weight: bold;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Ubuntu Mono';
  src: url('/fonts/UbuntuMono-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Ubuntu Mono';
  src: url('/fonts/UbuntuMono-Italic.woff2') format('woff2');
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Ubuntu Mono';
  src: url('/fonts/UbuntuMono-Bold.woff2') format('woff2');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

/* CSS Custom Properties - Design Tokens */
:root {
  /* Literal Colors - explicit values that don't change with themes */
  --black: #000;
  --white: #fff;
  --red: #e22c3b;
  --red-dark: #c91f2e;
  --red-30: rgba(226, 44, 59, 0.3);
  --orange: #f2833b;
  --orange-10: rgba(242, 131, 59, 0.1);
  --green: #00ff88;
  --green-10: rgba(0, 255, 136, 0.1);
  --light-grey: #B3B3B3;
  --dark-grey: #808080;
  --white-03: rgba(255, 255, 255, 0.03);
  --white-10: rgba(255, 255, 255, 0.1);
  --white-30: rgba(255, 255, 255, 0.3);

  /* Semantic Colors - DARK MODE (default) */
  --bg: var(--black);
  --bg-2: var(--white-03);
  --text: var(--white);
  --text-2: var(--light-grey);
  --text-3: var(--dark-grey);
  --accent: var(--red);
  --accent-hover: var(--red-dark);
  --success: var(--green);
  --border: var(--white-10);

  /* Typography */
  --ubuntu: 'Ubuntu', Ubuntu, system-ui, -apple-system, sans-serif;
  --mono: 'Ubuntu Mono', 'Ubuntu Mono', ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;

  --h1: 3.5rem;
  --h2: 2rem;
  --h3: 1.5rem;
  --h4: 1.25rem;
  --small: .9rem;
  --medium: 1.325rem;
  --body: 1rem;
  --small: 0.9375rem;

  --bold: bold;

  --tight: 1.1;
  --relaxed: 1.7;

  /* Spacing */
  --xs: 0.5rem;
  --sm: 1rem;
  --md: 1.5rem;
  --lg: 2rem;
  --xl: 3rem;
  --2xl: 4rem;

  /* Container widths */
  --narrow: 700px;
  --page: 965px;
  --wide: 1200px;

  /* Transitions */
  --fast: 0.2s;
  --normal: 0.3s;

  /* Border radius */
  --radius: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Prevent long words from causing horizontal scroll */
body {
  overflow-wrap: anywhere;
  /* TODO: Evaluate if break-word + min-width: 0 on grid children would be better
     anywhere breaks more aggressively but avoids grid min-width conflicts */
}

/* Button Styles */
.button {
  display: inline-block;
  padding: var(--sm) 2.5rem;
  font-size: var(--body);
  font-weight: var(--bold);
  text-decoration: none;
  transition: all var(--normal);
  cursor: pointer;
  border: none;
}

.button:hover {
  text-decoration: none;
}

.button.primary {
  background: var(--accent);
  color: var(--text);
}

.button.primary:hover {
  background: var(--accent-hover);
}

.button.secondary {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--accent);
  padding: calc(var(--sm) - 2px) calc(2.5rem - 2px);
}

.button.secondary:hover {
  background: var(--accent);
  color: var(--text);
}

.button.tertiary {
  background: transparent;
  color: var(--text-2);
  border: 2px solid var(--text-2);
  padding: calc(var(--sm) - 2px) calc(2.5rem - 2px);
}

.button.tertiary:hover {
  border-color: var(--text);
  color: var(--text);
}

/* Form Elements - Base Styles */
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
select,
textarea {
  background: transparent;
  border: 1px solid var(--white-30);
  padding: var(--sm);
  color: var(--text);
  font-family: var(--ubuntu);
  font-size: 1rem;
  transition: border-color var(--fast);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-3);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 150px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sm) center;
  padding-right: 2.5rem;
}

select option {
  background: var(--black);
  color: var(--text);
}

/* Global Typography */
a {
  color: var(--accent);
  text-decoration: none;
  font-weight: var(--bold);
  transition: color var(--fast);
}

a:hover {
  text-decoration: underline;
}

/* External link indicator - arrow for offsite links */
a[target="_blank"][href^="http"]::after {
  content: "↗";
  font-size: 0.75em;
  position: relative;
  top: -0.4rem;
  left: 0.1rem;
  text-decoration: none;
  display: inline-block;
}

h1,
h2,
h3,
h4 {
  line-height: var(--tight);
  font-weight: var(--bold);
  color: var(--text);
  margin-top: var(--lg);
  margin-bottom: var(--sm);
}

h1 {
  font-size: var(--h1);
}

h2 {
  font-size: var(--h2);
}

h3 {
  font-size: var(--h3);
}

h4 {
  font-size: var(--h4);
}

p,
ul,
ol {
  color: var(--text-2);
  margin-bottom: var(--sm);
}

ul,
ol {
  padding-left: var(--lg);
}

p.medium, p.med {font-size: var(--medium)}
p.small {font-size: var(--small)}

li {
  color: var(--text-2);
}

strong {
  font-weight: var(--bold);
  color: var(--text);
}

em {
  font-style: italic;
}

/* Responsive Typography - Global heading sizes */
@media (max-width: 768px) {
  h1 { font-size: 3rem; }
  h2 { font-size: 1.875rem; }
  h3 { font-size: 1.375rem; }
  h4 { font-size: 1.125rem; }
}

@media (max-width: 480px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: var(--h4); }
  h4 { font-size: 1.125rem; }
}

@media (max-width: 320px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: var(--h3); }
  h3 { font-size: var(--h4); }
  h4 { font-size: 1.125rem; }
}
