/* ============ THEME TOKENS ============ */
:root {
  --page: #ececec;
  --sheet: #ffffff;
  --text: #363636;
  --muted: #7a7a7a;
  --accent: #ec7263;       /* headings, links, timeline */
  --accent-strong: #f0563d;/* skill bars, name */
  --accent-alt: #a75265;   /* tags / hobbies */
  --panel: #f1f1f1;        /* timeline cards, project cards */
  --border: #dddddd;
  --track: #e4e4e4;        /* empty skill bar */
  --star-off: #d0d0d0;
  --empty-doc: #e6e6e6;
  --empty-doc-text: #9a9a9a;
  --shadow: 0 2px 14px rgba(0, 0, 0, .06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #121315;
    --sheet: #1c1d21;
    --text: #e3e3e6;
    --muted: #9a9ba3;
    --accent: #f08778;
    --accent-strong: #f26a53;
    --accent-alt: #b5647a;
    --panel: #26272c;
    --border: #34353b;
    --track: #2e2f35;
    --star-off: #45464d;
    --empty-doc: #2a2b30;
    --empty-doc-text: #7b7c84;
    --shadow: 0 2px 18px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --page: #121315;
  --sheet: #1c1d21;
  --text: #e3e3e6;
  --muted: #9a9ba3;
  --accent: #f08778;
  --accent-strong: #f26a53;
  --accent-alt: #b5647a;
  --panel: #26272c;
  --border: #34353b;
  --track: #2e2f35;
  --star-off: #45464d;
  --empty-doc: #2a2b30;
  --empty-doc-text: #7b7c84;
  --shadow: 0 2px 18px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* ============ BASE ============ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--page);
  transition: background-color .25s, color .25s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

ul { margin: 0; padding: 0; list-style: none; }

/* ============ SHEET ============ */
.sheet {
  max-width: 1140px;
  margin: calc(var(--photo-size, 160px) / 2 + 15px) auto 24px;
  padding: 0 32px 24px;
  background: var(--sheet);
  box-shadow: var(--shadow);
  transition: background-color .25s;
}

/* ============ HEADER ============ */
.header {
  text-align: center;
  padding-bottom: 18px;
  border-bottom: 3px dashed var(--border);
}

.photo {
  position: relative;
  width: var(--photo-size, 160px);
  height: var(--photo-size, 160px);
  margin: calc(var(--photo-size, 160px) / -2) auto 10px;
  padding: 5px;
  border-radius: 50%;
  background: var(--page);
}
.photo-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}
.photo img,
.photo .initials {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.photo img {
  object-fit: cover;
  transform: scale(var(--photo-zoom, 1));
  transform-origin: var(--photo-x, 50%) var(--photo-y, 50%);
}
.photo .initials {
  width: 150px;
  height: 150px;
  border-radius: 50%;
}
.photo img {
  position: absolute;
  inset: 5px;
  object-fit: cover;
  z-index: 1;
}
.photo-frame:has(img) .initials { display: none; }
.photo .initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-alt));
  color: #fff;
  font-size: calc(var(--photo-size, 160px) * .33);
  font-weight: 800;
  letter-spacing: -2px;
}

.header h1 {
  margin: 6px 0 0;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: -1px;
}
.header h1 .hello {
  display: block;
  font-size: 1.55em;
  font-weight: 800;
  letter-spacing: -3px;
}
.header h1 em {
  font-style: normal;
  color: var(--accent-strong);
}
.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 600;
}

/* ============ LAYOUT ============ */
.columns {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 40px;
}

/* ============ BOXES ============ */
.box { margin-top: 26px; }

.box h2 {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 1.7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.box h2::before { content: '//'; margin-right: 6px; }

.box > p {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.65;
}

/* ============ EDUCATION TIMELINE ============ */
.timeline { position: relative; padding: 6px 0; }
.timeline::before {
  content: '';
  position: absolute;
  left: 26px;
  top: 0;
  bottom: 0;
  width: 5px;
  border-radius: 3px;
  background: linear-gradient(to bottom, transparent 0%, var(--accent) 7%, var(--accent) 90%, transparent 100%);
}
.timeline li {
  position: relative;
  display: flex;
  gap: 22px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.timeline .year {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 6px 0;
  background: var(--sheet);
  font-size: 1.3rem;
  font-weight: 700;
  transition: background-color .25s;
}
.timeline .entry {
  position: relative;
  flex: 1;
  padding: 12px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.timeline .entry::before {
  content: '';
  position: absolute;
  top: 14px;
  left: -16px;
  border: 8px solid transparent;
  border-right-color: var(--panel);
}
.timeline h3 { margin: 0; font-size: 1.25rem; font-weight: 700; line-height: 1.3; }
.timeline p { margin: 4px 0 0; font-size: 1.02rem; }
.timeline .meta { color: var(--muted); font-size: .93rem; }

/* Documents under Metropolia */
.docs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.doc {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--sheet);
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color .2s, transform .2s;
}
a.doc:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.doc-icon {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.doc-text { display: flex; flex-direction: column; min-width: 0; }
.doc-title { font-weight: 700; }
.doc-sub { font-size: .82rem; color: var(--muted); line-height: 1.35; }

.doc-empty {
  background: var(--empty-doc);
  border-style: dashed;
  color: var(--empty-doc-text);
  cursor: default;
}
.doc-empty .doc-icon { stroke: var(--empty-doc-text); }
.doc-empty .doc-sub { color: var(--empty-doc-text); font-style: italic; }

/* ============ EXPERIENCE ============ */
.job {
  display: grid;
  grid-template-columns: 26% 1fr;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.job:last-child { border-bottom: 0; margin-bottom: 0; }
.where { font-size: 1.1rem; font-weight: 700; line-height: 1.3; }
.when { color: var(--muted); font-size: 1rem; }
.role { font-size: 1.25rem; font-weight: 700; line-height: 1.3; }
.place { color: var(--muted); font-size: .93rem; margin-bottom: 4px; }
.job ul { list-style: disc; padding-left: 20px; }
.job li { margin: 3px 0; }

/* ============ PROJECTS ============ */
.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.project {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  background: var(--panel);
  border-top: 4px solid var(--accent);
  border-radius: 0 0 6px 6px;
  transition: transform .2s, box-shadow .2s;
}
.project:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.project-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.project h3 { margin: 0; font-size: 1.08rem; line-height: 1.3; }
.project-date { flex: 0 0 auto; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.project-org { margin: 2px 0 8px; color: var(--accent); font-size: .88rem; font-weight: 600; }
.project p { margin-top: 0; }
.project > p:not(.project-org) { flex: 1; font-size: .95rem; margin-bottom: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tags li {
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--accent-alt);
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
}
.project-award {
  margin: -4px 0 10px;
  font-size: .9rem;
  font-weight: 700;
  color: var(--accent-strong);
}
.project-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.project-links a {
  padding: 4px 11px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  transition: background-color .2s, color .2s;
}
.project-links a::after { content: ' ↗'; }
.project-links a:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* ============ CONTACT ============ */
.contacts li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.contacts li:last-child { border-bottom: 0; }
.contacts svg {
  /* every icon sits in the same 32px slot, centred */
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 1px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .6;
}
.contacts svg.brand {
  padding: 5px;          /* logos fill their box, so shrink them to match the outline icons */
  stroke: none;
  opacity: 1;
  border-radius: 4px;
}
.contacts svg.brand-gh { fill: var(--text); }
.contacts div { display: flex; flex-direction: column; min-width: 0; font-size: 1.05rem; }
.contacts strong { font-size: 1.1rem; }
.contacts span, .contacts a { overflow-wrap: anywhere; }
.contacts span { color: var(--muted); }

/* ============ SKILLS ============ */
.skill-group { margin-bottom: 14px; }
.skill-group:last-child { margin-bottom: 0; }
.skill-group h3 {
  margin: 0 0 7px;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.bricks { display: flex; flex-wrap: wrap; gap: 6px; }
.bricks li {
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--accent-strong);
  color: #fff;
  font-size: .92rem;
  font-weight: 600;
  transition: transform .15s, background-color .15s;
}
.bricks li:hover { transform: translateY(-2px); }

/* ============ LANGUAGES ============ */
.languages li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 1.1rem;
}
.languages li:last-child { border-bottom: 0; }
.stars { display: inline-flex; gap: 3px; }
.stars .star { position: relative; display: inline-block; width: 18px; height: 18px; }
.stars svg { position: absolute; inset: 0; width: 18px; height: 18px; fill: var(--star-off); }
.stars svg.on { fill: var(--accent-strong); }

/* ============ ACHIEVEMENTS ============ */
.achievements li {
  display: flex;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.achievements li:last-child { border-bottom: 0; }
.ach-year { flex: 0 0 auto; color: var(--accent); font-weight: 700; }

/* ============ HOBBIES ============ */
.hobbies { display: flex; flex-wrap: wrap; gap: 6px; }
.hobbies span {
  padding: 5px 10px 5px 26px;
  background: var(--accent-alt);
  color: #fff;
  font-size: 1rem;
  position: relative;
}
.hobbies span::before {
  content: '♥';
  position: absolute;
  left: 9px;
  top: 5px;
}

/* ============ FOOTER ============ */
.footer {
  margin-top: 30px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
}

/* ============ THEME TOGGLE ============ */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--sheet);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background-color .25s, transform .2s;
}
.theme-toggle:hover { transform: rotate(-15deg); }
.theme-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .columns { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 640px) {
  .sheet { padding: 0 16px 16px; }
  .header h1 { font-size: 1.5rem; }
  .box h2 { font-size: 1.4rem; }
  .projects, .docs { grid-template-columns: 1fr; }
  .job { grid-template-columns: 1fr; gap: 4px; }
  .timeline::before { left: 20px; }
  .timeline li { gap: 18px; }
  .timeline .year { font-size: 1.05rem; }
  .theme-toggle { top: 10px; right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
