/* Shared theme for every page */
:root {
  --bg: #ebe4de;
  --surface: #f3eee9;
  --text: #241f1b;
  --muted: #6e645c;
  --line: #4a423c;
  --line-soft: #d3c9c0;
  --accent: #9b4a22;
  --accent-hover: #7d3a19;
  --sans: 'Jost', 'Segoe UI', system-ui, sans-serif;
  --serif: 'Lora', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

a { color: inherit; }
img { display: block; max-width: 100%; }

/* NAV */
.site-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2.25rem 1.5rem;
}
.site-nav a {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  padding-bottom: 0.2rem;
  border-bottom: 1.5px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a.active { border-bottom-color: var(--accent); }

main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* HOMEPAGE FRAME */
.frame {
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 2rem;
  padding: 1rem;
  min-height: min(560px, calc(100vh - 160px));
}
.frame-text {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 1rem 1.5rem 2rem;
}
.frame-text h1 {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
}
.bio {
  font-size: 1.02rem;
  line-height: 1.7;
  max-width: 34rem;
}
.bio p + p { margin-top: 0.8rem; }
.bio a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  white-space: nowrap;
  transition: color 0.2s;
}
.bio a:hover { color: var(--accent-hover); }
.socials { display: flex; gap: 1rem; margin-top: 2rem; }
.socials a { display: inline-flex; transition: color 0.2s, transform 0.2s; }
.socials a:hover { color: var(--accent); transform: translateY(-2px); }
.socials svg { width: 28px; height: 28px; }

.photo-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-self: center;
}
.photo-row { display: flex; gap: 0.6rem; }
.photo-row img {
  flex: var(--ar) 1 0;
  min-width: 0;
  height: auto;
}

/* PAGE HEADINGS */
.page-heading {
  text-align: center;
  margin: 1.5rem 0 3.5rem;
}
.page-heading h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  color: var(--accent);
  line-height: 1.15;
}
.page-heading p { color: var(--muted); margin-top: 0.4rem; }

/* PROJECT GALLERY */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3rem 2.25rem;
}
.project-card {
  text-decoration: none;
  display: flex;
  flex-direction: column;
}
.project-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 0.9rem;
}
.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.project-card:hover .project-thumb img,
.project-card:hover .thumb-placeholder { transform: scale(1.04); }

/* Multi-image thumbnail: one large image left, two stacked right */
.thumb-collage {
  display: grid;
  grid-template-columns: 3fr 2fr;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
}
.thumb-collage img { min-height: 0; }
.thumb-collage img:first-child { grid-row: 1 / 3; }
.project-card:hover .thumb-collage img { transform: none; opacity: 0.9; }

/* Solid tile for projects without a photo yet */
.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 2.6rem;
  color: #f3eee9;
  transition: transform 0.5s ease;
}
.tone-rust { background: var(--accent); }
.tone-green { background: #23392e; }
.tone-charcoal { background: #2b2725; }

.thumb-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: var(--surface);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
}

.project-name {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.3;
  transition: color 0.2s;
}
.project-card:hover .project-name { color: var(--accent); }
.project-type {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 0.2rem;
}
.project-stack {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.project-stack strong { color: var(--text); font-weight: 600; }

/* PROJECT DETAIL */
.detail { max-width: 800px; margin: 0 auto; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 1.5rem;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }
.back-link svg { width: 15px; height: 15px; }

.detail-header {
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
}
.detail-header h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 2.9rem);
  line-height: 1.15;
}
.detail-header .project-type { margin-top: 0.6rem; }
.dev-badge {
  display: inline-block;
  vertical-align: middle;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  margin-left: 0.4rem;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1rem; }
.tag {
  border: 1px solid var(--line-soft);
  background: var(--surface);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.2rem 0.65rem;
}

.project-body { display: flex; flex-direction: column; gap: 2.25rem; }

.description { font-size: 1.05rem; max-width: 680px; }
.description p + p,
.description ul + p { margin-top: 0.85rem; }
.description ul {
  margin: 0.6rem 0 0 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.media-item {
  background: var(--surface);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Show screenshots uncropped */
.media-grid.natural .media-item { aspect-ratio: auto; }
.media-grid.natural .media-item img { height: auto; object-fit: contain; }

/* CAD GALLERY */
.cad-model h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.6rem;
}
.cad-model .project-type { margin: 0.1rem 0 1rem; }
.cad-model .project-type:has(+ .cad-desc) { margin-bottom: 0.3rem; }
.cad-desc { color: var(--muted); margin-bottom: 1rem; }
.cad-model + .cad-model {
  border-top: 1px solid var(--line-soft);
  padding-top: 2.25rem;
}
.cad-model .media-item { align-self: start; background: none; }
.media-item.wide { grid-column: 1 / -1; }
a.media-item { cursor: zoom-in; }
a.media-item img { transition: opacity 0.2s; }
a.media-item:hover img { opacity: 0.88; }

.btn-group { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  padding: 0.7rem 1.4rem;
  transition: background 0.2s, transform 0.2s;
}
.btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* EXTRACURRICULARS */
.cc { max-width: 940px; }
.cc-section + .cc-section { margin-top: 4rem; }
.cc-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.cc-entry {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 2.5rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.cc-org h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.25;
}
.cc-org p { color: var(--muted); font-size: 0.95rem; margin-top: 0.25rem; }
.cc-detail > p { margin-top: 0.85rem; }

/* Roles held within one organisation, newest first */
.role-list {
  list-style: none;
  border-left: 1px solid var(--line-soft);
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.role-list li {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.role-list li::before {
  content: '';
  position: absolute;
  left: calc(-1.25rem - 4px);
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-soft);
}
.role-list li:first-child::before { background: var(--accent); }
.role { font-weight: 600; font-size: 1.05rem; }
.role-sub { display: block; font-weight: 400; font-size: 0.92rem; color: var(--muted); }
.dates { font-size: 0.9rem; color: var(--muted); white-space: nowrap; }
.dates.current { color: var(--accent); font-weight: 500; }

/* CONTACT */
.contact-frame {
  border: 1px solid var(--line);
  max-width: 640px;
  margin: 0 auto;
  padding: 3rem 2.5rem;
  text-align: center;
}
.contact-frame h1 {
  font-size: clamp(2.2rem, 5vw, 3rem);
  font-weight: 500;
  margin-bottom: 0.5rem;
}
.contact-frame > p { color: var(--muted); margin-bottom: 2rem; }
.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  align-items: center;
}
.contact-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.1rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.contact-list a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.contact-list svg { width: 22px; height: 22px; }

/* RESPONSIVE */
@media (max-width: 900px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem 1.5rem; }
}

@media (max-width: 720px) {
  .site-nav { padding: 1.5rem 1rem; justify-content: space-between; }
  .site-nav a { font-size: 0.72rem; letter-spacing: 0.06em; }
  .cc-entry { grid-template-columns: minmax(0, 1fr); gap: 1rem; padding: 1.5rem 0; }
  .role-list li { flex-direction: column; gap: 0; }
  main { padding: 0 1rem 3rem; }
  .frame { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .frame-text { padding: 1.25rem 0.5rem 0.5rem; }
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .media-grid { grid-template-columns: 1fr; }
  .contact-frame { padding: 2.25rem 1.25rem; }
}
