/* =========================================================
   Ahmad Droby — Meridian theme
   Palette and typography per drobyA logo specification v1.0
   ========================================================= */

:root {
  /* Surface */
  --paper:    #FAF8F3;
  --panel:    #FFFFFF;
  --bone:     #F4F0E6;
  --ink:      #15120E;

  /* Text */
  --ink-soft: #3F3C36;
  --soft:     #75716A;
  --faint:    #A8A399;

  /* Rules */
  --rule:     #E7E2D6;
  --rule-2:   #EFEBE1;

  /* Accent (the single brand colour) */
  --amber:    #E9A23C;
  --amber-2:  #C9871F;

  /* Type */
  --display: 'Bricolage Grotesque', 'Familjen Grotesk', system-ui, sans-serif;
  --body:    'Hanken Grotesk', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --wordmark:'Familjen Grotesk', 'Bricolage Grotesque', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--ink); color: var(--paper); }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
}

a { color: inherit; text-decoration: none; }

b, strong { font-weight: 700; color: var(--ink); }

em { font-style: italic; color: var(--ink); }

img, svg { display: block; max-width: 100%; }

.amber { color: var(--amber); }

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

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--wordmark);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.brand-mark {
  border-radius: 8px;
  flex: 0 0 auto;
  display: block;
  width: 32px;
  height: 32px;
  min-width: 0;
  min-height: 0;
}

.brand-text .droby { color: var(--ink); }

.nav-menu {
  display: flex;
  gap: 4px;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: var(--body);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-soft);
  transition: background .15s ease, color .15s ease;
}

.nav-link .n {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--soft);
}

.nav-link:hover {
  background: var(--bone);
  color: var(--ink);
}

.nav-link.active {
  background: var(--ink);
  color: var(--paper);
}

.nav-link.active .n { color: var(--amber); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 8px;
  width: 40px; height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.nav-toggle span {
  width: 18px;
  height: 1.6px;
  background: var(--ink);
  transition: transform .2s ease, opacity .2s ease;
}

/* =====================================================
   Cover
   ===================================================== */

.cover {
  padding: 72px 0 80px;
  border-bottom: 1px solid var(--rule);
}

.tag {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--soft);
}

.cover-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(56px, 10.5vw, 132px);
  line-height: 0.94;
  letter-spacing: -0.04em;
  margin: 26px 0 10px;
  color: var(--ink);
}

.cover-name .amber {
  color: var(--amber);
  display: inline-block;
}

.cover-sub {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(20px, 2.6vw, 30px);
  letter-spacing: -0.02em;
  color: var(--soft);
  margin-bottom: 28px;
}

.cover-blurb {
  max-width: 640px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.cover-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: 42px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
}

.meta-cell {
  padding: 16px 20px;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-cell:last-child { border-right: none; }

.meta-cell .k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--soft);
}

.meta-cell .v {
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.index {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 24px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
}

.index a {
  padding: 22px 22px;
  border-right: 1px solid var(--rule);
  transition: background .18s ease;
}

.index a:last-child { border-right: none; }
.index a:hover { background: var(--bone); }

.index .n {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.index .t {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-top: 4px;
}

.index .d {
  font-size: 13px;
  color: var(--soft);
  margin-top: 4px;
}

/* =====================================================
   Numbered sections (01–04)
   ===================================================== */

section[id] {
  padding: 96px 0;
  border-bottom: 1px solid var(--rule);
}

.sec-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 18px;
}

.sec-num {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--amber);
}

.sec-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(36px, 5.4vw, 56px);
  letter-spacing: -0.035em;
  color: var(--ink);
  line-height: 1;
}

.sec-kind {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--soft);
}

.sec-intro {
  max-width: 640px;
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.65;
}

.block { margin-top: 56px; }

.block-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--soft);
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.block-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* =====================================================
   Timeline (education)
   ===================================================== */

.timeline {
  position: relative;
  padding-left: 0;
}

.t-item {
  position: relative;
  padding-left: 56px;
  margin-bottom: 24px;
}

.t-item::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 0;
  bottom: -24px;
  width: 1px;
  background: var(--rule);
}

.t-item:last-child::before { bottom: 50%; }

.t-marker {
  position: absolute;
  left: 4px;
  top: 24px;
  width: 17px;
  height: 17px;
  background: var(--paper);
  border: 1.6px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--paper);
}

.t-card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 24px 28px;
  transition: border-color .18s ease, transform .18s ease;
}

.t-card:hover {
  border-color: var(--ink);
  transform: translateX(2px);
}

.t-date {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--amber);
  margin-bottom: 10px;
}

.t-card h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 4px;
}

.t-card h4 {
  font-family: var(--body);
  font-weight: 500;
  font-size: 14.5px;
  color: var(--soft);
  margin-bottom: 12px;
}

.t-card p {
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.65;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag-pill {
  padding: 5px 11px;
  background: var(--bone);
  border: 1px solid var(--rule);
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

/* =====================================================
   Experience cards
   ===================================================== */

.xp-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.xp {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 32px 36px;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.xp:hover {
  border-color: var(--ink);
  box-shadow: 0 8px 30px -12px rgba(0, 0, 0, 0.12);
}

.xp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule-2);
  flex-wrap: wrap;
}

.xp-head h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 4px;
}

.xp-head h4 {
  font-family: var(--body);
  font-weight: 600;
  font-size: 15px;
  color: var(--amber-2);
}

.xp-date {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--soft);
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 100px;
  background: var(--bone);
  white-space: nowrap;
}

.xp-list {
  list-style: none;
}

.xp-list li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 10px;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.65;
}

.xp-list li:last-child { margin-bottom: 0; }

.xp-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  width: 11px;
  height: 1.6px;
  background: var(--amber);
}

/* =====================================================
   Publications
   ===================================================== */

.pubs {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: 18px;
  overflow: hidden;
  background: var(--panel);
}

.pub {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 24px;
  padding: 28px 32px;
  border-bottom: 1px solid var(--rule-2);
  transition: background .15s ease;
}

.pub:last-child { border-bottom: none; }

.pub:hover { background: var(--bone); }

.pub-year {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--amber);
  line-height: 1;
  padding-top: 4px;
}

.pub-body h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 6px;
}

.pub-meta {
  font-size: 13.5px;
  color: var(--soft);
  margin-bottom: 8px;
}

.pub-meta .venue {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
}

.pub-body p {
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.pub-links {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1px solid var(--rule);
  border-radius: 100px;
  background: var(--panel);
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--ink);
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.link-btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  transform: translateY(-1px);
}

.link-btn .lb-num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--amber);
}

.link-btn:hover .lb-num { color: var(--amber); }

/* =====================================================
   Contact
   ===================================================== */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--panel);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.contact-card:hover {
  border-color: var(--ink);
  background: var(--bone);
  transform: translateX(4px);
}

.cc-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bone);
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Icon glyphs (pure CSS, no font-awesome) */
.cc-icon i {
  display: block;
  width: 22px;
  height: 22px;
  background-color: var(--ink);
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-size: contain;
          mask-size: contain;
}

.ic-linkedin {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14zM8.34 18V9.83H5.67V18h2.67zm-1.34-9.4a1.55 1.55 0 1 0 0-3.1 1.55 1.55 0 0 0 0 3.1zM18.34 18v-4.47c0-2.4-1.28-3.52-2.99-3.52-1.38 0-1.99.76-2.34 1.3V9.83h-2.67c.04.75 0 8.17 0 8.17h2.67v-4.56c0-.24.02-.48.09-.65.19-.48.63-.97 1.36-.97.96 0 1.34.73 1.34 1.79V18h2.54z'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14zM8.34 18V9.83H5.67V18h2.67zm-1.34-9.4a1.55 1.55 0 1 0 0-3.1 1.55 1.55 0 0 0 0 3.1zM18.34 18v-4.47c0-2.4-1.28-3.52-2.99-3.52-1.38 0-1.99.76-2.34 1.3V9.83h-2.67c.04.75 0 8.17 0 8.17h2.67v-4.56c0-.24.02-.48.09-.65.19-.48.63-.97 1.36-.97.96 0 1.34.73 1.34 1.79V18h2.54z'/></svg>");
}

.ic-scholar {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2L1 9l11 7 9-5.74V17h2V9zM2.49 14v3.77c0 .94.55 1.81 1.4 2.22C5.6 20.74 8.36 22 12 22s6.4-1.26 8.11-1.99c.85-.41 1.4-1.28 1.4-2.22V14L12 19z'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2L1 9l11 7 9-5.74V17h2V9zM2.49 14v3.77c0 .94.55 1.81 1.4 2.22C5.6 20.74 8.36 22 12 22s6.4-1.26 8.11-1.99c.85-.41 1.4-1.28 1.4-2.22V14L12 19z'/></svg>");
}

.ic-dblp {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2C6.48 2 2 4.02 2 6.5v11C2 19.98 6.48 22 12 22s10-2.02 10-4.5v-11C22 4.02 17.52 2 12 2zm0 2c4.42 0 8 1.34 8 3s-3.58 3-8 3-8-1.34-8-3 3.58-3 8-3zm-8 5.04c1.87 1.21 4.7 2 8 2s6.13-.79 8-2v3.42c-1.87 1.21-4.7 2-8 2s-6.13-.79-8-2zm0 5.5c1.87 1.21 4.7 2 8 2s6.13-.79 8-2v3c-1.87 1.21-4.7 2-8 2s-6.13-.79-8-2z'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2C6.48 2 2 4.02 2 6.5v11C2 19.98 6.48 22 12 22s10-2.02 10-4.5v-11C22 4.02 17.52 2 12 2zm0 2c4.42 0 8 1.34 8 3s-3.58 3-8 3-8-1.34-8-3 3.58-3 8-3zm-8 5.04c1.87 1.21 4.7 2 8 2s6.13-.79 8-2v3.42c-1.87 1.21-4.7 2-8 2s-6.13-.79-8-2zm0 5.5c1.87 1.21 4.7 2 8 2s6.13-.79 8-2v3c-1.87 1.21-4.7 2-8 2s-6.13-.79-8-2z'/></svg>");
}

.ic-code {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0l4.6-4.6L14.6 7.4 16 6l6 6-6 6z'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0l4.6-4.6L14.6 7.4 16 6l6 6-6 6z'/></svg>");
}

.cc-text { flex: 1; min-width: 0; }

.cc-text h4 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 2px;
}

.cc-text p {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--soft);
}

.cc-arrow {
  font-family: var(--display);
  font-size: 18px;
  color: var(--faint);
  transition: color .15s ease, transform .15s ease;
}

.contact-card:hover .cc-arrow {
  color: var(--amber);
  transform: translate(2px, -2px);
}

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

.footer {
  padding: 48px 0;
  background: var(--paper);
  border-top: 1px solid var(--rule);
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.footer-brand svg { border-radius: 9px; }

.footer-lock {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lock-name {
  font-family: var(--wordmark);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
}

.lock-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--soft);
}

.footer-meta {
  display: flex;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--soft);
  letter-spacing: 0.02em;
}

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

@media (max-width: 768px) {
  .wrap { padding: 0 22px; }

  .nav-row { height: 60px; }
  .nav-toggle { display: flex; }
  /* Drawer is GONE from layout when closed — no transform games.
     Earlier code used position:absolute + transform:translateY(-110%)
     to hide it. On iOS WebKit the parent's containing-block resolution
     left the drawer parked over the brand row. Using display:none
     when closed sidesteps the bug entirely. */
  .nav-menu {
    display: none;
  }
  .nav-menu.open {
    display: flex;
    position: fixed;
    top: 61px; /* nav-row 60px + 1px border-bottom */
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 4px;
    padding: 16px 22px 28px;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.12);
    z-index: 99;
  }
  .nav-link { padding: 12px 14px; font-size: 16px; }

  .cover { padding: 56px 0 64px; }
  .cover-meta { grid-template-columns: repeat(2, 1fr); }
  .meta-cell:nth-child(2) { border-right: none; }
  .meta-cell:nth-child(1), .meta-cell:nth-child(2) { border-bottom: 1px solid var(--rule); }

  .index { grid-template-columns: 1fr 1fr; }
  .index a:nth-child(1), .index a:nth-child(2) { border-bottom: 1px solid var(--rule); }
  .index a:nth-child(2) { border-right: none; }
  .index a:nth-child(4) { border-right: none; }

  section[id] { padding: 72px 0; }

  .xp { padding: 24px 22px; }
  .xp-head { gap: 14px; }
  .xp-head h3 { font-size: 20px; }

  .pub {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 22px 22px;
  }
  .pub-year { padding-top: 0; }

  .contact-grid { grid-template-columns: 1fr; }

  .footer-row { flex-direction: column; align-items: flex-start; gap: 18px; }
}

@media (max-width: 480px) {
  .cover-meta { grid-template-columns: 1fr; }
  .meta-cell { border-right: none; border-bottom: 1px solid var(--rule); }
  .meta-cell:last-child { border-bottom: none; }

  .index { grid-template-columns: 1fr; }
  .index a { border-right: none; border-bottom: 1px solid var(--rule); }
  .index a:last-child { border-bottom: none; }

  .sec-head { gap: 10px; }
  .sec-kind { display: none; }
}

/* =====================================================
   Motion (subtle reveals)
   ===================================================== */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .6s ease, transform .6s ease;
  }
  .reveal.in {
    opacity: 1;
    transform: translateY(0);
  }
}

@media print {
  .nav, .nav-toggle, .footer { display: none; }
  section[id] { page-break-inside: avoid; padding: 24px 0; }
  body { background: white; }
}
