/* Project-specific overrides on top of the original beshleyua template CSS. */

/* ---- Design tokens: single source of truth for the brand palette (Phase 3 foundation) ----
   Same values as before, so zero visual change. Future Tailwind @theme and the per-section
   migration reference these instead of hex literals scattered across the stylesheet. */
:root {
  --bg: #17171b;        /* page background */
  --surface: #31343a;   /* card surface */
  --accent: #ff9800;    /* brand accent (orange) */
  --brand: #2eca7f;     /* brand green */
}

/* Card-slide animation (replaces the 82KB animate.css — only these 3 classes were used). */
.animated { animation-duration: 0.8s; animation-fill-mode: both; }
@keyframes fadeInLeft { from { opacity: 0; transform: translate3d(-40px, 0, 0); } to { opacity: 1; transform: none; } }
.fadeInLeft { animation-name: fadeInLeft; }
@keyframes fadeOutLeft { from { opacity: 1; } to { opacity: 0; transform: translate3d(-40px, 0, 0); } }
.fadeOutLeft { animation-name: fadeOutLeft; }

html, body { height: 100%; margin: 0; }
/* Match the live site: dark background (from the shipped dark.css gradient
   #17171b -> #28282f). Body fallback stays dark to avoid any flash. */
body { background: var(--bg); }

/* ===================== Accessibility, semantics & responsiveness ===================== */

/* Screen-reader-only (visually hidden but announced) */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* Skip-to-content link (first focusable element) */
.skip-link {
  position: fixed; top: -70px; left: 10px; z-index: 2000;
  background: var(--accent); color: #171717; padding: 10px 16px; border-radius: 4px;
  font-weight: 600; font-size: 13px; transition: top .2s ease;
}
.skip-link:focus { top: 10px; }

/* Visible keyboard focus (does not affect mouse users) */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Real headings reuse the template's visual classes — keep the exact look */
h1.title, h2.title, h3.name, h4.name, h3.pj-title, h1, h2, h3, h4 { font-weight: inherit; }
.card-started .profile h1.title { font-size: 32px; line-height: 32px; font-weight: 400; margin: 0 0 10px; color: rgba(255,255,255,.85); }
.content h2.title { font-weight: 500; }
.resume-title h3.name, .skill-title h3.name { margin: 0 0 0 40px; }
.resume-items .resume-item h4.name { margin: 0; }
.service-item h3.name { margin: 0 0 12px; }

/* Buttons that reuse .lnk / .button styling — strip native chrome */
button.lnk, button.button, button.discover {
  -webkit-appearance: none; appearance: none;
  background: transparent; border: none; font: inherit; cursor: pointer;
  color: rgba(255,255,255,.85);
}

/* Contrast: lift the low-contrast greys on the dark cards to meet WCAG AA */
body { color: #aeb2bb; }
.skills-list ul li .name { color: #c9ccd4; }
.resume-items .resume-item .company { color: #a7abb4; }
.service-item, .service-item li, .text-box, .text-box p, .pj-summary, .tile-ex { color: #b7bbc4; }

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .bg-bubbles li { display: none; }
  .typing-title::after { animation: none; }
  html { scroll-behavior: auto; }
}

/* Never allow horizontal overflow (mobile clipping fix) */
html, body { overflow-x: hidden; max-width: 100%; }

/* Profile photo via next/image sits under the angled wedges */
.card-started .profile .slide .slide-photo { z-index: 0 !important; }
.card-started .profile .slide:before, .card-started .profile .slide:after { z-index: 1; }

/* Blog teaser tiles are built from spans — make them block-level */
.post-tile-wrap { display: block; }
.post-tile .cover { position: relative; display: block; overflow: hidden; }
.post-tile .tile-body, .post-tile .tile-title, .post-tile .tile-ex, .post-tile time.tpl-date { display: block; }

/* Project tech-stack tags are a list */
.pj-tags { list-style: none; padding: 0; }
.pj-tag { display: inline-block; }

/* Service bullet list (replaces the old inline-styled <ul>) */
.service-bullets { margin: 0; padding-left: 18px; list-style: disc; text-align: left; }
.service-bullets li { margin-bottom: 7px; line-height: 1.6; }
.service-bullets li strong { color: rgba(255,255,255,.85); font-weight: 600; }

/* Footer landmark — subtle, out of the way of the card app */
.site-footer {
  position: fixed; bottom: 8px; left: 0; width: 100%;
  text-align: center; font-size: 11px; color: rgba(255,255,255,.72); z-index: 3;
  pointer-events: none;
}
.site-footer a { pointer-events: auto; color: rgba(255,255,255,.9); }
@media (max-width: 1023px) { .site-footer { position: static; margin: 26px 0 14px; } }

/* Static footer for content pages (blog / 404) */
.tpl-footer { position: relative; z-index: 2; text-align: center; padding: 30px 16px 40px; font-size: 12px; color: rgba(255,255,255,.72); }
.tpl-footer a { color: rgba(255,255,255,.9); }

/* ---- Responsive: eliminate mobile overflow / clipping (≤1023px) ---- */
@media (max-width: 1023px) {
  /* Menu must fill the viewport so the 5 items shrink to fit instead of overflowing */
  .header .top-menu { width: 100% !important; max-width: 100% !important; }
  .header .top-menu ul li a { height: 60px; }
  .header .top-menu ul li a .icon { font-size: 17px; margin: -22px 0 0 -16px; }
  .header .top-menu ul li a .link { font-size: 8px !important; letter-spacing: 0; }

  .container { max-width: 100% !important; width: 100% !important; padding: 0 8px; }
  .card-started .profile { padding-left: 24px !important; padding-right: 24px !important; }
  /* Name uses h1.title (higher specificity) — target it and force the smaller size */
  .card-started .profile h1.title { font-size: 24px !important; line-height: 1.2 !important; overflow-wrap: anywhere; }
  .card-inner .card-wrap { padding: 26px 20px; }

  /* The template grid uses `.row { margin: 0 -20px }` (negative margins) which
     overflows narrow screens. Neutralise the gutter on stacked mobile columns. */
  .row { margin-left: 0 !important; margin-right: 0 !important; }
  .row .col { padding-left: 0 !important; padding-right: 0 !important; }
  .projects-grid, .posts-grid, .grid-2, .grid-4 { grid-template-columns: 1fr; }
  img, iframe, .map-frame { max-width: 100%; }
}

@media (max-width: 430px) {
  .card-started .profile h1.title { font-size: 22px !important; }
  .card-inner .card-wrap { padding: 24px 16px; }
}

/* ---- P1: "What I do" is one column on phones ----
   Template columns are inline-block at 50% (col-t-6) up to 1023px and only stack at
   ≤560px (col-m-12). That left cramped 2-up cards on 561–640px phones. Force full width
   below 640px; md+ keeps the 2-column layout. */
@media (max-width: 640px) {
  .services .service-items > .col { width: 100% !important; }
  .services .service-item { padding-bottom: 6px; }
}

/* ---- P1: keep anchored section tops clear of the fixed 72px mobile nav ----
   PortfolioScripts scrolls the chosen section into view; this margin stops the sticky
   top bar from covering its heading. */
@media (max-width: 1023px) {
  .card-inner { scroll-margin-top: 84px; }
}

/* ---- P3: clean section swap (no ghosting) ----
   The incoming card fades in; outgoing cards must vanish instantly so the previous
   section never shows through the semi-transparent fade. */
.card-inner.hidden { transition: none; }

/* ---- P4: contact-form honeypot stays in the DOM but invisible to humans ----
   Bots fill it and the API rejects the submission. Markup already has aria-hidden,
   tabindex=-1 and autocomplete=off; this moves it off-screen (not display:none, which
   some bots skip). */
.honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* ---- P4: branded fallback cover for posts with no image (replaces the empty grey box) ---- */
.post-tile .cover-fallback {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2a2a32 0%, #1c1c22 100%);
}
.post-tile .cover-fallback .cover-mark {
  font-weight: 700; font-size: 30px; letter-spacing: 3px;
  color: rgba(255, 152, 0, 0.9);
}

/* The original used jQuery slimScroll to make the content card scroll inside its
   fixed 570px height. Replace it with a native (thin) scrollbar — same behaviour. */
.card-inner .card-wrap {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}
.card-inner .card-wrap::-webkit-scrollbar { width: 6px; }
.card-inner .card-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }
@media (max-width: 1023px) {
  .card-inner .card-wrap { overflow: visible; height: auto; }
}

/* Typed subtitle cursor (from the original inline styles). */
.typing-title::after {
  content: '|';
  display: inline;
  animation: tblink 0.7s infinite;
}
@keyframes tblink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* Experience link row */
.resume-item .ex-link { margin-top: 8px; display: inline-block; }

/* ---- Standalone blog pages (list + post), styled to match the template ---- */
.tpl-page { position: relative; z-index: 2; min-height: 100%; padding: 70px 16px 60px; }
.tpl-wrap { max-width: 760px; margin: 0 auto; }
.tpl-card {
  background: #31343a;
  border-radius: 4px;
  box-shadow: 10px 10px 30px rgba(0,0,0,0.15);
  padding: 40px 48px;
}
@media (max-width: 560px) { .tpl-card { padding: 28px 22px; } }
.tpl-back { display: inline-block; margin-bottom: 16px; color: rgba(255,255,255,.85); font-size: 13px; }
.tpl-back:hover { color: var(--accent); }
.tpl-card h1 { color: rgba(255,255,255,.85); font-size: 26px; line-height: 1.3; margin: 0 0 12px; font-weight: 500; }
.tpl-card .post-body { color: #999; line-height: 1.85; }
.tpl-card .post-body p { margin: 0 0 16px; }
.tpl-card .post-body a { color: var(--accent); text-decoration: underline; }
.tpl-date { color: var(--accent); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }

/* Blog teaser cards inside the home Blog tab + the list grid */
.posts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
@media (max-width: 700px) { .posts-grid { grid-template-columns: 1fr; } }
.post-tile {
  display: block;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(197,202,213,0.14);
  border-radius: 4px;
  overflow: hidden;
  transition: transform .25s ease, border-color .25s ease;
}
.post-tile:hover { transform: translateY(-3px); border-color: rgba(255,152,0,0.5); }
.post-tile .cover { aspect-ratio: 16/9; background: #2a2a32; background-size: cover; background-position: center; }
.post-tile .tile-body { padding: 16px 18px; }
.post-tile .tile-title { color: rgba(255,255,255,.85); font-weight: 600; font-size: 15px; margin: 6px 0 8px; }
.post-tile .tile-ex { color: #999; line-height: 1.6; font-size: 13px; }

/* ---- Projects section ---- */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 700px) { .projects-grid { grid-template-columns: 1fr; } }
.project-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(197,202,213,0.14);
  border-radius: 4px;
  padding: 20px;
  transition: transform .25s ease, border-color .25s ease;
}
.project-card:hover { transform: translateY(-3px); border-color: rgba(255,152,0,0.5); }
.project-card .pj-head { display: flex; align-items: center; justify-content: space-between; }
.project-card .pj-icon { font-size: 26px; color: var(--brand); }
.project-card .pj-cat { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 600; }
.project-card .pj-title { color: rgba(255,255,255,.9); font-weight: 600; font-size: 15px; margin: 12px 0 2px; }
.project-card .pj-role { color: #8a8d96; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.project-card .pj-summary { color: #999; line-height: 1.6; font-size: 13px; margin: 6px 0 0; }
.project-card .pj-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.project-card .pj-tag { font-size: 11px; padding: 3px 9px; border-radius: 3px; background: rgba(46,202,127,0.12); color: #9fe3c2; }
.project-card .pj-links { margin-top: 12px; }
.project-card .pj-links a { color: rgba(255,255,255,.85); font-size: 12px; font-weight: 600; margin-right: 14px; }
.project-card .pj-links a:hover { color: var(--accent); }
.project-card .pj-details { margin-top: 12px; }
.project-card .pj-details-toggle { cursor: pointer; list-style: none; color: var(--accent); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; }
.project-card .pj-details-toggle::-webkit-details-marker { display: none; }
.project-card .pj-details-toggle::after { content: "＋"; margin-left: 6px; font-weight: 400; }
.project-card .pj-details[open] .pj-details-toggle::after { content: "－"; }
.project-card .pj-desc { color: #999; line-height: 1.7; font-size: 13px; margin-top: 10px; }
.project-card .pj-desc p { margin: 0 0 8px; }

/* Contact form success alert (hidden until submit) */
.alert-success { display: none; margin-top: 16px; color: var(--brand); font-weight: 500; }
.contact_form.sent #cform { display: none; }
.contact_form.sent .alert-success { display: block; }
.cform-error { color: #ff6b6b; margin-top: 12px; }
