/* ------------------------------------------------------------------
   Base theme (main site)
   ------------------------------------------------------------------ */
:root {
  --bg: #ffffff;
  --surface: #f6f6f4;
  --fg: #1a1a1a;
  --muted: #5f5f5f;
  --border: #e3e3e0;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --max-width: 52rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: var(--font);
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111213;
    --surface: #1a1b1d;
    --fg: #ececec;
    --muted: #a0a0a0;
    --border: #2b2c2f;
    --accent: #60a5fa;
    --accent-soft: rgba(96, 165, 250, 0.12);
  }
}

/* ------------------------------------------------------------------
   Section themes. Set data-section on <body> for a section page, or on
   any element (e.g. a card on the home page) to use that section's colors.
   ------------------------------------------------------------------ */
[data-section="gary"] {
  --accent: #a35f00;
  --accent-soft: rgba(255, 165, 32, 0.14);
}

[data-section="backwoods-simracer"] {
  --accent: #b84a00;
  --accent-soft: rgba(255, 126, 1, 0.12);
}

[data-section="homelab"] {
  --accent: #0e7490;
  --accent-soft: rgba(14, 116, 144, 0.1);
  --font-heading: var(--font-mono);
}

[data-section="woodworking"] {
  --accent: #8a4b22;
  --accent-soft: rgba(138, 75, 34, 0.1);
  --font-heading: var(--font-serif);
}

[data-section="blackacre"] {
  --accent: #3d6b2f;
  --accent-soft: rgba(61, 107, 47, 0.12);
  --font-heading: var(--font-serif);
}

@media (prefers-color-scheme: dark) {
  [data-section="gary"]               { --accent: #ffa520; }
  [data-section="backwoods-simracer"] { --accent: #ff7e01; }
  [data-section="homelab"]            { --accent: #22d3ee; }
  [data-section="woodworking"]        { --accent: #d6a06b; }
  [data-section="blackacre"]          { --accent: #8cc675; }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.6;
}

main {
  flex: 1;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  line-height: 1.2;
}

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

img {
  max-width: 100%;
  height: auto;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

/* ------------------------------------------------------------------
   Header and footer
   ------------------------------------------------------------------ */
.site-header {
  border-top: 4px solid var(--accent);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.site-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
}

.site-title img {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.375rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--fg);
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer a {
  color: inherit;
}

/* ------------------------------------------------------------------
   Page content
   ------------------------------------------------------------------ */
.hero {
  padding: 4rem 0 2rem;
}

.hero h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  margin: 0 0 0.75rem;
}

.hero .lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 40rem;
  margin: 0;
}

.section {
  padding: 1.5rem 0;
}

/* Hero with a logo beside the heading (stacks on small screens). */
.hero--logo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem 2.5rem;
  padding-top: 3rem;
}

.hero--logo > div {
  flex: 1 1 18rem;
}

.hero-logo {
  flex: 0 0 auto;
  width: min(100%, 18rem);
  height: auto;
}

.section h2 {
  font-size: 1.35rem;
  margin: 0 0 0.75rem;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-block;
  padding: 0.55rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

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

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

.note {
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--accent);
  border-radius: 0.25rem;
  background: var(--accent-soft);
}

.placeholder {
  padding: 2rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 0.75rem;
  color: var(--muted);
  text-align: center;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Tools page: cards (the home page's) with a button at the bottom. */
.cards.tool-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 520px) {
  .cards.tool-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

.tool-cards .card .button {
  align-self: flex-start;
  margin-top: auto;
}

.tool-cards .card p {
  margin-bottom: 1rem;
}

.tool-soon {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 10rem;
  padding: 1.35rem;
  border: 1px dashed var(--border);
  border-radius: 1rem;
  color: var(--muted);
}

/* ------------------------------------------------------------------
   Home page
   ------------------------------------------------------------------ */

/* Five-color stripe: one band per section. */
.home .site-header {
  border-top: 0;
  position: relative;
}

.home .site-header::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(
    to right,
    #ffa520 0 20%,
    #0e7490 20% 40%,
    #ff7e01 40% 60%,
    #3d6b2f 60% 80%,
    #8a4b22 80% 100%
  );
}

.home-hero {
  position: relative;
  padding: 5rem 0 3rem;
}

/* Soft glow behind the heading. */
.home-hero::before {
  content: "";
  position: absolute;
  inset: 1rem auto auto -6rem;
  width: 28rem;
  height: 18rem;
  max-width: 100vw;
  background: radial-gradient(closest-side, var(--accent-soft), transparent);
  filter: blur(8px);
  z-index: -1;
  pointer-events: none;
}

.hero-eyebrow {
  margin: 0 0 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.home-hero h1 {
  font-size: clamp(2.5rem, 8vw, 4.25rem);
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.home-hero .lead {
  font-size: clamp(1.1rem, 2.4vw, 1.3rem);
  line-height: 1.55;
  max-width: 38rem;
}

.cards-title {
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------------------------------------------
   Home page section cards
   ------------------------------------------------------------------ */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: 0;
  margin: 0 0 5rem;
  list-style: none;
}

.card-item--featured {
  grid-column: span 2;
}

@media (max-width: 760px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .card-item--featured {
    grid-column: auto;
  }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  height: 100%;
  padding: 1.35rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Accent bar along the top edge, inside the rounded corners. */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--accent);
}

/* Section-colored wash in the corner, stronger on hover. */
.card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -30%;
  width: 70%;
  height: 90%;
  background: radial-gradient(closest-side, var(--accent-soft), transparent);
  opacity: 0.6;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 28px -14px var(--accent);
}

.card:hover::after,
.card:focus-visible::after {
  opacity: 1;
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.card-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.6rem;
}

.card-eyebrow {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--bg);
}

.card h2 {
  margin: 0;
  font-size: 1.25rem;
}

.card-item--featured .card h2 {
  font-size: 1.6rem;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.card-item--featured .card p {
  font-size: 1.05rem;
  max-width: 30rem;
}

.card-url {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
}

/* Long subdomains wrap before ".diego-g.com", never mid-word. */
.card-host span {
  white-space: nowrap;
}

.card-arrow {
  font-family: var(--font);
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

.card:hover .card-arrow,
.card:focus-visible .card-arrow {
  transform: translateX(4px);
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .card-arrow {
    transition: none;
  }

  .card:hover,
  .card:focus-visible {
    transform: none;
  }
}
