/* =========================================================
   Ryan Surya — Portfolio
   ========================================================= */

:root {
  --bg: #f6f1e6;
  --ink: #201c17;
  --ink-soft: #55504a;
  --ink-faint: #6d6553;
  --rule: #ddd2b8;

  --accent: #a8441f;
  --accent-strong: #7a2f14;
  --accent-ink: #fdf8ef;

  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --sidebar-width: 280px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #18150f;
    --ink: #f1ece0;
    --ink-soft: #bcb2a0;
    --ink-faint: #968d78;
    --rule: #3a3324;

    --accent: #e2793f;
    --accent-strong: #f0a86e;
    --accent-ink: #1c1108;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #18150f;
  --ink: #f1ece0;
  --ink-soft: #bcb2a0;
  --ink-faint: #968d78;
  --rule: #3a3324;

  --accent: #e2793f;
  --accent-strong: #f0a86e;
  --accent-ink: #1c1108;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition-duration: 0.001ms !important;
  }
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 6px 0;
  z-index: 200;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
}

a {
  color: inherit;
}

main a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

main a:hover {
  color: var(--accent-strong);
  text-decoration-color: var(--accent-strong);
}

ul, ol {
  margin: 0;
  padding: 0;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--ink);
}

p {
  margin: 0 0 1.1em;
}

/* ---------- Sidebar ---------- */

.layout {
  display: flex;
  align-items: flex-start;
  max-width: calc(var(--sidebar-width) + 700px);
  margin: 0 auto;
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
}

.sidebar {
  position: sticky;
  top: 0;
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  padding: 3rem 2rem;
  background: color-mix(in srgb, var(--ink) 3%, var(--bg));
  border-right: 1px solid var(--rule);
  z-index: 100;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.sidebar-top {
  position: relative;
  margin-bottom: 2.5rem;
}

.sidebar-name {
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
}

.sidebar-name a {
  color: inherit;
  text-decoration: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 2rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.nav-link svg {
  flex-shrink: 0;
  opacity: 0.65;
  transition: opacity 0.15s ease;
}

.nav-link:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}

.nav-link:hover svg {
  opacity: 0.9;
}

.nav-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.nav-link.active svg {
  opacity: 1;
}

.sidebar-social {
  display: flex;
  justify-content: flex-start;
  gap: 0.6rem;
  margin-top: auto;
}

.theme-toggle {
  margin-left: auto;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule);
  background: transparent;
  border-radius: 6px;
  color: var(--ink-soft);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.icon-sun {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: block;
}
[data-theme="dark"] .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .icon-sun {
    display: block;
  }
  html:not([data-theme]) .icon-moon {
    display: none;
  }
}

.nav-toggle {
  display: none;
}

/* ---------- Main column ---------- */

main {
  flex: 1;
  min-width: 0;
  background: var(--bg);
}

.content {
  max-width: 700px;
  margin: 0 auto;
  padding: 3rem 2.5rem;
}

section {
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 2rem;
}

section:first-child {
  padding-top: 0;
}

section:last-of-type {
  border-bottom: none;
}

.section-label {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.lead {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
}

section p {
  color: var(--ink-soft);
}

section .lead {
  color: var(--ink);
}

.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 0;
}

/* ---------- About ---------- */

.facts {
  margin: 2rem 0 0;
}

.facts-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1.5rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule);
}

.facts-row:last-child {
  padding-bottom: 0;
}

.facts dt {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-faint);
}

.facts dd {
  margin: 0;
  color: var(--ink-soft);
}

/* ---------- Experience timeline ---------- */

.timeline {
  list-style: none;
  margin-left: 4px;
}

.timeline-entry {
  position: relative;
  left: -10px;
  margin-left: 10px;
  border-left: 1px solid var(--rule);
  padding: 0 0 2.25rem 1.5rem;
}

.timeline-entry:last-child {
  padding-bottom: 1rem;
}

.timeline-entry::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  transition: transform 0.15s ease, border-color 0.15s ease;
  z-index: 1;
}

.timeline-entry:hover::before {
  transform: scale(1.25);
  border-color: var(--accent-strong);
}

.timeline-entry-head {
  margin-bottom: 1rem;
}

.timeline-entry-head h3 {
  transition: color 0.15s ease;
  font-size: 1.25rem;
  line-height: 1.2;
  margin-bottom: 0.3rem;
}

.timeline-entry:hover .timeline-entry-head h3 {
  color: var(--accent);
}

.timeline-entry-company {
  margin: 0 0 0.3rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.timeline-entry-product {
  color: var(--ink-faint);
  font-weight: 400;
}

.timeline-entry-date {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.timeline-entry-bullets {
  padding-left: 1.2rem;
}

.timeline-entry-bullets li {
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}

.timeline-entry-bullets li::marker {
  color: var(--accent);
}

.timeline-entry-bullets li:last-child {
  margin-bottom: 0;
}

/* ---------- Skills ---------- */

.skills-list {
  margin: 0;
}

.skills-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule);
}

.skills-row:last-child {
  padding-bottom: 0;
}

.skills-list dt {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.skills-list dd {
  margin: 0;
  color: var(--ink-soft);
}

/* ---------- Projects ---------- */

.project {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.75rem;
  transition: border-color 0.15s ease;
}

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

.project-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.project-head h3 {
  font-size: 1.3rem;
}

.project-status {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  white-space: nowrap;
}

.project-tech {
  font-size: 0.92rem;
  color: var(--ink-faint);
}

.project-links {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0;
}

.project-links a {
  font-weight: 500;
  font-size: 0.95rem;
}

.project-more {
  margin: 1.5rem 0 0;
  color: var(--ink-faint);
  font-size: 0.92rem;
  font-style: italic;
}

/* ---------- Contact ---------- */

.contact-methods {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.contact-method {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  transition: border-color 0.15s ease;
}

.contact-method:hover {
  border-color: var(--accent);
}

.contact-method--primary {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.contact-method-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.contact-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.contact-method-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.contact-method-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.contact-method-value {
  font-size: 1rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 2rem 0 3.5rem;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0;
}

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

@media (max-width: 720px) {
  .facts-row,
  .skills-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}

@media (max-width: 860px) {
  .layout {
    display: block;
    max-width: 100%;
    border-left: none;
    border-right: none;
  }

  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    overflow-y: visible;
    padding: 1rem 1.25rem;
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }

  .sidebar-inner {
    min-height: auto;
  }

  .sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0;
  }

  .sidebar-identity {
    min-width: 0;
  }

  .sidebar-name {
    margin-bottom: 0.15rem;
  }

  .sidebar-nav,
  .sidebar-social {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .sidebar.nav-open {
    position: fixed;
    inset: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 1.25rem 1.5rem 2rem;
  }

  .sidebar.nav-open .sidebar-inner {
    min-height: 100%;
  }

  .sidebar.nav-open .sidebar-nav,
  .sidebar.nav-open .sidebar-social {
    display: flex;
  }

  .sidebar.nav-open .sidebar-nav {
    margin-top: 2rem;
  }

  .content {
    max-width: 100%;
    padding: 2rem 1.25rem;
  }

  section {
    padding: 1.25rem 0;
  }

  section:first-child {
    padding-top: 1.25rem;
  }

  .contact-method {
    flex-wrap: wrap;
  }

  .contact-method-value {
    white-space: normal;
    word-break: break-word;
  }

  .project-head {
    flex-direction: column;
    gap: 0.3rem;
  }

  .project-links {
    flex-direction: column;
    gap: 0.6rem;
  }
}

/* =========================================================
   Focus, selection, print
   ========================================================= */

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

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

@media print {
  .sidebar,
  .skip-link,
  .copy-btn {
    display: none;
  }

  .layout {
    display: block;
    max-width: 100%;
    border-left: none;
    border-right: none;
  }

  .content {
    max-width: 100%;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }

  section {
    border-bottom: none;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .timeline-entry {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  main a {
    color: #000;
    text-decoration: underline;
  }
}
