/* richfromengineering.com — the only stylesheet.
   Sections: tokens, fonts, base, header, home layout, experience,
   projects, article pages, galleries, lightbox, footer, utilities. */

/* ---------- Tokens ---------- */

:root {
  --bg: #141c24;
  --bg-raised: #1b2630;
  --line: #2a3843;
  --text: #dbe3ea;
  --text-muted: #8d9ba8;
  --text-strong: #f3f6f8;
  --accent: #f0b53d;
  --accent-soft: rgba(240, 181, 61, 0.14);
  --accent-text: #f6c65c;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --measure: 68ch;
  --gutter: clamp(1rem, 5vw, 3rem);
  --radius: 6px;
}

/* ---------- Fonts (self-hosted, SIL OFL — see fonts/LICENSE.txt) ---------- */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-italic.woff2") format("woff2");
}

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

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  font-feature-settings: "cv11", "ss01";
}

h1,
h2,
h3 {
  color: var(--text-strong);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0 0 0.6em;
}

h1 {
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  letter-spacing: -0.025em;
}
h2 {
  font-size: 1.4rem;
}
h3 {
  font-size: 1.1rem;
}

p,
ul,
ol {
  margin: 0 0 1.1em;
}

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

a {
  color: var(--accent-text);
  text-decoration: none;
  text-underline-offset: 0.15em;
}
a:hover {
  text-decoration: underline;
}

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

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

::selection {
  background: var(--accent);
  color: #1a1304;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  background: var(--accent);
  color: #1a1304;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  z-index: 10;
}
.skip-link:focus {
  left: 0.5rem;
}

/* ---------- Site header (article pages) ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header .inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-header .brand {
  color: var(--text-strong);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.site-header .brand:hover {
  text-decoration: none;
  color: var(--accent-text);
}

.site-header nav {
  display: flex;
  gap: 1.4rem;
  font-size: 0.95rem;
}
.site-header nav a {
  color: var(--text-muted);
}
.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  color: var(--text-strong);
  text-decoration: none;
}

/* ---------- Home layout ---------- */

.home {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

@media (min-width: 64em) {
  .home {
    display: grid;
    grid-template-columns: minmax(18rem, 26rem) minmax(0, 1fr);
    gap: clamp(3rem, 8vw, 7rem);
  }
  .home > .intro {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5rem 0;
  }
  .home > .content {
    padding: 5rem 0;
  }
}

/* Short desktop windows: tighten the sticky column so the links stay in view */
@media (min-width: 64em) and (max-height: 46em) {
  .home > .intro {
    padding: 2.5rem 0;
  }
  .section-nav {
    margin-top: 1.5rem;
  }
}

.intro {
  padding: 3rem 0 0;
}

/* The one signature: a faint LED dot-grid behind the intro, a nod to the
   display hardware that runs through the work. */
.intro .dots {
  position: relative;
}
.intro .dots::before {
  content: "";
  position: absolute;
  inset: -1.5rem 0;
  background-image: radial-gradient(circle, rgba(240, 181, 61, 0.22) 1px, transparent 1.5px);
  background-size: 14px 14px;
  mask-image: radial-gradient(ellipse at 30% 30%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 30%, #000 20%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.intro .portrait {
  width: 7.5rem;
  height: 7.5rem;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  border: 2px solid var(--line);
  margin-bottom: 1.5rem;
}

.intro h1 {
  margin-bottom: 0.35rem;
}

.intro .role {
  color: var(--text-strong);
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 0.9rem;
}

.intro .pitch {
  color: var(--text-muted);
  max-width: 30ch;
}

.intro .pitch strong {
  color: var(--text);
  font-weight: 500;
}

.section-nav {
  display: none;
  list-style: none;
  padding: 0;
  margin: 3rem 0 0;
}
@media (min-width: 64em) {
  .section-nav {
    display: block;
  }
}
.section-nav li {
  margin: 0;
}
.section-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.45rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.section-nav a::before {
  content: "";
  width: 1.5rem;
  height: 1px;
  background: var(--text-muted);
  transition: width 0.2s ease, background 0.2s ease;
}
.section-nav a:hover,
.section-nav a.active {
  color: var(--text-strong);
  text-decoration: none;
}
.section-nav a:hover::before,
.section-nav a.active::before {
  width: 3.5rem;
  background: var(--accent);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  font-size: 0.95rem;
}
.links a {
  color: var(--text-muted);
}
.links a:hover {
  color: var(--accent-text);
  text-decoration: none;
}

.content > section {
  padding: 2.5rem 0;
  scroll-margin-top: 2rem;
}
@media (min-width: 64em) {
  .content > section {
    padding: 0 0 6rem;
  }
}

.content h2 {
  margin-bottom: 1.5rem;
}

.content .prose {
  max-width: var(--measure);
}

.content .prose p {
  color: var(--text);
}

/* ---------- Experience ---------- */

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.job {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0.5rem 1.5rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
}
.job:last-child {
  border-bottom: 1px solid var(--line);
}

.job .when {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  padding-top: 0.3rem;
  white-space: nowrap;
}

.job h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}
.job h3 a {
  color: var(--text-strong);
}
.job h3 a:hover {
  color: var(--accent-text);
  text-decoration: none;
}
.job h3 .org {
  color: var(--text-muted);
  font-weight: 500;
}

.job p {
  color: var(--text);
  margin-bottom: 0.75rem;
  max-width: var(--measure);
}

@media (max-width: 40em) {
  .job {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.tags li {
  font-size: 0.78rem;
  line-height: 1;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.more-link {
  display: inline-block;
  margin-top: 1.25rem;
  font-weight: 500;
}

/* ---------- Projects ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}
.filters button {
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}
.filters button:hover {
  color: var(--text-strong);
  border-color: var(--text-muted);
}
.filters button[aria-pressed="true"] {
  color: #1a1304;
  background: var(--accent);
  border-color: var(--accent);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.project {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raised);
}
.project[hidden] {
  display: none;
}

.project .thumb {
  aspect-ratio: 16 / 10;
  background: #0f151b;
  overflow: hidden;
}
.project .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.project .body {
  padding: 1rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.project h3 {
  margin: 0;
  font-size: 1.02rem;
}
.project h3 a {
  color: var(--text-strong);
}
.project h3 a::after {
  /* Make the whole card the click target without nesting interactive elements */
  content: "";
  position: absolute;
  inset: 0;
}
.project:hover {
  border-color: var(--text-muted);
}
.project:hover h3 a {
  color: var(--accent-text);
  text-decoration: none;
}

.project p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
  flex: 1;
}

.project .tags li {
  font-size: 0.72rem;
}

/* ---------- Patent ---------- */

.patent {
  max-width: var(--measure);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  background: var(--bg-raised);
}
.patent h3 {
  margin-bottom: 0.4rem;
}
.patent .meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

/* ---------- Article pages (employer + project detail) ---------- */

.article {
  max-width: 64rem;
  margin: 0 auto;
  padding: 3rem var(--gutter) 4rem;
}

.article header {
  margin-bottom: 2.5rem;
}

.article .crumbs {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.article .crumbs a {
  color: var(--text-muted);
}
.article .crumbs a:hover {
  color: var(--accent-text);
}
.article .crumbs span::before {
  content: "/";
  margin: 0 0.5rem;
  color: var(--line);
}

.article header h1 {
  margin-bottom: 0.5rem;
}

.article header .lede {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 48ch;
  margin-bottom: 1rem;
}

.article header .meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.article .prose {
  max-width: var(--measure);
}

.article .prose h2 {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.article .prose h3 {
  margin-top: 1.75rem;
}

.article .prose ul {
  padding-left: 1.2rem;
}
.article .prose li {
  margin-bottom: 0.3rem;
}

.article .prose li::marker {
  color: var(--text-muted);
}

.article .prose figure {
  margin: 1.5rem 0;
}
.article .prose figure img {
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.article .prose figcaption {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.article .prose blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
}

.article .prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-raised);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

.article .prose pre {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.5;
  font-size: 0.875rem;
}
.article .prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.article .prose a.fig {
  display: block;
}

.tool-list {
  columns: 2;
  column-gap: 2rem;
  padding-left: 1.2rem;
}
@media (max-width: 36em) {
  .tool-list {
    columns: 1;
  }
}

/* Project link list on employer pages */
.project-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.project-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
  margin: 0;
}
.project-list li:last-child {
  border-bottom: 1px solid var(--line);
}
.project-list a {
  color: var(--text-strong);
  font-weight: 500;
}
.project-list a:hover {
  color: var(--accent-text);
  text-decoration: none;
}
.project-list .note {
  color: var(--text-muted);
  font-size: 0.9rem;
  display: block;
}

/* Prev/next between projects */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
.pager a {
  color: var(--text-muted);
}
.pager a[rel="next"] {
  margin-left: auto;
}
.pager a:hover {
  color: var(--accent-text);
  text-decoration: none;
}

/* ---------- Galleries ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}
.gallery.wide {
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
}
.gallery.phones {
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
}
.gallery li,
.article .prose .gallery figure {
  margin: 0;
}
.gallery a {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0f151b;
}
.gallery a:hover {
  border-color: var(--text-muted);
}
.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.gallery.phones img {
  aspect-ratio: 9 / 16;
  object-fit: contain;
}
.gallery.wide img {
  aspect-ratio: 16 / 10;
  object-fit: contain;
  padding: 0.5rem;
}
.gallery.contain img {
  object-fit: contain;
  padding: 0.5rem;
}
.gallery figcaption {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.4rem;
}

/* ---------- Lightbox ---------- */

.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 96vw;
  max-height: 96vh;
}
.lightbox::backdrop {
  background: rgba(8, 12, 16, 0.92);
}
.lightbox img {
  max-width: 96vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius);
}
.lightbox figcaption {
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9rem;
  padding: 0.75rem 0 0;
}
.lightbox .close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}

/* ---------- Footer ---------- */

.site-footer {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem var(--gutter) 2.5rem;
  max-width: 64rem;
  margin: 0 auto;
}
.home + .site-footer {
  max-width: 76rem;
}
.site-footer p {
  margin: 0 0 0.4rem;
}
.site-footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--line);
}
.site-footer a:hover {
  color: var(--accent-text);
}
