/* sc.css - Simple Clean CSS */

:root {
  --font-sans: system-ui, sans-serif;
  --font-mono: ui-monospace, monospace;
  --text: #1a1a1a;
  --text-heading: #111;
  --text-muted: #374151;
  --text-light: #6b7280;
  --bg: #fff;
  --bg-soft: #f9fafb;
  --bg-muted: #f3f4f6;
  --bg-accent: #e5e7eb;
  --border: #d1d5db;
  --border-w: 0.0625rem;
  --mark: #fff3a0;
  --link: #2563eb;
  --link-hover: #1d4ed8;
  --link-visited: #7c3aed;
  --focus-ring: rgba(37, 99, 235, 0.15);
  --btn-active: #bfc4cc;
  --btn-text-on: #fff;
  --submit-active: #1e40af;
  --danger: #ea580c;
  --danger-hover: #c2410c;
  --danger-active: #9a3412;
  --radius-xs: 0.1875rem;
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-pill: 62.4375rem;
}

/* ---- Base / Reset ---- */

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

html {
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
}

body {
  margin: 0;
  padding: 0;
  max-width: 44rem;
  margin-inline: auto;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

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

h1, h2, h3, h4, h5, h6 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.25;
  color: var(--text-heading);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
  margin: 0 0 1rem;
}

small {
  font-size: 0.875rem;
}

mark {
  background: var(--mark);
  padding: 0.1rem 0.25rem;
  border-radius: 0.125rem;
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

sub, sup {
  font-size: 0.75rem;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sup { top: -0.5rem; }
sub { bottom: -0.25rem; }

/* ---- Links ---- */

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.125rem;
}

a:hover {
  color: var(--link-hover);
}

a:visited {
  color: var(--link-visited);
}

/* ---- Navigation ---- */

nav {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--bg-soft);
  border-bottom: var(--border-w) solid var(--border);
  margin-bottom: 1.5rem;
}

nav p {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 0;
  margin-bottom: 0;
}

nav p + p {
  margin-top: 0.25rem;
}

nav a {
  text-decoration: none;
  white-space: nowrap;
}

nav a + a::before {
  content: "\00b7";
  padding: 0 0.375rem;
  color: var(--text-light);
}

nav a:hover {
  text-decoration: underline;
}

/* ---- Lists ---- */

ul, ol {
  padding-left: 1.125rem;
  margin-top: 0;
}

li {
  margin-bottom: 0.25rem;
}

dl {
  margin: 0 0 1rem;
}

dt {
  font-weight: 700;
  margin-top: 0.5rem;
}

dd {
  margin-left: 1.5rem;
  margin-bottom: 0.25rem;
}

/* ---- Blockquote ---- */

blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 0.25rem solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* ---- Code ---- */

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

code {
  background: var(--bg-muted);
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-xs);
}

pre {
  margin: 1rem 0;
  padding: 1rem;
  overflow: auto;
  max-height: 15.125rem;
  background: var(--bg-muted);
  border: var(--border-w) solid var(--border);
  color: var(--text);
  border-radius: var(--radius-md);
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
  font-size: 0.875rem;
}

kbd {
  background: var(--bg-muted);
  border: var(--border-w) solid var(--border);
  border-bottom-width: 0.125rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
}

/* ---- Horizontal Rule ---- */

hr {
  border: none;
  border-top: var(--border-w) solid var(--border);
  margin: 2rem 0;
}

/* ---- Images & Media ---- */

img, video {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
}

figure {
  margin: 1.5rem 0;
}

figcaption {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

/* ---- Tables ---- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
  border: var(--border-w) solid var(--bg-accent);
}

thead {
  border-bottom: 0.125rem solid var(--border);
  background: var(--bg-accent);
}

th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-weight: 700;
  color: var(--text-heading);
  border: var(--border-w) solid var(--border);
}

td {
  padding: 0.6rem 0.75rem;
  border: var(--border-w) solid var(--bg-accent);
}

tr:nth-child(even) {
  background: var(--bg-muted);
}

/* ---- Forms ---- */

fieldset {
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

legend {
  font-weight: 700;
  padding: 0 0.25rem;
}

label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

input, textarea, select {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 0.65rem;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  width: 100%;
  max-width: 100%;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 var(--radius-xs) var(--focus-ring);
}

input[type="color"] {
  width: 3rem;
  height: 1.854rem;
  padding: 0.2rem;
  cursor: pointer;
}

input[type="checkbox"], input[type="radio"] {
  width: auto;
  margin-right: 0.4rem;
  vertical-align: middle;
}

textarea {
  resize: vertical;
  min-height: 5rem;
}

/* ---- Inline Forms (fieldset > div grid) ---- */

fieldset > div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  align-items: center;
}

fieldset > div > label {
  text-align: right;
  margin-bottom: 0;
  white-space: nowrap;
}

fieldset > div > input,
fieldset > div > textarea,
fieldset > div > select {
  margin-bottom: 0;
}

fieldset > div > span {
  grid-column: 2;
}

/* ---- Buttons ---- */

button, input[type="submit"], input[type="reset"], input[type="button"] {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border: var(--border-w) solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg-accent);
  color: var(--text);
  cursor: pointer;
  display: inline-block;
  width: auto;
  transition: background 0.15s ease;
}

button:hover:not(:disabled):not([role="link"]), input[type="button"]:hover:not(:disabled) {
  background: var(--border);
}

button:active:not(:disabled):not([role="link"]), input[type="button"]:active:not(:disabled) {
  background: var(--btn-active);
}

button[type="submit"], input[type="submit"] {
  background: var(--link);
  color: var(--btn-text-on);
}

button[type="submit"]:hover:not(:disabled), input[type="submit"]:hover:not(:disabled) {
  background: var(--link-hover);
}

button[type="submit"]:active:not(:disabled), input[type="submit"]:active:not(:disabled) {
  background: var(--submit-active);
}

button[type="reset"], input[type="reset"] {
  background: var(--danger);
  color: var(--btn-text-on);
}

button[type="reset"]:hover:not(:disabled), input[type="reset"]:hover:not(:disabled) {
  background: var(--danger-hover);
}

button[type="reset"]:active:not(:disabled), input[type="reset"]:active:not(:disabled) {
  background: var(--danger-active);
}

button:disabled, input[type="submit"]:disabled, input[type="reset"]:disabled, input[type="button"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Link Buttons ---- */

button[role="link"] {
  background: none;
  border: none;
  padding: 0;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.125rem;
  font-weight: inherit;
  cursor: pointer;
}

button[role="link"]:hover:not(:disabled) {
  color: var(--link-hover);
}

button[role="link"]:active:not(:disabled) {
  color: var(--submit-active);
}

button[role="link"]:disabled {
  color: var(--text-light);
  cursor: not-allowed;
}

button[type="reset"][role="link"] {
  background: none;
  color: var(--danger);
}

button[type="reset"][role="link"]:hover:not(:disabled) {
  background: none;
  color: var(--danger-hover);
}

button[type="reset"][role="link"]:active:not(:disabled) {
  background: none;
  color: var(--danger-active);
}

/* ---- Menu Details ---- */

details[role="menu"] {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  display: inline-block;
  position: relative;
}

details[role="menu"] > summary + div {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  display: grid;
  gap: 0.25rem;
  justify-items: start;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
  z-index: 10;
}

details[role="menu"] hr {
  width: 100%;
  margin: 0.25rem 0;
}

details[role="menu"] > summary {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.125rem;
  font-weight: inherit;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

details[role="menu"] > summary > svg {
  display: block;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

details[role="menu"] > summary::marker,
details[role="menu"] > summary::-webkit-details-marker {
  display: none;
  content: "";
}

details[role="menu"] > summary:hover {
  color: var(--link-hover);
}


/* ---- Icon Buttons ---- */

button > svg,
button > span > svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button:has(> svg:only-child),
button:has(> span:only-child > svg:only-child) {
  padding: 0.5rem;
  line-height: 1;
}

button > span:only-child:has(> svg:only-child) {
  display: contents;
}

button:has(> span:only-child > svg:only-child) {
  background: var(--bg);
  border: var(--border-w) solid var(--border);
}

button:has(> span:only-child > svg:only-child):hover:not(:disabled) {
  background: var(--bg-muted);
}

button:has(> span:only-child > svg:only-child):active:not(:disabled) {
  background: var(--bg-accent);
}

/* ---- Icon-Label Buttons ---- */

button:has(> svg + span),
button:has(> span + svg) {
  display: inline-grid;
  align-items: center;
  gap: 0.4rem;
}

button:has(> svg + span) {
  grid-template-columns: 1.25rem auto;
}

button:has(> span + svg) {
  grid-template-columns: auto 1.25rem;
}

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

details {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
}

summary {
  cursor: pointer;
  font-weight: 600;
}

details[open] summary {
  margin-bottom: 0.5rem;
}

details[role="menu"][open] > summary {
  margin-bottom: 0;
}

/* ---- Dialog ---- */

dialog {
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 1.5rem;
  max-width: 32rem;
  box-shadow: 0 0.25rem 1.5rem rgba(0, 0, 0, 0.15);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

/* ---- Progress & Meter ---- */

progress {
  appearance: none;
  width: 100%;
  height: 0.75rem;
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: none;
  background: var(--bg-accent);
}

progress::-webkit-progress-bar {
  background: var(--bg-accent);
  border-radius: var(--radius-pill);
}

progress::-webkit-progress-value {
  background: var(--link);
  border-radius: var(--radius-pill);
}

progress::-moz-progress-bar {
  background: var(--link);
  border-radius: var(--radius-pill);
}

meter {
  width: 100%;
  height: 0.75rem;
}

/* ---- Misc ---- */

address {
  font-style: normal;
  margin-bottom: 1rem;
}

time {
  font-variant-numeric: tabular-nums;
}

output {
  font-weight: 500;
}

section {
  margin-bottom: 2.5rem;
}

@media (max-width: 44rem) {
  body {
    padding: 1rem;
  }
}
