:root {
  --bg:           #261b14;
  --surface:      #32241b;
  --text:         #f0e2cf;
  --heading:      #dcc3a1;
  --muted:        #b59d84;
  --accent:       #c49a6c;
  --accent-muted: #a68a64;
  --gold:         #d1a85a;
  --shade:        #7a5f45;
  --line:         rgba(240, 226, 207, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  cursor: url('images/cursor.png') 0 0, default;
}

a, button { cursor: url('images/cursor-pointer.png') 9 1, pointer; }
input, textarea { cursor: text; }
button, input, textarea { font: inherit; }

/* grain texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

/* slight darkening toward the bottom */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.14) 100%);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* NAV */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 3rem;
  background: rgba(38, 27, 20, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-decoration: none;
}

.nav-logo img { width: 22px; height: 22px; }

.nav-menu {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 42px;
  height: 36px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--accent);
}

.nav-menu span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-menu[aria-expanded='true'] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-menu[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.nav-menu[aria-expanded='true'] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-links {
  display: none;
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 3rem;
  min-width: 170px;
  padding: 0.55rem;
  gap: 0.2rem;
  flex-direction: column;
  list-style: none;
  background: rgba(50, 36, 27, 0.98);
  border: 1px solid var(--line);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.nav-links.open { display: flex; }

.nav-links a {
  display: block;
  padding: 0.65rem 0.75rem;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.nav-links a.active { color: var(--accent); }

/* PAGE LAYOUT */
main {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 7rem 2.5rem 2.5rem;
}

main.narrow { max-width: 580px; }

footer {
  position: relative;
  z-index: 1;
  padding: 1.5rem 2.5rem 2rem;
  color: var(--muted);
  font-size: 0.72rem;
  border-top: 1px solid var(--line);
}

.page-tag,
.section-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-tag { margin-bottom: 1rem; }
.section-label { margin-bottom: 0.9rem; }

h1 {
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin-bottom: 0.7rem;
}

/* coloured last word in page headings */
.accent       { color: var(--accent); }
.accent-muted { color: var(--accent-muted); }
.accent-gold  { color: var(--gold); }

/* terminal-style cursor after headings */
.cursor {
  display: inline-block;
  width: 0.5em;
  height: 0.85em;
  margin-left: 0.12em;
  vertical-align: -0.05em;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
}

.subtitle {
  font-size: 0.97rem;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 2.8rem;
  max-width: 480px;
}

/* shared card surface */
.nav-card,
.form-card,
.bio-card,
.carousel-wrap,
.skill-card,
.gallery-item,
.log-entry {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* HOME */
.hero {
  margin-bottom: 3rem;
  text-align: center;
  animation: fadeUp 0.55s ease both;
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  margin-bottom: 1.3rem;
}

.hero-sub {
  font-size: 1rem;
  color: var(--muted);
  max-width: 380px;
  line-height: 1.8;
  margin: 0 auto 2.2rem;
}

.hero .gh-stats { justify-content: center; }

/* github-readme-stats images, colours set in their URLs */
.gh-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-bottom: 2.2rem;
}

.gh-stats img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 0.9rem;
  max-width: 680px;
  margin: 0 auto;
  animation: fadeUp 0.55s 0.12s ease both;
}

.nav-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.6rem 1.8rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.nav-card:hover {
  border-color: var(--accent);
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--shade);
}

.card-icon {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  opacity: 0.75;
}

.card-title {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
}

.card-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.9rem;
  font-size: 0.75rem;
  color: var(--accent);
  transition: gap 0.2s;
}

.nav-card:hover .card-link { gap: 0.6rem; }

.latest-update {
  max-width: 680px;
  margin: 2.6rem auto 0;
  animation: fadeUp 0.55s 0.2s ease both;
}

.latest-update .log-entry { border-radius: 10px 10px 0 0; }

.latest-update .card-link {
  margin: 0;
  padding: 0.75rem 1.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 10px 10px;
  text-decoration: none;
}

/* CONTACT */
.form-card { padding: 2.2rem; }

.form-group { margin-bottom: 1.3rem; }

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.45rem;
  letter-spacing: 0.03em;
}

.form-input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--muted); opacity: 0.6; }
textarea.form-input { min-height: 130px; resize: vertical; }

.submit-btn {
  width: 100%;
  padding: 0.88rem;
  background: var(--accent);
  color: var(--surface);
  font-weight: 700;
  font-size: 0.88rem;
  border: none;
  border-radius: 6px;
  transition: box-shadow 0.15s, transform 0.15s;
}

.submit-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--shade);
}

.hidden { display: none; }

/* PORTFOLIO */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: -1.2rem 0 2.4rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1.2rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  transition: box-shadow 0.15s, transform 0.15s;
}

.social-link svg { width: 15px; height: 15px; fill: currentColor; }

.social-link-main { background: var(--accent); color: var(--surface); }

.social-link:hover {
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--shade);
}

.bio-card {
  padding: 1.5rem 1.8rem;
  margin-bottom: 2.6rem;
}

.bio-card h2 {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
  color: var(--heading);
}

.bio-card p { font-size: 0.88rem; color: var(--muted); line-height: 1.8; }

.carousel-section { margin-bottom: 3rem; }

.carousel-wrap { overflow: hidden; }

.carousel { display: flex; transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.carousel-item { min-width: 100%; display: flex; flex-direction: column; }

.carousel-image {
  width: 100%;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow: hidden;
}

.carousel-image img { max-width: 100%; max-height: 100%; object-fit: contain; }

.carousel-desc { padding: 1.4rem 1.8rem; }
.carousel-desc h3 { font-weight: 700; font-size: 0.97rem; margin-bottom: 0.4rem; }
.carousel-desc p  { font-size: 0.82rem; color: var(--muted); line-height: 1.65; margin-bottom: 0.25rem; }

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.8rem;
  border-top: 1px solid var(--line);
}

.carousel-dots { display: flex; gap: 5px; }

.dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  transition: background 0.2s, transform 0.2s;
}

.dot.active { background: var(--accent); transform: scale(1.4); }

.carousel-btns { display: flex; gap: 0.4rem; }

.carousel-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.35rem 0.9rem;
  font-size: 0.72rem;
  color: var(--accent);
  transition: border-color 0.2s;
}

.carousel-btn:hover { border-color: var(--accent); }

/* TOOLBOX */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.9rem;
}

.skill-card {
  padding: 1.4rem 1.5rem;
  transition: border-color 0.2s;
}

.skill-card:first-child { grid-column: span 2; }
.skill-card:hover { border-color: var(--accent); }

.skill-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.skill-name { font-weight: 700; font-size: 0.97rem; letter-spacing: -0.01em; }

.skill-badge {
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.18rem 0.5rem;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-advanced,
.prog-advanced     { --level: var(--accent); }
.badge-intermediate,
.prog-intermediate { --level: var(--accent-muted); }
.badge-beginner,
.prog-beginner     { --level: var(--gold); }

.skill-badge {
  color: var(--level);
  background: color-mix(in srgb, var(--level) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--level) 20%, transparent);
}

.skill-desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0.9rem;
}

.progress-bar {
  width: 100%;
  height: 3px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: 100px;
  overflow: hidden;
}

.progress {
  width: 0;
  height: 100%;
  border-radius: 100px;
  background: var(--level);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* GALLERY */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.gallery-item { overflow: hidden; }

.gallery-item img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: var(--bg);
}

.gallery-item figcaption {
  padding: 0.9rem 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* CHANGELOG */
.log-list { display: flex; flex-direction: column; gap: 0.9rem; }

.log-entry { padding: 1.4rem 1.6rem; }

.log-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.log-header h2 { font-size: 0.95rem; font-weight: 700; color: var(--heading); }
.log-header time { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }

.log-entry ul { list-style: none; }

.log-entry li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
}

.log-entry li::before {
  content: '+';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* RESPONSIVE */
@media (max-width: 680px) {
  nav { padding: 0.9rem 1.4rem; }
  .nav-links { right: 1.4rem; }
  main { padding: 5.5rem 1.3rem 2rem; }
  .nav-card { padding: 1.1rem 1rem; }
  .skills-grid { grid-template-columns: 1fr 1fr; }
  .carousel-image { height: 200px; }
  .carousel-desc, .carousel-controls { padding: 1rem 1.2rem; }
  .gallery-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .skills-grid { grid-template-columns: 1fr; }
  .skill-card:first-child { grid-column: span 1; }
}
