/* ------------------------------------------------------------------
   dinukasal.github.io
   Typography-driven, hand-written CSS. No framework, no build step.
   Themes: [data-theme="light"] (default) / [data-theme="dark"]
   ------------------------------------------------------------------ */

:root {
    --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
    --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --bg: #f7f4ed;
    --bg-soft: #fffdf7;
    --ink: #1a1916;
    --ink-2: #55514a;
    --ink-3: #8a8479;
    --rule: #ddd6c7;
    --rule-soft: #e8e2d5;
    --accent: #a04522;
    --accent-soft: #f0e2d5;
    --select: #ecdfcc;
}

[data-theme="dark"] {
    --bg: #16150f;
    --bg-soft: #1c1b15;
    --ink: #ece7dc;
    --ink-2: #a9a297;
    --ink-3: #7c766b;
    --rule: #302e26;
    --rule-soft: #26241e;
    --accent: #dd9468;
    --accent-soft: #2a231b;
    --select: #33291f;
}

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

html {
    color-scheme: light;
}

[data-theme="dark"] {
    color-scheme: dark;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--ink-2);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.68;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

.wrap,
.container {
    max-width: 43rem;
    margin: 0 auto;
    padding: 3.5rem 1.5rem 4rem;
}

a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
    transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

a:hover {
    text-decoration-color: currentColor;
}

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

/* ---------------------------- masthead ---------------------------- */

.masthead {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
}

.identity {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    min-width: 0;
}

.avatar {
    flex: 0 0 auto;
    width: 76px;
    height: 76px;
    border-radius: 3px;
    object-fit: cover;
    border: 1px solid var(--rule);
    filter: grayscale(1) contrast(1.02);
    transition: filter 0.4s ease;
}

.identity:hover .avatar {
    filter: grayscale(0);
}

.identity h1 {
    margin: 0 0 0.3rem;
    font-family: var(--font-serif);
    font-size: 1.85rem;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.015em;
    color: var(--ink);
}

.meta {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    color: var(--ink-3);
}

.meta .sep {
    padding: 0 0.35em;
    color: var(--rule);
}

/* theme switch */

.theme-toggle {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--rule);
    border-radius: 50%;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
    color: var(--ink);
    border-color: var(--ink-3);
    background: var(--bg-soft);
}

.theme-toggle svg {
    width: 15px;
    height: 15px;
    display: block;
}

.theme-toggle .icon-sun {
    display: none;
}

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

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

/* ---------------------------- lede ---------------------------- */

.lede {
    margin: 0 0 1.5rem;
    max-width: 34em;
    font-family: var(--font-serif);
    font-size: 1.28rem;
    font-weight: 300;
    line-height: 1.5;
    color: var(--ink);
    letter-spacing: -0.005em;
}

.inline-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    margin: 0 0 2.75rem;
    padding: 0;
    list-style: none;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.03em;
    text-transform: lowercase;
}

.inline-links a {
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    padding-bottom: 1px;
}

.inline-links a:hover {
    border-bottom-color: var(--accent);
}

/* ---------------------------- sections ---------------------------- */

.section {
    display: grid;
    grid-template-columns: 8.5rem minmax(0, 1fr);
    column-gap: 1.75rem;
    padding: 1.6rem 0;
    border-top: 1px solid var(--rule);
}

.section > h2 {
    margin: 0;
    padding-top: 0.32rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.section-body > *:first-child {
    margin-top: 0;
}

.section-body > *:last-child {
    margin-bottom: 0;
}

.section-body p {
    margin: 0 0 1rem;
    max-width: 40em;
}

.section-body h3 {
    margin: 1.9rem 0 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.section-body h3:first-child {
    margin-top: 0;
}

/* ---------------------------- work list ---------------------------- */

.work-item {
    padding: 0.85rem 0;
}

.work-item:first-child {
    padding-top: 0;
}

.work-item + .work-item {
    border-top: 1px solid var(--rule-soft);
}

.work-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.65rem;
}

.work-company {
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

a.work-company:hover {
    border-bottom-color: var(--accent);
    color: var(--accent);
}

.work-role {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    color: var(--ink-3);
    text-align: right;
}

.work-desc {
    margin: 0.3rem 0 0;
    font-size: 0.9rem;
    color: var(--ink-2);
    max-width: 38em;
}

/* ---------------------------- skills ---------------------------- */

.tags {
    margin: 0;
    max-width: 40em;
    font-size: 0.95rem;
    color: var(--ink-2);
    line-height: 1.9;
}


/* ---------------------------- entry lists ---------------------------- */

.entry-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.entry-list > li + li {
    border-top: 1px solid var(--rule-soft);
}

.entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: baseline;
    column-gap: 0.85rem;
    padding: 0.8rem 0;
    text-decoration: none;
}

.entry-list > li:first-child .entry {
    padding-top: 0;
}

.entry-title {
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    transition: color 0.15s ease;
}

.entry-arrow {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--ink-3);
    transition: transform 0.15s ease, color 0.15s ease;
}

.entry-date {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    color: var(--ink-3);
    white-space: nowrap;
}

.entry-desc {
    grid-column: 1 / -1;
    margin-top: 0.15rem;
    font-size: 0.9rem;
    color: var(--ink-2);
    max-width: 40em;
}

.entry:hover .entry-title {
    color: var(--accent);
}

.entry:hover .entry-arrow {
    color: var(--accent);
    transform: translate(3px, -3px);
}

/* ---------------------------- contact ---------------------------- */

.contact-email {
    display: inline-block;
    margin: 0 0 1.25rem;
    font-family: var(--font-serif);
    font-size: 1.45rem;
    font-weight: 300;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 0.1rem;
    transition: border-color 0.15s ease, color 0.15s ease;
}

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

.elsewhere {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.02em;
}

.elsewhere a {
    text-decoration: none;
    color: var(--ink-2);
    border-bottom: 1px solid transparent;
    padding-bottom: 1px;
}

.elsewhere a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ---------------------------- footer ---------------------------- */

footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    margin-top: 3rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    color: var(--ink-3);
}

footer p {
    margin: 0;
}

/* ---------------------------- article pages ---------------------------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2.5rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.02em;
}

.topbar a {
    text-decoration: none;
    color: var(--ink-3);
}

.topbar a:hover {
    color: var(--accent);
}

.article {
    padding-bottom: 0.5rem;
}

.article h1 {
    margin: 0 0 1rem;
    font-family: var(--font-serif);
    font-size: 2.15rem;
    font-weight: 500;
    line-height: 1.18;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-wrap: balance;
}

.article h2 {
    margin: 2.75rem 0 1rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--rule);
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--ink);
}

/* Shareable section links (added by theme.js). */
.article h2[id],
.article h3[id] {
    scroll-margin-top: 1.25rem;
}

.heading-link {
    position: relative;
    margin-left: 0.45em;
    font-family: var(--font-mono);
    font-weight: 400;
    color: var(--ink-3);
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.article h2:hover .heading-link,
.article h3:hover .heading-link,
.heading-link:focus-visible,
.heading-link[data-copied] {
    opacity: 1;
}

.heading-link:hover {
    color: var(--accent);
}

.heading-link[data-copied]::after {
    content: "link copied";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: none;
    color: var(--accent);
}

/* Touch screens have no hover: keep the link faintly visible. */
@media (hover: none) {
    .heading-link {
        opacity: 0.45;
    }
}

.article :target {
    color: var(--accent);
}

.article h3 {
    margin: 1.9rem 0 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.article p {
    margin: 0.9rem 0;
    max-width: 40em;
}

.article strong {
    color: var(--ink);
    font-weight: 600;
}

.article em {
    color: var(--ink-2);
}

.article a {
    overflow-wrap: break-word;
}

.article ul,
.article ol {
    margin: 0.9rem 0;
    padding-left: 1.4rem;
    max-width: 40em;
}

.article li {
    margin: 0.4rem 0;
}

.article li::marker {
    color: var(--ink-3);
}

.article hr {
    height: 0;
    margin: 2.25rem 0;
    border: 0;
    border-top: 1px solid var(--rule);
}

.article code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--accent-soft);
    color: var(--ink);
    padding: 0.1em 0.35em;
    border-radius: 3px;
}

.article pre {
    margin: 1.25rem 0;
    padding: 1rem 1.15rem;
    overflow-x: auto;
    background: var(--bg-soft);
    border: 1px solid var(--rule);
    border-radius: 4px;
    line-height: 1.6;
}

.article pre code {
    display: block;
    padding: 0;
    background: none;
    color: var(--ink-2);
    font-size: 0.8rem;
    white-space: pre;
}

.article blockquote {
    margin: 1.4rem 0;
    padding: 0.1rem 0 0.1rem 1.15rem;
    border-left: 2px solid var(--accent);
    color: var(--ink-2);
}

.article blockquote p {
    margin: 0.4rem 0;
}

.table-wrap {
    margin: 1.35rem 0;
    overflow-x: auto;
    border: 1px solid var(--rule);
    border-radius: 4px;
}

.article table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    font-variant-numeric: tabular-nums;
}

.article th,
.article td {
    padding: 0.55rem 0.85rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--rule-soft);
}

.article th {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
    background: var(--bg-soft);
    white-space: nowrap;
}

.article tbody tr:last-child td {
    border-bottom: 0;
}

.article tbody tr:hover td {
    background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
}

.article-nav-bottom {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2.5rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
}

/* ---------------------------- responsive ---------------------------- */

@media (max-width: 640px) {
    .wrap,
    .container {
        padding: 2.25rem 1.15rem 3rem;
    }

    .masthead {
        margin-bottom: 1.5rem;
    }

    .identity {
        gap: 0.9rem;
    }

    .avatar {
        width: 58px;
        height: 58px;
    }

    .identity h1 {
        font-size: 1.45rem;
    }

    .meta {
        font-size: 0.66rem;
    }

    .lede {
        font-size: 1.15rem;
    }

    .section {
        grid-template-columns: 1fr;
        row-gap: 0.6rem;
        padding: 1.35rem 0;
    }

    .section > h2 {
        padding-top: 0;
    }

    .work-role {
        margin-left: 0;
        text-align: left;
        width: 100%;
    }

    .entry {
        column-gap: 0.6rem;
    }

    .topbar {
        margin-bottom: 1.75rem;
    }

    .article h1 {
        font-size: 1.65rem;
    }

    .article h2 {
        font-size: 1.2rem;
    }

    .article pre code {
        font-size: 0.75rem;
    }

    .contact-email {
        font-size: 1.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
