:root {
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --text: #1a1a1a;
  --text-muted: #555;
  --border: #d1d1d1;
  --input-bg: #ffffff;
  --ruby: #e0115f;
  --ruby-hover: #b00d4a;
  --ruby-pink: #ff4d8d;
  --font-size-base: clamp(1.125rem, 0.25vw + 1rem, 1.25rem);
  --font-size-h1: clamp(2.5rem, 5vw + 1rem, 3.8rem);
  --font-size-h2: clamp(2rem, 3vw + 1rem, 2.8rem);
  --font-size-h3: clamp(1.5rem, 2vw + 1rem, 2rem);
  --radius: 0.75rem;
  --spacing: 0.8rem;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  --success-color: #2e7d32;
  --error-color: #d32f2f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --bg-secondary: #1a1a1a;
    --text: #f0f0f0;
    --text-muted: #a0a0a0;
    --border: #333;
    --input-bg: #1e1e1e;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 7.5rem;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  line-height: 1.75;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  background-color: var(--bg);
  color: var(--text);
  font-size: var(--font-size-base);
}

main {
  max-width: 850px;
  margin: 0 auto;
  padding: 2rem;
}

p {
  font-size: var(--font-size-base);
  color: var(--text);
  line-height: 1.75
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  line-height: 1.2;
  margin: 2.5rem 0 1rem;
  font-weight: 800;
}

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

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

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

a {
  text-decoration: none;
  font-size: inherit;
  color: var(--ruby);
  box-shadow: inset 0 -0.3em 0 0 transparent;
  transition: all 0.25s ease;
}

a:hover {
  color: var(--ruby);
  box-shadow: inset 0 -0.5em 0 0 rgba(224, 17, 95, 0.2);
}

body>header {
  background-color: var(--bg-secondary);
  background-image: radial-gradient(circle at center,
      rgba(224, 17, 95, 0.08) 0%,
      transparent 70%);
  backdrop-filter: blur(10px);
  padding: clamp(2rem, 6vw, 4rem) 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

body>header h1 {
  margin: 0;
  line-height: 1.1;
}

body>header p {
  font-size: 1.4rem;
  color: var(--text-muted);
  max-width: 700px;
  margin: 1rem auto 2rem auto;
  line-height: 1.4;
}

header>nav ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  gap: clamp(0.5rem, 2vw + 1rem, 2rem);
  min-width: 0;
}

header>nav a {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1rem;
  font-size: 0.85rem;
  color: var(--text);
  padding: 0 0.2rem;
}

blockquote {
  margin: 3rem 0;
  padding: 1rem 2rem;
  border-left: 5px solid var(--ruby);
  background: var(--bg-secondary);
  font-size: 1.2rem;
}

pre,
code {
  font-family: "Cascadia Code", "Fira Code", monospace;
  font-weight: 500;
  color: var(--ruby-pink);
  background: var(--bg-secondary);
  border-radius: 6px;
}

code {
  padding: 0.2rem 0.4rem;
}

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

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4rem 0;
}

section>hr {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 4rem auto;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 3rem 0;
}

table th {
  text-align: left;
  padding: 1rem;
  box-shadow: inset 0 -6px 0 0 rgba(224, 17, 95, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  font-size: 0.85rem;
}

table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

table tr:hover td {
  background-color: var(--bg-secondary);
  color: var(--text);
}

section div:has(> article) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

section>div>article {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}

section>div>article h3 {
  margin-top: 0;
  font-size: 1.3rem;
}

section>div>article time {
  font-size: calc(var(--font-size-base) * 0.8);
  color: var(--text-muted);
}

main>article>header p {
  font-size: 1.4rem;
  color: var(--text-muted);
  max-width: 700px;
  margin: 1.5rem 0;
  line-height: 1.4;
}

main>div>article>time,
main>article>header>time {
  font-size: calc(var(--font-size-base) * 0.9);
  font-weight: 600;
  color: var(--text-muted);
}

/* Accessibility: High visibility focus */
*:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

/* Global Form Styling */
form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Grouping related items */
fieldset {
  background-color: var(--bg-secondary);
  border: 0;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

legend {
  font-weight: bold;
  padding: 0 0.5rem;
  color: var(--ruby);
}

/* Labels and Breathing Space */
label {
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  font-size: 0.85rem;
  display: block;
  font-weight: 700;
  margin: 0.4rem 0;
}

/* Inputs (Text, Email, Password, Number, Tel, etc.) */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: var(--spacing);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--input-bg);
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 1rem;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  box-sizing: border-box;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #bbb;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid var(--ruby-pink);
  outline-offset: 1px;
  border-color: transparent;
  /* Prevent the border and outline from clashing */
}

/* Specialized Inputs */
input[type="range"] {
  width: 100%;
  accent-color: var(--ruby);
  cursor: pointer;
  margin-bottom: 1rem;
}

input[type="color"] {
  height: 40px;
  width: 60px;
  padding: 2px;
  cursor: pointer;
  margin-bottom: 1rem;
}

/* Checkboxes & Radios */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--ruby);
  transform: scale(1.1);
  margin-right: 0.5rem;
  cursor: pointer;
  margin-bottom: 1rem;
}

/* Buttons */
button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  background-color: var(--ruby);
  color: white;
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-weight: bold;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s;
  box-shadow: var(--shadow);
}

button:hover,
input[type="submit"]:hover {
  background-color: var(--ruby-hover);
}

button:active {
  transform: translateY(1px);
}

/* Only apply padding and icons to fields with requirements */
input:is([required],
  [pattern],
  [minlength],
  [maxlength],
  [type="email"],
  [type="url"]),
textarea:is([required], [minlength], [maxlength]) {
  padding-right: 2.5rem;
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 1.1rem;
}

/* VALID: Only if required/constrained AND not empty */
input:is([required],
  [pattern],
  [minlength],
  [maxlength],
  [type="email"],
  [type="url"]):not(:placeholder-shown):valid,
textarea:is([required], [minlength]):not(:placeholder-shown):valid {
  border: 2px solid var(--success-color);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232e7d32' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
}

/* INVALID: Only if required/constrained AND not empty */
input:is([required],
  [pattern],
  [minlength],
  [maxlength],
  [type="email"],
  [type="url"]):not(:placeholder-shown):invalid,
textarea:is([required], [minlength]):not(:placeholder-shown):invalid {
  border: 2px solid var(--error-color);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d32f2f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");
}

/* 4. Show the error message only for these specific fields */
input:invalid:not(:placeholder-shown)+small,
textarea:invalid:not(:placeholder-shown)+small {
  /* margin-top: -0.8rem; */
  display: block;
  color: var(--error-color);
}

/* General spacing for helper text small tags */
fieldset>small {
  display: none;
  margin-bottom: 1rem;
}

/* Target the Search Input specifically */
input[type="search"] {
  border-radius: 50px;
  padding-left: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.8rem center;
  background-size: 1.1rem;
}

/* Clear button (the 'X' in search fields) styling for Webkit browsers */
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 1em;
  width: 1em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E") no-repeat center;
  cursor: pointer;
  margin-right: 0.5rem;
}

/* Style for a search-specific form layout */
form[role="search"] {
  display: flex;
  flex-direction: row;
  /* Horizontal layout for search */
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
}

form[role="search"] input[type="search"] {
  margin: 0;
  flex-grow: 1;
}

form[role="search"] button {
  border-radius: 50px;
  padding: 0.8rem 1.5rem;
}

body>footer {
  text-align: center;
  margin-top: 5rem;
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

body>footer p {
  font-size: calc(var(--font-size-base) * 0.9);
  color: var(--text-muted);
}

@media print {
  body {
    font-size: 12pt;
    background: white;
    color: black;
  }

  nav,
  button,
  form {
    display: none !important;
  }

  header {
    background: transparent !important;
    border-bottom: 2px solid black;
    text-align: left;
  }

  article {
    border: none;
    border-left: 2px solid #e0115f;
    page-break-inside: avoid;
  }
}

img {
  border-radius: var(--radius);
}

/* */