/* ==========================================================================
   mikestanding.com — monochrome stylesheet
   Pure B&W, hard edges, monospace accents, dark-mode toggle, scanline overlay.
   Plain CSS, no build step. Theme is driven by [data-theme] on <html>.
   ========================================================================== */

/* --- Theme tokens (light default) -------------------------------------- */
:root {
  --bg:            #ffffff;
  --fg:            #000000;
  --border:        #000000;
  --card-bg:       #ffffff;
  --muted:         rgba(0, 0, 0, 0.6);
  --placeholder:   #f0f0f0;

  --maxw:          860px;
  --font-body:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                   Roboto, Helvetica, Arial, sans-serif;
  --font-mono:     'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo,
                   Consolas, monospace;
}

[data-theme="dark"] {
  --bg:            #000000;
  --fg:            #ffffff;
  --border:        #ffffff;
  --card-bg:       #000000;
  --muted:         rgba(255, 255, 255, 0.6);
  --placeholder:   #111111;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--fg); color: var(--bg); }

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

a { color: var(--fg); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Scanline overlay ("lines in the background") ----------------------- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.015) 2px,
    rgba(0, 0, 0, 0.015) 4px
  );
}
[data-theme="dark"] body::after {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.02) 2px,
    rgba(255, 255, 255, 0.02) 4px
  );
}

/* --- Layout ------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main { flex: 1 0 auto; padding: 3.5rem 0; }

/* Keep the content area's top and bottom gap equal to main's 3.5rem padding on
   every page, whatever the first/last element's own margins happen to be. */
main .container > *:first-child { margin-top: 0; }
main .container > *:last-child { margin-bottom: 0; }

/* --- Typography --------------------------------------------------------- */
.logo-text {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg);
}
.logo-text:hover { text-decoration: none; }

.blink { animation: blink-anim 1s step-end infinite; }
@keyframes blink-anim { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.mono-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.page-title {
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-size: 2.6rem;
  margin: 0 0 1rem;
}

.lead {
  font-size: 1.15rem;
  line-height: 1.7;
  opacity: 0.8;
  margin: 0 0 2.5rem;
}

section { margin-bottom: 3rem; }

h2 {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 1rem;
  padding-bottom: 0.5rem;
  margin: 0 0 1.25rem;
  border-bottom: 1px solid var(--border);
}
h3 { font-size: 1.2rem; margin: 0 0 0.5rem; }

/* --- Header / nav ------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.nav-group { display: flex; align-items: center; gap: 0.25rem; }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.nav a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg);
  padding: 0.5rem 0.9rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.nav a:hover { background-color: var(--fg); color: var(--bg); text-decoration: none; }
.nav a.active { background-color: var(--fg); color: var(--bg); }

/* --- Dark-mode toggle --------------------------------------------------- */
.dark-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-left: 0.5rem;
  padding: 0;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.3s ease, background-color 0.2s ease, color 0.2s ease;
}
.dark-toggle:hover { background-color: var(--fg); color: var(--bg); }
.dark-toggle svg { width: 1.1rem; height: 1.1rem; display: block; }

/* --- Home hero ---------------------------------------------------------- */
.hero {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-wrap: wrap;
  margin-bottom: 3.5rem;
}
.avatar {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  filter: grayscale(1) contrast(1.05);
}
/* Text column fills the space beside the photo and wraps its own text,
   instead of dropping below the photo. min-width:0 lets it shrink to wrap. */
.hero > div { flex: 1; min-width: 0; }
/* Inside the hero, the lead's bottom margin would stack on the hero's own
   margin — zero it so the hero→About gap equals the 3.5rem top gap. */
.hero .lead { margin-bottom: 0; }

/* --- Card grid (projects) ----------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.card {
  display: flex;
  flex-direction: column;
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  padding: 1.5rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.card:hover { background-color: var(--fg); color: var(--bg); }
.card:hover .mono-tag,
.card:hover .tag,
.card:hover .read-link { color: var(--bg); border-color: var(--bg); }
.card p { opacity: 0.85; font-size: 0.95rem; margin: 0 0 1.25rem; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 0.15rem 0.55rem;
}

.card-links {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.read-link {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg);
}
.read-link:hover { text-decoration: underline; }

/* --- Links list --------------------------------------------------------- */
.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: -1px;
}
.link-list li { margin-top: -1px; }
.link-list li:first-child { margin-top: 0; }
.link-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--border);
  padding: 1.1rem 1.35rem;
  color: var(--fg);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.link-list a:hover { background-color: var(--fg); color: var(--bg); text-decoration: none; }
.link-label { font-weight: 700; }
.link-sub {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  opacity: 0.65;
}
.link-list .arrow { font-family: var(--font-mono); }

/* --- Contact ------------------------------------------------------------ */
.contact-methods {
  list-style: none;
  padding: 0;
  margin: 0 0 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}
.form-field label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.form-field input,
.form-field textarea {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--fg);
  background-color: transparent;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0.75rem 0.9rem;
}
.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--fg); opacity: 0.4; }
.form-field input:focus,
.form-field textarea:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg); }
.form-field textarea { min-height: 150px; resize: vertical; }

.btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--fg);
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 0.75rem 1.75rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.btn:hover { background-color: var(--fg); color: var(--bg); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:disabled:hover { background-color: transparent; color: var(--fg); }

/* Honeypot — kept in the DOM for bots but hidden from people and screen readers */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Turnstile widget spacing + form status message */
.cf-turnstile { margin-bottom: 1.5rem; }
.form-status {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  margin: 1rem 0 0;
  min-height: 1.2em;
}
.form-status.is-error { text-decoration: underline; }

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.footer-link {
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  color: var(--fg);
}
.footer-link:hover { opacity: 0.6; }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .page-title { font-size: 2rem; }
  .site-header .container { flex-direction: column; align-items: flex-start; }
  .nav { gap: 0.15rem; }
  .nav a { padding: 0.4rem 0.65rem; }
  /* Stack the photo above the text on narrow screens */
  .hero { flex-direction: column; align-items: flex-start; }
}
