/* ============================================================
   olwal.github.io — home theme
   Light theme matching olwal.com: Inter, #dadada page on white
   panels, black nav buttons with #6BB4E8 hover, gold award badges.
   Shares the render.js engine with al-ek.com / hybridsurface.com.
   ============================================================ */

:root {
  --bg:      #dadada;   /* page background */
  --panel:   #ffffff;   /* content panels  */
  --fg:      #666666;   /* body text       */
  --ink:     #222222;   /* strong text     */
  --title:   #000000;   /* section titles  */
  --muted:   #999999;   /* secondary text  */
  --accent:  #6bb4e8;   /* olwal.com hover blue */
  --gold:    #c88c3c;   /* award badge     */
  --border:  #e3e3e3;
  --maxw:    1180px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, Georgia, Tahoma, Verdana, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

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

img { max-width: 100%; }

/* ---- top navigation ---------------------------------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-inner .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--title);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.nav-inner .brand:hover { color: var(--accent); }
.nav-links {
  list-style: none;
  display: flex;
  gap: 8px;
  margin: 0 0 0 auto;
  padding: 0;
}
.nav-links a {
  display: inline-block;
  padding: 6px 12px;
  background: #000;
  color: #fff;
  border-radius: 5px;
  font-size: 0.9rem;
}
.nav-links a:hover,
.nav-links a.active { background: var(--accent); color: #fff; }

.nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 0;
  font-size: 1.5rem;
  color: var(--ink);
  cursor: pointer;
}

/* ---- masthead ---------------------------------------------- */
.masthead {
  max-width: var(--maxw);
  margin: 20px auto 0;
  padding: 0; /* the white box (.masthead-inner) spans the full max-width, matching .container */
}
.masthead-inner {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.identity { display: flex; gap: 16px; align-items: center; }
.identity .portrait {
  width: 88px; height: 88px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
  flex: none;
}
.identity-text { display: flex; flex-direction: column; gap: 2px; }
.identity-text .name { font-weight: 800; font-size: 1.5rem; color: var(--title); letter-spacing: -0.01em; }
.identity-text .name:hover { color: var(--accent); }
.identity-text .role { font-size: 1rem; color: var(--ink); font-weight: 500; }
.identity-text .contact { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.keywords { margin: 0; color: var(--fg); font-size: 0.85rem; line-height: 1.7; }
.bio { margin: 0; color: var(--fg); font-size: 0.9rem; }

/* ---- content shell ----------------------------------------- */
.container {
  max-width: var(--maxw);
  margin: 20px auto 40px;
  padding: 24px 26px 30px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.loading, .error { padding: 20px 0; color: var(--muted); }
.error { color: #b3261e; }

/* ---- section headings -------------------------------------- */
.section-heading { margin: 34px 0 16px; }
.section-heading:first-child { margin-top: 4px; }
.section-heading h2 {
  margin: 0;
  color: var(--title);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.section-heading .subtitle {
  margin: 6px 0 0;
  color: var(--fg);
  font-size: 0.95rem;
  max-width: 80ch;
}

/* ---- project card grid ------------------------------------- */
.projects-block { margin: 0; }
.projects-block + .projects-block { margin-top: 18px; } /* match the grid row gap so split grids read as one */
/* Responsive columns. The card set is 4 image cards followed by 3 text
   cards, so at desktop width (4 columns) the image cards fill the top row
   and the text cards the second — each row uniform in height. */
.projects {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 600px)  { .projects { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .projects { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1120px) { .projects { grid-template-columns: repeat(4, 1fr); } }
.project-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
  border-color: #cfcfcf;
}
.project-media { display: block; background: #fff; }
.project-media img,
.project-media video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.project-media img.fit-contain { object-fit: contain; } /* full figure, no crop (e.g. the $1 gesture set) */
.project-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px 16px 16px;
  flex: 1;
}
.project-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.project-title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.project-title a { color: inherit; }
.project-title a:hover { color: var(--accent); }
.project-badge {
  flex: none;
  background: var(--gold);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.project-blurb { margin: 0; color: #555; font-size: 0.9rem; line-height: 1.5; }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.project-tag {
  font-size: 0.7rem;
  color: #777;
  background: #f2f2f2;
  border: 1px solid #ececec;
  border-radius: 4px;
  padding: 2px 8px;
}
.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: auto;
  padding-top: 4px;
}

/* ---- external link (label + arrow icon) -------------------- */
.external-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
}
.external-link:hover { color: #3a8fca; }
.ext-icon { display: inline-flex; }

/* ---- button links (renderLink + research row) -------------- */
.button-link {
  display: inline-block;
  padding: 8px 14px;
  background: #000;
  color: #fff;
  border-radius: 6px;
  font-size: 0.9rem;
}
.button-link:hover { background: var(--accent); color: #fff; }
.research-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 0; }
.archive-note { margin-top: 26px; font-size: 0.8rem; color: var(--muted); }
.archive-note a { color: var(--muted); text-decoration: underline; }
.archive-note a:hover { color: var(--accent); }

/* ---- media blocks (images/video/embeds, if used) ----------- */
.image-container, .video-container, .embed-block { margin: 16px 0; }
.image-container img, .video-container video { display: block; width: 100%; border-radius: 6px; }
.zoomable { cursor: zoom-in; }
.caption, .grid-caption { font-size: 0.82rem; color: var(--muted); margin-top: 6px; }
.embed-container { position: relative; width: 100%; border-radius: 6px; overflow: hidden; }
.embed-container::before { content: ""; display: block; }
.embed-16x9::before { padding-top: 56.25%; }
.embed-4x3::before  { padding-top: 75%; }
.embed-1x1::before  { padding-top: 100%; }
.embed-container iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---- lightbox ---------------------------------------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.9); padding: 4vmin;
}
.lightbox.open { display: flex; }
.lightbox-stage { max-width: 92vw; max-height: 88vh; }
.lightbox-stage img, .lightbox-stage video { max-width: 92vw; max-height: 88vh; display: block; }
.lightbox-caption { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; color: #eee; font-size: 0.85rem; }
.lightbox-close, .lightbox-nav {
  position: absolute; background: none; border: 0; color: #fff;
  font-size: 2.4rem; line-height: 1; cursor: pointer; opacity: 0.8;
}
.lightbox-close:hover, .lightbox-nav:hover { opacity: 1; }
.lightbox-close { top: 12px; right: 20px; }
.lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); }

/* ---- footer ------------------------------------------------ */
.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer .sep { margin: 0 8px; opacity: 0.6; }

/* ---- responsive -------------------------------------------- */
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    margin: 10px 0 0;
    gap: 6px;
  }
  .nav-links.open { display: flex; }
  .nav-inner { flex-wrap: wrap; }
  .masthead-inner { flex-direction: column; gap: 18px; }
  .identity { align-self: flex-start; }
  .identity-text { text-align: left; align-items: flex-start; }
  .statement { max-width: none; }
}
