@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&family=DM+Mono:wght@300;400&display=swap');

/* ══════════════════════════════════════════════════════════
   VARIABLES
══════════════════════════════════════════════════════════ */
:root {
  --bg:          #f5f0e8;
  --bg-card:     #ede8df;
  --bg-code:     #e6dfd4;
  --ink:         #2c2722;
  --ink-light:   #8a7f74;
  --accent:      #b07d5a;
  --accent-dim:  #c49a7a20;
  --border:      #d6cfc5;
  --border-dark: #c4bdb3;
  --radius:      6px;
  --mono:        'DM Mono', monospace;
  --sans:        'DM Sans', sans-serif;
  --shadow:      0 4px 20px rgba(44,39,34,0.08);
  --shadow-lg:   0 12px 40px rgba(44,39,34,0.14);
}

/* ══════════════════════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

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

/* ══════════════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════════════ */
header {
  padding: 1.2rem 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
}

.logo {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
}
.logo .bracket { color: var(--accent); }

nav { display: flex; gap: 0.35rem; align-items: center; }

nav a {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink-light);
  text-decoration: none;
  padding: 0.28rem 0.72rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all 0.18s;
}

nav a:hover {
  color: var(--ink);
  background: var(--bg-card);
  border-color: var(--border);
}

nav a.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--accent);
}

.hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.38rem 0.65rem;
  cursor: pointer;
  font-size: 1.05rem;
  color: var(--ink-light);
  line-height: 1;
  transition: border-color 0.18s;
}
.hamburger:hover { border-color: var(--accent); color: var(--accent); }

.nav-drawer {
  display: none;
  flex-direction: column;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1.5rem 0.8rem;
}
.nav-drawer a {
  font-family: var(--mono);
  font-size: 0.84rem;
  color: var(--ink-light);
  text-decoration: none;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border);
  transition: color 0.18s;
}
.nav-drawer a:last-child { border-bottom: none; }
.nav-drawer a:hover      { color: var(--accent); }
.nav-drawer a.active     { color: var(--accent); }
.nav-drawer.open         { display: flex; }

/* ══════════════════════════════════════════════════════════
   MAIN
══════════════════════════════════════════════════════════ */
main { flex: 1; padding: 4rem; max-width: 1200px; margin: 0 auto; width: 100%; }

/* ══════════════════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════════════════ */
.divider { border: none; border-top: 1px dashed var(--border); margin: 3rem 0; }

.section-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-light);
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.section-label::before { content: '//'; color: var(--accent); }

.tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  padding: 0.2rem 0.6rem;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--ink-light);
}
.tag.hi {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ══════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.62rem 1.35rem;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.78rem;
  text-decoration: none;
  border-radius: var(--radius);
  transition: background 0.18s;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn::before { content: '$'; color: var(--accent); }
.btn:hover   { background: #3e342e; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-ghost::before { content: '↗'; }
.btn-ghost:hover   { background: var(--bg-card); border-color: var(--border-dark); }

.btn-sm {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.28rem 0.68rem;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--ink-light);
  background: transparent;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.btn-sm:hover      { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-sm.primary    { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-sm.primary:hover { background: #3e342e; border-color: #3e342e; color: var(--bg); }
.btn-sm:disabled   { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

/* ══════════════════════════════════════════════════════════
   HERO (index)
══════════════════════════════════════════════════════════ */
.hero { margin-bottom: 4rem; }

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.73rem;
  color: var(--accent);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.hero-eyebrow::before { content: '▶'; font-size: 0.52rem; }

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 500;
  line-height: 1.15;
  max-width: 18ch;
  margin-bottom: 1.3rem;
  letter-spacing: -0.03em;
}
.hero h1 em {
  font-style: italic;
  font-weight: 300;
  color: var(--ink-light);
}

.hero-desc {
  max-width: 48ch;
  color: var(--ink-light);
  font-size: 1rem;
  margin-bottom: 1.8rem;
  line-height: 1.75;
}

.stack { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 2rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.about-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-top: 3rem;
}
.about-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.8rem;
}
.about-block h3 {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 0.7rem;
}
.about-block p {
  font-size: 0.88rem;
  color: var(--ink-light);
  line-height: 1.7;
}
.about-block ul { list-style: none; display: flex; flex-direction: column; gap: 0.35rem; }
.about-block ul li {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.about-block ul li::before { content: '→'; color: var(--accent); font-size: 0.65rem; }

/* ══════════════════════════════════════════════════════════
   GALLERY (portfolio)
══════════════════════════════════════════════════════════ */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.4rem;
}

.gallery-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  position: relative;
}
.gallery-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
  z-index: 2;
}
.gallery-card:hover { border-color: var(--accent); box-shadow: 0 8px 28px #b07d5a1c; transform: translateY(-3px); }
.gallery-card:hover::before { transform: scaleX(1); }

.gallery-card.placeholder { cursor: default; opacity: 0.5; }
.gallery-card.placeholder:hover { transform: none; border-color: var(--border); box-shadow: none; }
.gallery-card.placeholder::before { display: none; }

/* Preview */
.preview-wrap {
  position: relative;
  height: 230px;
  overflow: hidden;
  background: var(--bg-code);
}
.preview-wrap iframe {
  width: 200%;
  height: 200%;
  transform: scale(0.5);
  transform-origin: top left;
  border: none;
  pointer-events: none;
}
.preview-wrap .overlay { position: absolute; inset: 0; z-index: 1; }
.preview-wrap .loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--border);
}

.preview-placeholder {
  height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-code);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--border);
}

.gc-body {
  padding: 1.15rem 1.35rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.gc-tag { font-family: var(--mono); font-size: 0.67rem; color: var(--accent); margin-bottom: 0.28rem; }
.gc-title { font-weight: 500; font-size: 0.97rem; letter-spacing: -0.01em; margin-bottom: 0.3rem; }
.gc-desc { font-size: 0.8rem; color: var(--ink-light); line-height: 1.55; }
.gc-actions { display: flex; flex-direction: column; gap: 0.4rem; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════
   MODAL VIEWER
══════════════════════════════════════════════════════════ */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44,39,34,0.6);
  z-index: 500;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 1140px;
  height: 87vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s ease both;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(10px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.modal-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.modal-dots { display: flex; gap: 0.38rem; align-items: center; }
.modal-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--border);
}
.modal-dot.close-dot { background: #d98080; cursor: pointer; transition: background 0.15s; }
.modal-dot.close-dot:hover { background: #c0504f; }

.modal-url-bar {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.28rem 0.8rem;
  font-family: var(--mono);
  font-size: 0.73rem;
  color: var(--ink-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
  user-select: all;
}
.modal-url-bar .proto { color: var(--border); }
.modal-url-bar .host  { color: var(--ink); }

.modal-ext {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.28rem 0.68rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--ink-light);
  background: transparent;
  text-decoration: none;
  transition: all 0.18s;
  white-space: nowrap;
}
.modal-ext:hover { border-color: var(--accent); color: var(--accent); }

.modal iframe { flex: 1; border: none; width: 100%; background: #fff; }

/* ══════════════════════════════════════════════════════════
   CONTACT
══════════════════════════════════════════════════════════ */
.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2.5rem;
  align-items: start;
}
.contact-intro h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.18;
  margin-bottom: 1rem;
}
.contact-intro p {
  color: var(--ink-light);
  font-size: 0.93rem;
  max-width: 44ch;
  line-height: 1.75;
  margin-bottom: 2rem;
}
.contact-links { display: flex; flex-direction: column; gap: 0.85rem; }

.contact-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.3rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}
.contact-link::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.22s;
}
.contact-link:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateX(3px); }
.contact-link:hover::before { transform: scaleY(1); }

.contact-link-icon { font-family: var(--mono); font-size: 1rem; color: var(--accent); width: 1.5rem; text-align: center; flex-shrink: 0; }
.contact-link-label { font-family: var(--mono); font-size: 0.68rem; color: var(--ink-light); margin-bottom: 0.1rem; }
.contact-link-value { font-weight: 500; font-size: 0.9rem; }

.contact-form { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-light);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.form-group label::before { content: '_'; color: var(--accent); }
.form-group input,
.form-group textarea {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.68rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 300;
  color: var(--ink);
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
  resize: vertical;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--border-dark); }
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-group textarea { min-height: 130px; }
.form-submit { margin-top: 0.5rem; }

/* ══════════════════════════════════════════════════════════
   ERROR PAGES
══════════════════════════════════════════════════════════ */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 65vh;
}
.error-block {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.8rem 2.2rem;
  margin-bottom: 2.5rem;
  width: 100%;
  max-width: 500px;
  font-family: var(--mono);
}
.el { font-size: 0.82rem; line-height: 2; color: var(--ink-light); display: flex; gap: 1.4rem; }
.el .ln  { color: var(--border); user-select: none; min-width: 1.2rem; text-align: right; flex-shrink: 0; }
.el .kw  { color: var(--accent); }
.el .str { color: #7a6a5a; }
.el .num { color: var(--ink); font-weight: 400; }
.el .cmt { color: var(--border-dark); font-style: italic; }
.el.hi   { background: var(--accent-dim); margin: 0 -2.2rem; padding: 0 2.2rem; }

.error-title { font-size: clamp(1.5rem, 3.5vw, 2.2rem); font-weight: 500; letter-spacing: -0.025em; margin-bottom: 0.6rem; }
.error-desc  { max-width: 46ch; color: var(--ink-light); font-size: 0.88rem; margin-bottom: 2rem; line-height: 1.75; }
.error-links { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ══════════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════════ */
footer {
  border-top: 1px solid var(--border);
  padding: 1.4rem 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-l { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-light); }
.footer-l span { color: var(--accent); }
.footer-r { display: flex; gap: 1.5rem; }
.footer-r a { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-light); text-decoration: none; transition: color 0.18s; }
.footer-r a:hover { color: var(--accent); }

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero         { animation: fadeUp 0.5s ease both 0.04s; }
.about-strip  { animation: fadeUp 0.5s ease both 0.12s; }
.gallery      { animation: fadeUp 0.5s ease both 0.08s; }
.contact-grid { animation: fadeUp 0.5s ease both 0.06s; }
.error-page   { animation: fadeUp 0.5s ease both 0.04s; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; }
  .about-strip  { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  header, main, footer { padding-left: 1.5rem; padding-right: 1.5rem; }
  nav            { display: none; }
  .hamburger     { display: block; }
  .gallery       { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 0.5rem; }
  .modal         { height: 92vh; }
  .el.hi         { margin: 0 -1.5rem; padding: 0 1.5rem; }
  .error-block   { padding: 1.4rem 1.5rem; }
}
