/* ============================================
   OUTSIDE THE LINES STUDIO
   Grey/white theme with red accents
   ============================================ */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f3;
  --bg-nav: #000000;
  --text-primary: #2a2a2a;
  --text-secondary: #555;
  --text-muted: #888;
  --accent: #b22222;
  --accent-hover: #d43333;
  --border: #ddd;
  --border-dark: #333;
  --overlay-bg: rgba(0, 0, 0, 0.92);
  --photo-bg: #e9e9e9;
  --max-width: 900px;
  --nav-height: 56px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: Georgia, "Times New Roman", serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

/* ============================================
   Site header
   ============================================ */

.site-header {
  background: var(--bg-primary);
  padding: 1.25rem 1.5rem;
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-header a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
}

.site-header a:hover { color: var(--accent); }

.header-logo {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

.header-text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.header-name {
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ============================================
   Navigation
   ============================================ */

.navbar {
  background: var(--bg-nav);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  min-height: var(--nav-height);
}

.navbar-brand { display: none; }

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.15rem;
  position: absolute;
  top: 0;
  right: 1.5rem;
}

.nav-links li a {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: block;
  padding: 0 0.65rem 0.4rem;
  margin-top: -0.04em;
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  color: #e6e6e6;
  border-radius: 3px;
  transition: color 0.2s, background 0.2s;
}

.nav-links li a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-links li.active a {
  color: #000;
  background: #fff;
}

.page-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  position: absolute;
  bottom: 0.15em;
  left: 1.5rem;
  font-size: 2.0rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

/* Hamburger toggle (CSS-only) */
.nav-toggle { display: none; }
.nav-toggle-label { display: none; cursor: pointer; }

.nav-toggle-label span,
.nav-toggle-label span::before,
.nav-toggle-label span::after {
  display: block;
  background: #e0e0e0;
  height: 2px;
  width: 22px;
  border-radius: 2px;
  position: relative;
  transition: transform 0.3s, opacity 0.3s;
}

.nav-toggle-label span::before,
.nav-toggle-label span::after {
  content: "";
  position: absolute;
}

.nav-toggle-label span::before { top: -7px; }
.nav-toggle-label span::after { top: 7px; }

/* ============================================
   Main content
   ============================================ */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  flex: 1;
  width: 100%;
}

h1, h2, h3, h4 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 600;
  color: var(--text-primary);
}

h1 { font-size: 1.6rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.3rem; margin-bottom: 0.5rem; margin-top: 2rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; }

ul, ol { margin-bottom: 1rem; padding-left: 1.5rem; }
li { margin-bottom: 0.35rem; }

blockquote {
  border-left: 3px solid var(--border);
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

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

/* ============================================
   Project header
   ============================================ */

.project-header {
  margin-bottom: 1.5rem;
  margin-top: -1.5rem;
}

.project-header h1 {
  display: none;
}

.project-meta {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  margin-bottom: 0;
}

.project-meta .project-dates {
  color: var(--text-muted);
}

.project-meta .project-location {
  color: var(--text-secondary);
}

.project-location {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
}

.project-dates {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* ============================================
   Project hero image
   ============================================ */

.project-hero {
  margin-bottom: 1.5rem;
}

.project-hero img {
  width: 100%;
  border-radius: 2px;
}

/* ============================================
   Inline photo layouts
   ============================================ */

.photo-bar {
  display: flex;
  gap: 6px;
  margin: 1.5rem 0;
}

.photo-bar img {
  flex: 1;
  min-width: 0;
  object-fit: cover;
  border-radius: 2px;
  cursor: pointer;
}

.photo-side {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 6px;
  margin: 1.5rem 0;
}

.photo-side-main img {
  width: 100%;
  border-radius: 2px;
}

.photo-side-thumbs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.photo-side-thumbs img {
  width: 100%;
  border-radius: 2px;
  cursor: pointer;
}

/* ============================================
   Gallery grid
   ============================================ */

.gallery-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.gallery-section h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  margin-top: 0;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}

.gallery-grid a {
  display: block;
  overflow: hidden;
  background: var(--photo-bg);
  border-radius: 2px;
}

.gallery-grid a img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: opacity 0.2s;
}

.gallery-grid a:hover img { opacity: 0.8; }

/* ============================================
   CSS-only lightbox
   ============================================ */

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.lightbox:target {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  text-align: center;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 2px;
}

.lightbox-close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  font-size: 1.5rem;
  color: #999;
  line-height: 1;
  padding: 0.25rem 0.5rem;
}

.lightbox-close:hover { color: #fff; }

.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  color: #999;
  padding: 1rem;
  z-index: 210;
}

.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-prev:hover,
.lightbox-next:hover { color: #fff; }

.lightbox-caption {
  margin-top: 0.75rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.85rem;
  color: #bbb;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.gallery-link {
  margin-top: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
}

/* ============================================
   Project navigation (bottom of project pages)
   ============================================ */

.project-nav {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
}

/* ============================================
   Projects index page
   ============================================ */

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 4px;
  margin-bottom: 2rem;
  justify-content: center;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.portfolio-grid a {
  display: block;
  overflow: hidden;
  background: var(--photo-bg);
  border-radius: 2px;
}

.portfolio-grid a img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  transition: opacity 0.2s;
}

.portfolio-grid a:hover img { opacity: 0.8; }

.project-list {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.project-list th {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--text-primary);
  color: var(--text-primary);
}

.project-list td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.project-list tr:hover td {
  background: var(--bg-secondary);
}

.project-list .year {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* ============================================
   Quote blocks (mission page)
   ============================================ */

.quote {
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--text-secondary);
}

.quote .attribution {
  display: block;
  text-align: right;
  font-style: normal;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ============================================
   About page
   ============================================ */

.about-section {
  margin-bottom: 2rem;
  overflow: hidden;
}

.about-section img {
  max-width: 220px;
  border-radius: 2px;
  margin-bottom: 1rem;
}

.about-section img.float-right {
  float: right;
  margin-left: 1.5rem;
}

.about-section img.float-left {
  float: left;
  margin-right: 1.5rem;
}

/* ============================================
   Timeline
   ============================================ */

.timeline {
  width: 100%;
  border-collapse: collapse;
}

.timeline td {
  padding: 0.4rem 0.75rem;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.timeline .year-cell {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 600;
  white-space: nowrap;
  width: 60px;
  text-align: right;
}

/* ============================================
   Code section table
   ============================================ */

.code-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.code-table th {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--text-primary);
}

.code-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.code-table tr:nth-child(even) td {
  background: var(--bg-secondary);
}

/* ============================================
   Homepage
   ============================================ */

.home-intro {
  max-width: 600px;
}

.home-intro .studio-name {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.home-intro .tagline {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   Footer
   ============================================ */

.site-footer {
  background: #444;
  padding: 1.5rem;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.75rem;
  color: #bbb;
}

.site-footer .tagline {
  margin-top: 0.25rem;
  color: #999;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
  .nav-toggle-label {
    display: flex;
    align-items: center;
    position: absolute;
    top: 0.25rem;
    right: 1rem;
    padding: 0.5rem;
  }

  .page-title {
    font-size: 1.2rem;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border-dark);
    flex-direction: column;
    padding: 0.5rem 0;
  }

  .nav-toggle:checked ~ .nav-links { display: flex; }

  .nav-links li a {
    padding: 0.75rem 1.5rem;
    border-radius: 0;
  }

  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 4px;
  }

  .photo-bar {
    flex-wrap: wrap;
  }

  .photo-side {
    grid-template-columns: 1fr;
  }

  .about-section img.float-right,
  .about-section img.float-left {
    float: none;
    margin: 0 0 1rem 0;
    max-width: 100%;
  }

  .lightbox-prev { left: 0.25rem; font-size: 1.5rem; }
  .lightbox-next { right: 0.25rem; font-size: 1.5rem; }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 3px;
  }

  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  main { padding: 1.5rem 1rem 3rem; }

  .project-nav {
    flex-direction: column;
    gap: 0.5rem;
  }
}
