:root {
  --bg: #f5f5f6;
  --ink: #2a2a2e;
  --dim: #9a9aa2;
  --link: #55555c;
  --underline: #c9c9cf;
  --card: #ffffff;
  --card-border: #ececef;
  --field: #fafafb;
  --field-border: #e6e6ea;
  --placeholder: #a2a2aa;
  --btn: #2a2a2e;
  --btn-hover: #47474e;
  --btn-text: #f5f5f6;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1b1e;
    --ink: #e6e6ea;
    --dim: #8a8a92;
    --link: #b8b8c0;
    --underline: #47474e;
    --card: #242428;
    --card-border: #313136;
    --field: #2a2a2f;
    --field-border: #3a3a40;
    --placeholder: #77777f;
    --btn: #e6e6ea;
    --btn-hover: #c9c9cf;
    --btn-text: #1b1b1e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

/* Hexagonfältet: tomma konturer, 3px linje, uttoning mot innehållet */
.hexfield {
  flex: 0 0 38%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='112' height='200'%3E%3Cg fill='none' stroke='%23d4d4db' stroke-width='3'%3E%3Cpath d='M56 132L0 100L0 32L56 0L112 32L112 100L56 132L56 200'/%3E%3Cpath d='M56 0L56 68L0 100L0 168L56 200L112 168L112 100L56 68'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(to right, black 55%, transparent 100%);
  mask-image: linear-gradient(to right, black 55%, transparent 100%);
}
@media (prefers-color-scheme: dark) {
  .hexfield {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='112' height='200'%3E%3Cg fill='none' stroke='%233a3a40' stroke-width='3'%3E%3Cpath d='M56 132L0 100L0 32L56 0L112 32L112 100L56 132L56 200'/%3E%3Cpath d='M56 0L56 68L0 100L0 168L56 200L112 168L112 100L56 68'/%3E%3C/g%3E%3C/svg%3E");
  }
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 3.5rem 3rem 1rem;
  max-width: 36rem;
}

h1 {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 0;
}

.links {
  display: flex;
  gap: 1.8rem;
  margin-top: 1.3rem;
  font-size: .9rem;
  align-items: baseline;
  flex-wrap: wrap;
}
.links a,
.links summary {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid var(--underline);
  padding-bottom: 2px;
}
.links a:hover,
.links summary:hover {
  color: var(--ink);
  border-color: var(--ink);
}

details.mail summary {
  cursor: pointer;
  list-style: none;
  display: inline;
}
details.mail summary::-webkit-details-marker { display: none; }

/* Formulärkortet */
#contact-form {
  margin-top: 1.1rem;
  width: 100%;
  max-width: 23rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.15rem;
  box-shadow: 0 10px 32px rgba(30, 30, 36, .10), 0 2px 6px rgba(30, 30, 36, .05);
  animation: form-in .2s ease;
}
@keyframes form-in {
  from { opacity: 0; transform: translateY(-5px); }
}
@media (prefers-reduced-motion: reduce) {
  #contact-form { animation: none; }
}

#contact-form input,
#contact-form textarea {
  font-family: inherit;
  font-size: .9rem;
  padding: .65rem .85rem;
  border: 1px solid var(--field-border);
  background: var(--field);
  color: var(--ink);
  border-radius: 10px;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#contact-form ::placeholder { color: var(--placeholder); }
#contact-form input:focus,
#contact-form textarea:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(42, 42, 46, .08);
}
#contact-form textarea { min-height: 4.5rem; resize: vertical; }

/* Honeypot: dolt för människor, ifyllbart för bottar */
.hp {
  position: absolute !important;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-status { margin: 0; font-size: .82rem; color: var(--dim); min-height: 1em; }
.form-status:empty { display: none; }

.form-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.form-foot .alt {
  font-size: .78rem;
  color: var(--dim);
  border-bottom: 1px solid var(--underline);
  text-decoration: none;
  padding-bottom: 1px;
}
#contact-form button {
  font-family: inherit;
  font-size: .88rem;
  font-weight: 500;
  padding: .6rem 1.6rem;
  background: var(--btn);
  color: var(--btn-text);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: .03em;
  transition: background .15s ease;
}
#contact-form button:hover { background: var(--btn-hover); }
#contact-form button:disabled { opacity: .7; cursor: default; }

/* Projektlistan */
#projects {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  font-size: .95rem;
}
#projects a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--underline);
  padding-bottom: 2px;
}
#projects a:hover { border-color: var(--ink); }
#projects code {
  color: var(--dim);
  font-size: .78rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  margin-left: .6rem;
}

a:focus-visible, summary:focus-visible, button:focus-visible,
input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Mobil: hexband i toppen, innehållet under */
@media (max-width: 700px) {
  body { flex-direction: column; }
  .hexfield {
    flex: 0 0 130px;
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
  }
  main {
    padding: 0 1.5rem 2.5rem;
    justify-content: flex-start;
    max-width: none;
  }
  h1 { font-size: 1.4rem; }
  .links { gap: 1.4rem; font-size: .86rem; }
}
